line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
29749
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
508
|
|
2
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
92
|
|
3
|
|
|
|
|
|
|
package Time::Duration::Object; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$Time::Duration::Object::VERSION = '0.301'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
# ABSTRACT: Time::Duration, but an object |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1220
|
use Time::Duration 1.02; |
|
1
|
|
|
|
|
2202
|
|
|
1
|
|
|
|
|
188
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
3
|
|
|
3
|
1
|
1653
|
my ($class, $duration) = @_; |
14
|
3
|
100
|
|
|
|
16
|
return unless defined $duration; |
15
|
2
|
|
|
|
|
10
|
bless \$duration => $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub seconds { |
20
|
1
|
|
|
1
|
1
|
599
|
return ${(shift)}; |
|
1
|
|
|
|
|
10
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
{ |
25
|
|
|
|
|
|
|
## no critic (ProhibitNoStrict ProhibitNoWarnings) |
26
|
1
|
|
|
1
|
|
9
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
27
|
1
|
|
|
1
|
|
7
|
no warnings 'redefine'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
390
|
|
28
|
|
|
|
|
|
|
my @methods = map { $_, "$_\_exact" } qw(duration ago from_now later earlier); |
29
|
|
|
|
|
|
|
for (@methods) { |
30
|
|
|
|
|
|
|
my $method = \&{"Time::Duration::$_"}; |
31
|
|
|
|
|
|
|
*{$_} = sub { |
32
|
8
|
|
|
8
|
|
19
|
unshift @_, ${(shift)}; |
|
8
|
|
|
|
|
18
|
|
33
|
8
|
|
|
|
|
116
|
my $result = &$method(@_); |
34
|
8
|
|
|
|
|
922
|
bless \$result => 'Time::Duration::_Result'; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
package Time::Duration::_Result; |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
$Time::Duration::_Result::VERSION = '0.301'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
6
|
|
|
6
|
|
502
|
sub as_string { ${ $_[0] } } |
|
6
|
|
|
|
|
49
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub concise { |
49
|
1
|
|
|
1
|
|
1669
|
my $self = shift; |
50
|
1
|
|
|
|
|
2
|
Time::Duration::concise(${$self}); |
|
1
|
|
|
|
|
6
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
use overload |
54
|
1
|
|
|
|
|
7
|
'""' => 'as_string', |
55
|
1
|
|
|
1
|
|
2137
|
fallback => 1; |
|
1
|
|
|
|
|
1579
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |