File Coverage

blib/lib/Date/Language/English.pm
Criterion Covered Total %
statement 8 12 66.6
branch 0 2 0.0
condition n/a
subroutine 4 8 50.0
pod 0 6 0.0
total 12 28 42.8


line stmt bran cond sub pod time code
1             ##
2             ## English tables
3             ##
4              
5             package Date::Language::English;
6              
7 2     2   23 use Date::Language ();
  2         4  
  2         51  
8 2     2   9 use vars qw(@ISA @DoW @DoWs @MoY @MoYs @AMPM @Dsuf %MoY %DoW $VERSION);
  2         3  
  2         747  
9             @ISA = qw(Date::Language);
10             $VERSION = "1.01";
11              
12             @DoW = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
13             @MoY = qw(January February March April May June
14             July August September October November December);
15             @DoWs = map { substr($_,0,3) } @DoW;
16             @MoYs = map { substr($_,0,3) } @MoY;
17             @AMPM = qw(AM PM);
18              
19             @Dsuf = (qw(th st nd rd th th th th th th)) x 3;
20             @Dsuf[11,12,13] = qw(th th th);
21             @Dsuf[30,31] = qw(th st);
22              
23             @MoY{@MoY} = (0 .. scalar(@MoY));
24             @MoY{@MoYs} = (0 .. scalar(@MoYs));
25             @DoW{@DoW} = (0 .. scalar(@DoW));
26             @DoW{@DoWs} = (0 .. scalar(@DoWs));
27              
28             # Formatting routines
29              
30 1     1 0 5 sub format_a { $DoWs[$_[0]->[6]] }
31 0     0 0 0 sub format_A { $DoW[$_[0]->[6]] }
32 1     1 0 4 sub format_b { $MoYs[$_[0]->[4]] }
33 0     0 0   sub format_B { $MoY[$_[0]->[4]] }
34 0     0 0   sub format_h { $MoYs[$_[0]->[4]] }
35 0 0   0 0   sub format_p { $_[0]->[2] >= 12 ? $AMPM[1] : $AMPM[0] }
36              
37             1;