line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CHI::Cascade::Target; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
105
|
use strict; |
|
15
|
|
|
|
|
34
|
|
|
15
|
|
|
|
|
571
|
|
4
|
15
|
|
|
15
|
|
78
|
use warnings; |
|
15
|
|
|
|
|
31
|
|
|
15
|
|
|
|
|
535
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
5009
|
use Time::HiRes; |
|
15
|
|
|
|
|
12967
|
|
|
15
|
|
|
|
|
121
|
|
7
|
15
|
|
|
15
|
|
1844
|
use Time::Duration::Parse; |
|
15
|
|
|
|
|
1928
|
|
|
15
|
|
|
|
|
156
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
4
|
|
|
4
|
0
|
654
|
my ($class, %opts) = @_; |
11
|
|
|
|
|
|
|
|
12
|
4
|
|
33
|
|
|
35
|
bless { %opts }, ref($class) || $class; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub lock { |
16
|
8
|
|
|
8
|
0
|
39
|
$_[0]->{locked} = $$; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub locked { |
20
|
|
|
|
|
|
|
exists $_[0]->{locked} |
21
|
43
|
100
|
|
43
|
0
|
291
|
and $_[0]->{locked}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub unlock { |
25
|
8
|
|
|
8
|
0
|
22
|
delete $_[0]->{locked}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub time { |
29
|
36
|
100
|
|
36
|
0
|
10882
|
$_[0]->{time} || 0; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub touch { |
33
|
10
|
|
|
10
|
0
|
40
|
$_[0]->{time} = Time::HiRes::time; |
34
|
10
|
|
|
|
|
21
|
delete $_[0]->{finish_time}; |
35
|
10
|
|
|
|
|
23
|
delete $_[0]->{expires_finish_time}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub actual_stamp { |
39
|
3
|
|
|
3
|
0
|
13
|
$_[0]->{actual_stamp} = Time::HiRes::time; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub is_actual { |
43
|
5
|
|
50
|
5
|
0
|
2015
|
( $_[0]->{actual_stamp} || $_[0]->{time} || 0 ) + $_[1] >= Time::HiRes::time; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub ttl { |
47
|
25
|
|
|
25
|
0
|
7752
|
my $self = shift; |
48
|
|
|
|
|
|
|
|
49
|
25
|
50
|
|
|
|
57
|
if (@_) { |
50
|
0
|
|
0
|
|
|
0
|
$self->{finish_time} = ( $_[1] || Time::HiRes::time ) + $_[0]; |
51
|
0
|
|
|
|
|
0
|
return $self; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
else { |
54
|
25
|
50
|
33
|
|
|
94
|
return exists $self->{finish_time} && $self->{finish_time} ? $self->{finish_time} - Time::HiRes::time : undef; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub expires { |
59
|
20
|
|
|
20
|
0
|
74
|
my $self = shift; |
60
|
20
|
|
|
|
|
38
|
my $expires = $_[0]; |
61
|
|
|
|
|
|
|
|
62
|
20
|
100
|
|
|
|
40
|
if (@_) { |
63
|
10
|
50
|
33
|
|
|
76
|
return $expires |
64
|
|
|
|
|
|
|
if $expires eq 'never' || $expires eq 'now'; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
0
|
$self->{expires_finish_time} = Time::HiRes::time + parse_duration( $expires ); |
67
|
0
|
|
|
|
|
0
|
return $expires; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
else { |
70
|
|
|
|
|
|
|
return |
71
|
|
|
|
|
|
|
exists $self->{expires_finish_time} && $self->{expires_finish_time} |
72
|
|
|
|
|
|
|
? |
73
|
|
|
|
|
|
|
( |
74
|
|
|
|
|
|
|
$self->{expires_finish_time} > Time::HiRes::time |
75
|
|
|
|
|
|
|
? |
76
|
10
|
0
|
33
|
|
|
61
|
int( $self->{expires_finish_time} - Time::HiRes::time + 0.5 ) || 'now' |
|
|
50
|
0
|
|
|
|
|
77
|
|
|
|
|
|
|
: |
78
|
|
|
|
|
|
|
'now' |
79
|
|
|
|
|
|
|
) |
80
|
|
|
|
|
|
|
: |
81
|
|
|
|
|
|
|
undef; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |