line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Petal::Utils::US_Date; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
79
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings::register; |
|
2
|
|
|
|
|
19
|
|
|
2
|
|
|
|
|
288
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
13
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
147
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
11
|
use base qw( Petal::Utils::Base ); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
183
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
13
|
use constant name => 'us_date'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
123
|
|
11
|
2
|
|
|
2
|
|
11
|
use constant aliases => qw(); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
649
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1]; |
14
|
|
|
|
|
|
|
our $REVISION = (split(/ /, ' $Revision: 1.2 $ '))[2]; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub process { |
17
|
4
|
|
|
4
|
0
|
451
|
my $class = shift; |
18
|
4
|
|
|
|
|
6
|
my $hash = shift; |
19
|
4
|
|
33
|
|
|
12
|
my $args = shift || confess( "'us_date' expects a variable (got nothing)!" ); |
20
|
|
|
|
|
|
|
|
21
|
4
|
|
|
|
|
5
|
my ($year,$mon,$day); |
22
|
4
|
|
|
|
|
14
|
my ($date, $sep) = $hash->fetch($args); |
23
|
4
|
|
50
|
|
|
285
|
$sep ||= '/'; |
24
|
4
|
100
|
|
|
|
11
|
if ($date =~ /[-|\/]/) { |
25
|
2
|
|
|
|
|
9
|
($year,$mon,$day) = split(/[-|\/]/, $date); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
else { |
28
|
2
|
|
|
|
|
10
|
($year,$mon,$day) = $date =~ /(\d{4})(\d{2})(\d{2})/; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
4
|
|
|
|
|
27
|
return sprintf("%02d$sep%02d$sep%04d", $mon,$day,$year); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |