line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
25314
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
443
|
|
3
|
|
|
|
|
|
|
package Time::Duration::Object::Infinite; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$Time::Duration::Object::Infinite::VERSION = '0.301'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
# ABSTRACT: Time::Duration::Object, but infinite |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub isa { |
10
|
2
|
100
|
|
2
|
0
|
847
|
return 1 if $_[1] eq 'Time::Duration::Object'; |
11
|
1
|
|
|
|
|
11
|
return $_[0]->UNIVERSAL::isa($_[1]); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new_positive { |
16
|
1
|
|
|
1
|
1
|
3
|
my ($class) = @_; |
17
|
1
|
|
|
|
|
4
|
my $duration = 1; |
18
|
1
|
|
|
|
|
6
|
bless \$duration => $class; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
1
|
19
|
sub new { shift->new_positive } |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new_negative { |
25
|
1
|
|
|
1
|
1
|
412
|
my ($class) = @_; |
26
|
1
|
|
|
|
|
4
|
my $duration = -1; |
27
|
1
|
|
|
|
|
4
|
bless \$duration => $class; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
11
|
|
|
11
|
|
12
|
sub _is_pos { ${$_[0]} == -1 } |
|
11
|
|
|
|
|
33
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub seconds { |
34
|
0
|
|
|
0
|
0
|
0
|
require Math::BigInt; |
35
|
0
|
0
|
|
|
|
0
|
return Math::BigInt->binf(shift->_is_pos ? '-' : ()); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
0
|
1
|
0
|
sub duration { 'forever' } |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# This is to make it easy to implement the matched pair methods. |
42
|
|
|
|
|
|
|
sub _flop { |
43
|
11
|
|
|
11
|
|
22
|
my ($self, $flop, $pair) = @_; |
44
|
11
|
100
|
|
|
|
37
|
my $is_pos = $flop ? ! $self->_is_pos : $self->_is_pos; |
45
|
11
|
100
|
|
|
|
27
|
my $index = $is_pos ? 0 : 1; |
46
|
11
|
|
|
|
|
16
|
my $str = $pair->[$index]; |
47
|
11
|
|
|
|
|
111
|
bless \$str => 'Time::Duration::_Result::_Infinite'; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $ago_from_now; |
51
|
|
|
|
|
|
|
my $earlier_later; |
52
|
|
|
|
|
|
|
BEGIN { |
53
|
1
|
|
|
1
|
|
4
|
$ago_from_now = [ 'forever ago', 'forever from now' ]; |
54
|
1
|
|
|
|
|
499
|
$earlier_later = [ 'infinitely earlier', 'infinitely later' ]; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
6
|
|
|
6
|
1
|
20
|
sub ago { $_[0]->_flop(1, $ago_from_now); } |
59
|
1
|
|
|
1
|
1
|
462
|
sub ago_exact { $_[0]->_flop(1, $ago_from_now); } |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
0
|
1
|
0
|
sub from_now { $_[0]->_flop(0, $ago_from_now); } |
63
|
0
|
|
|
0
|
1
|
0
|
sub from_now_exact { $_[0]->_flop(0, $ago_from_now); } |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
2
|
|
|
2
|
1
|
7
|
sub later { $_[0]->_flop(0, $earlier_later); } |
67
|
0
|
|
|
0
|
1
|
0
|
sub later_exact { $_[0]->_flop(0, $earlier_later); } |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
2
|
1
|
8
|
sub earlier { $_[0]->_flop(1, $earlier_later); } |
71
|
0
|
|
|
0
|
1
|
0
|
sub earlier_exact { $_[0]->_flop(1, $earlier_later); } |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
package Time::Duration::_Result::_Infinite; |
74
|
|
|
|
|
|
|
{ |
75
|
|
|
|
|
|
|
$Time::Duration::_Result::_Infinite::VERSION = '0.301'; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub concise { |
80
|
1
|
|
|
1
|
|
1
|
${ $_[0] } |
|
1
|
|
|
|
|
5
|
|
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
9
|
|
|
9
|
|
860
|
sub as_string { ${ $_[0] } } |
|
9
|
|
|
|
|
79
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
use overload |
86
|
1
|
|
|
|
|
7
|
'""' => 'as_string', |
87
|
1
|
|
|
1
|
|
1973
|
fallback => 1; |
|
1
|
|
|
|
|
1143
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |