[system] / trunk / xmlrpc / modules / My / Examples.pm Repository:
ViewVC logotype

Annotation of /trunk/xmlrpc/modules/My/Examples.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 279 - (view) (download) (as text)

1 : gage 279 package My::Examples;
2 :    
3 :     my @states = (undef, # we want to start from one :)
4 :     qw/Alabama Alaska Arizona Arkansas California Colorado Connecticut
5 :     Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas
6 :     Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota
7 :     Mississippi Missouri Montana Nebraska Nevada/, 'New Hampshire',
8 :     'New Jersey', 'New Mexico', 'New York', 'North Carolina',
9 :     'North Dakota', qw/Ohio Oklahoma Oregon Pennsylvania/, 'Rhode Island',
10 :     'South Carolina', 'South Dakota', qw/Tennessee Texas Utah Vermont
11 :     Virginia Washington/, 'West Virginia', 'Wisconsin', 'Wyoming'
12 :     );
13 :    
14 :     sub getStateName {
15 :     my $self = shift;
16 :     $states[shift];
17 :     }
18 :    
19 :     sub getStateNames {
20 :     my $self = shift;
21 :     join "\n", map {$states[$_]} @_;
22 :     }
23 :    
24 :     sub getStateList {
25 :     my $self = shift;
26 :     [map {$states[$_]} @{shift()}];
27 :     }
28 :    
29 :     sub getStateStruct {
30 :     my $self = shift;
31 :     my %states = %{shift()};
32 :     # be careful to distinguish block from hash. Just {} won't work
33 :     +{map {$_ => $states[$states{$_}]} keys %states};
34 :     }
35 :    
36 :     1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9