line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Time::Piece::ISO; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
27667
|
use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
95
|
|
4
|
1
|
|
|
1
|
|
964
|
use Time::Piece (); |
|
1
|
|
|
|
|
31438
|
|
|
1
|
|
|
|
|
118
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
@ISA = qw(Time::Piece); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
@EXPORT = @Time::Piece::EXPORT; |
9
|
|
|
|
|
|
|
%EXPORT_TAGS = %Time::Piece::EXPORT_TAGS; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '0.12'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
|
|
202
|
use overload '""' => \&iso, |
14
|
1
|
|
|
1
|
|
15
|
cmp => \&str_compare; |
|
1
|
|
|
|
|
9
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#sub iso { $_[0]->datetime(date => '-', time => ':', T => 'T' ) } |
17
|
6
|
|
|
6
|
1
|
1665
|
sub iso { $_[0]->datetime } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub str_compare { |
20
|
5
|
|
|
5
|
0
|
4955
|
my ($lhs, $rhs, $reverse) = @_; |
21
|
5
|
100
|
|
|
|
38
|
$rhs = $rhs->datetime if UNIVERSAL::isa($rhs, 'Time::Piece'); |
22
|
5
|
50
|
|
|
|
82
|
return $reverse ? $rhs cmp $lhs->datetime : $lhs->datetime cmp $rhs; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Rebless into this class. |
26
|
4
|
|
|
4
|
0
|
4250
|
sub localtime { bless &Time::Piece::localtime, __PACKAGE__ } |
27
|
4
|
|
|
4
|
0
|
1750
|
sub gmtime { bless &Time::Piece::gmtime, __PACKAGE__ } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub strptime { |
30
|
|
|
|
|
|
|
# Default to ISO 8601 format in strptime. |
31
|
2
|
50
|
|
2
|
1
|
1211
|
$_[2] = '%Y-%m-%dT%H:%M:%S' unless defined $_[2]; |
32
|
2
|
|
|
|
|
7
|
bless &Time::Piece::strptime, __PACKAGE__; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
__END__ |