/[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

Annotation of /lib/Arh/Test.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 28 - (hide annotations)
Mon Dec 10 14:56:12 2007 UTC (12 years, 3 months ago) by dpavlin
File size: 1218 byte(s)
added UnitPicture model, first try at user interface for it
1 dpavlin 27 package Arh::Test;
2    
3     use strict;
4     use warnings;
5    
6 dpavlin 28 my $uid = 0;
7 dpavlin 27
8 dpavlin 28 sub unique {
9     my ( $self, $value ) = @_;
10     return $value . ' ' . $uid++;
11     }
12 dpavlin 27
13 dpavlin 28 sub Place {
14     my $self = shift;
15    
16 dpavlin 27 my $place = Arh::Model::Place->new;
17     $place->create(
18 dpavlin 28 name => $self->unique('mjesto iskapanja'),
19     ) || die "can't create";
20     return $place;
21     }
22 dpavlin 27
23 dpavlin 28 sub Campaign {
24     my $self = shift;
25    
26 dpavlin 27 my $campaign = Arh::Model::Campaign->new;
27     $campaign->create(
28 dpavlin 28 place => $self->Place,
29     name => $self->unique('iskapanje'),
30 dpavlin 27 date_from => '2007-11-28',
31     date_to => '2008-03-15',
32 dpavlin 28 ) || die "can't create";
33 dpavlin 27
34 dpavlin 28 return $campaign;
35     }
36    
37     sub Unit {
38     my $self = shift;
39    
40 dpavlin 27 my $unit = Arh::Model::Unit->new;
41     $unit->create(
42 dpavlin 28 name => $self->unique('test unit'),
43 dpavlin 27 inv_id => 42,
44 dpavlin 28 campaign => $self->Campaign,
45     ) || die "can't create";
46 dpavlin 27
47     return $unit;
48    
49     }
50    
51 dpavlin 28 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 dpavlin 27 1;

  ViewVC Help
Powered by ViewVC 1.1.26