/[Arh]/lib/Arh/Test.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /lib/Arh/Test.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 28 - (show annotations)
Mon Dec 10 14:56:12 2007 UTC (11 years, 7 months ago) by dpavlin
File size: 1218 byte(s)
added UnitPicture model, first try at user interface for it
1 package Arh::Test;
2
3 use strict;
4 use warnings;
5
6 my $uid = 0;
7
8 sub unique {
9 my ( $self, $value ) = @_;
10 return $value . ' ' . $uid++;
11 }
12
13 sub Place {
14 my $self = shift;
15
16 my $place = Arh::Model::Place->new;
17 $place->create(
18 name => $self->unique('mjesto iskapanja'),
19 ) || die "can't create";
20 return $place;
21 }
22
23 sub Campaign {
24 my $self = shift;
25
26 my $campaign = Arh::Model::Campaign->new;
27 $campaign->create(
28 place => $self->Place,
29 name => $self->unique('iskapanje'),
30 date_from => '2007-11-28',
31 date_to => '2008-03-15',
32 ) || die "can't create";
33
34 return $campaign;
35 }
36
37 sub Unit {
38 my $self = shift;
39
40 my $unit = Arh::Model::Unit->new;
41 $unit->create(
42 name => $self->unique('test unit'),
43 inv_id => 42,
44 campaign => $self->Campaign,
45 ) || die "can't create";
46
47 return $unit;
48
49 }
50
51 sub PictureType {
52 my $self = shift;
53
54 my $type = Arh::Model::PictureType->new;
55 $type->create(
56 name => $self->unique('slika'),
57 ) || die "can't create";
58
59 return $type;
60
61 }
62
63 sub Picture {
64 my $self = shift;
65
66 my $picture = Arh::Model::Picture->new;
67 $picture->create(
68 filename => $self->unique('foo') . '.jpg',
69 campaign => $self->Campaign,
70 type => $self->PictureType,
71 ) || die "can't create";
72
73 return $picture;
74 }
75
76 1;

  ViewVC Help
Powered by ViewVC 1.1.26