File Coverage

blib/lib/WebService/LOC/CongRec/Util.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1 1     1   1124 use 5.12.0;
  1         3  
  1         80  
2              
3             package WebService::LOC::CongRec::Util;
4             our $VERSION = '0.1_04';
5 1     1   180 use Moose 1.13;
  0            
  0            
6             with 'MooseX::Log::Log4perl';
7              
8             =head1 DESCRIPTION
9              
10             Helper methods for WebService::LOC::CongRec
11              
12             =back
13              
14             =head1 METHODS
15              
16             =head3 getCongressFromYear(Int $year)
17              
18             Get a Congress from a year
19              
20             =cut
21              
22             sub getCongressFromYear {
23             my ($self, $year) = @_;
24             return int(($year - 1789)/2 + 1);
25             }
26              
27             =head3 getMonthNumberFromString(Str $name)
28              
29             Get a numeric month from its name
30              
31             =cut
32              
33             sub getMonthNumberFromString {
34             my ($self, $name) = @_;
35              
36             my $months = {
37             'january' => 1,
38             'february' => 2,
39             'march' => 3,
40             'april' => 4,
41             'may' => 5,
42             'june' => 6,
43             'july' => 7,
44             'august' => 8,
45             'september' => 9,
46             'october' => 10,
47             'november' => 11,
48             'december' => 12,
49             };
50             return $months->{lc($name)};
51             }
52              
53             1;