line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Date::Language; |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
1657
|
use strict; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
88
|
|
5
|
3
|
|
|
3
|
|
505
|
use Time::Local; |
|
3
|
|
|
|
|
2419
|
|
|
3
|
|
|
|
|
161
|
|
6
|
3
|
|
|
3
|
|
17
|
use Carp; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
196
|
|
7
|
3
|
|
|
3
|
|
18
|
use vars qw($VERSION @ISA); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1004
|
|
8
|
|
|
|
|
|
|
require Date::Format; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = "1.10"; |
11
|
|
|
|
|
|
|
@ISA = qw(Date::Format::Generic); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
8
|
|
|
8
|
0
|
2008
|
my $self = shift; |
16
|
8
|
|
33
|
|
|
24
|
my $type = shift || $self; |
17
|
|
|
|
|
|
|
|
18
|
8
|
|
|
|
|
421
|
$type =~ s/^(\w+)$/Date::Language::$1/; |
19
|
|
|
|
|
|
|
|
20
|
8
|
50
|
|
|
|
42
|
croak "Bad language" |
21
|
|
|
|
|
|
|
unless $type =~ /^[\w:]+$/; |
22
|
|
|
|
|
|
|
|
23
|
8
|
50
|
|
|
|
486
|
eval "require $type" |
24
|
|
|
|
|
|
|
or croak $@; |
25
|
|
|
|
|
|
|
|
26
|
8
|
|
|
|
|
64
|
bless [], $type; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Stop AUTOLOAD being called ;-) |
30
|
|
|
|
0
|
|
|
sub DESTROY {} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub AUTOLOAD |
33
|
|
|
|
|
|
|
{ |
34
|
3
|
|
|
3
|
|
23
|
use vars qw($AUTOLOAD); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
278
|
|
35
|
|
|
|
|
|
|
|
36
|
5
|
50
|
|
5
|
|
40
|
if($AUTOLOAD =~ /::strptime\Z/o) |
37
|
|
|
|
|
|
|
{ |
38
|
5
|
|
|
|
|
9
|
my $self = $_[0]; |
39
|
5
|
|
33
|
|
|
23
|
my $type = ref($self) || $self; |
40
|
5
|
|
|
|
|
518
|
require Date::Parse; |
41
|
|
|
|
|
|
|
|
42
|
3
|
|
|
3
|
|
19
|
no strict 'refs'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1014
|
|
43
|
5
|
|
|
|
|
31
|
*{"${type}::strptime"} = Date::Parse::gen_parser( |
44
|
5
|
|
|
|
|
26
|
\%{"${type}::DoW"}, |
45
|
5
|
|
|
|
|
17
|
\%{"${type}::MoY"}, |
46
|
5
|
|
|
|
|
60
|
\@{"${type}::Dsuf"}, |
|
5
|
|
|
|
|
22
|
|
47
|
|
|
|
|
|
|
1); |
48
|
|
|
|
|
|
|
|
49
|
5
|
|
|
|
|
10
|
goto &{"${type}::strptime"}; |
|
5
|
|
|
|
|
130
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
0
|
croak "Undefined method &$AUTOLOAD called"; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub str2time |
56
|
|
|
|
|
|
|
{ |
57
|
5
|
|
|
5
|
1
|
17
|
my $me = shift; |
58
|
5
|
|
|
|
|
42
|
my @t = $me->strptime(@_); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
return undef |
61
|
5
|
50
|
|
|
|
17
|
unless @t; |
62
|
|
|
|
|
|
|
|
63
|
5
|
|
|
|
|
22
|
my($ss,$mm,$hh,$day,$month,$year,$zone) = @t; |
64
|
5
|
|
|
|
|
138
|
my @lt = localtime(time); |
65
|
|
|
|
|
|
|
|
66
|
5
|
|
100
|
|
|
23
|
$hh ||= 0; |
67
|
5
|
|
100
|
|
|
18
|
$mm ||= 0; |
68
|
5
|
|
100
|
|
|
11
|
$ss ||= 0; |
69
|
|
|
|
|
|
|
|
70
|
5
|
50
|
|
|
|
14
|
$month = $lt[4] |
71
|
|
|
|
|
|
|
unless(defined $month); |
72
|
|
|
|
|
|
|
|
73
|
5
|
50
|
|
|
|
13
|
$day = $lt[3] |
74
|
|
|
|
|
|
|
unless(defined $day); |
75
|
|
|
|
|
|
|
|
76
|
5
|
0
|
|
|
|
12
|
$year = ($month > $lt[4]) ? ($lt[5] - 1) : $lt[5] |
|
|
50
|
|
|
|
|
|
77
|
|
|
|
|
|
|
unless(defined $year); |
78
|
|
|
|
|
|
|
|
79
|
5
|
50
|
|
|
|
26
|
return defined $zone ? timegm($ss,$mm,$hh,$day,$month,$year) - $zone |
80
|
|
|
|
|
|
|
: timelocal($ss,$mm,$hh,$day,$month,$year); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |