| 1 | 2 | ▶ | use 5.12.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | |||
| 3 | package WebService::LOC::CongRec::Util; | ||
| 4 | 2 | our $VERSION = '0.1_04'; | |
| 5 | 2 | ▶ | use Moose 1.13; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 2 | 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 | 9 | ▶ | my ($self, $year) = @_; |
|
Subroutine
getCongressFromYear: called CC=1 SCAR=0.0
Pod
documented
| |||
| 24 | 9 | 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 | 1 | ▶ | my ($self, $name) = @_; |
|
Subroutine
getMonthNumberFromString: called CC=1 SCAR=0.0
Pod
documented
| |||
| 35 | |||
| 36 | 1 | 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 | 1 | return $months->{lc($name)}; | |
| 51 | } | ||
| 52 | |||
| 53 | 2 | 1; | |