line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CHI::Cascade::Target; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
106
|
use strict; |
|
15
|
|
|
|
|
33
|
|
|
15
|
|
|
|
|
540
|
|
4
|
15
|
|
|
15
|
|
95
|
use warnings; |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
459
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
4927
|
use Time::HiRes; |
|
15
|
|
|
|
|
12448
|
|
|
15
|
|
|
|
|
88
|
|
7
|
15
|
|
|
15
|
|
2166
|
use Time::Duration::Parse; |
|
15
|
|
|
|
|
2005
|
|
|
15
|
|
|
|
|
123
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
4
|
|
|
4
|
0
|
636
|
my ($class, %opts) = @_; |
11
|
|
|
|
|
|
|
|
12
|
4
|
|
33
|
|
|
29
|
bless { %opts }, ref($class) || $class; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub lock { |
16
|
8
|
|
|
8
|
0
|
35
|
$_[0]->{locked} = $$; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub locked { |
20
|
|
|
|
|
|
|
exists $_[0]->{locked} |
21
|
43
|
100
|
|
43
|
0
|
294
|
and $_[0]->{locked}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub unlock { |
25
|
8
|
|
|
8
|
0
|
21
|
delete $_[0]->{locked}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub time { |
29
|
36
|
100
|
|
36
|
0
|
11144
|
$_[0]->{time} || 0; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub touch { |
33
|
10
|
|
|
10
|
0
|
44
|
$_[0]->{time} = Time::HiRes::time; |
34
|
10
|
|
|
|
|
20
|
delete $_[0]->{finish_time}; |
35
|
10
|
|
|
|
|
21
|
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
|
1823
|
( $_[0]->{actual_stamp} || $_[0]->{time} || 0 ) + $_[1] >= Time::HiRes::time; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub ttl { |
47
|
25
|
|
|
25
|
0
|
7543
|
my $self = shift; |
48
|
|
|
|
|
|
|
|
49
|
25
|
50
|
|
|
|
56
|
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
|
|
|
92
|
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
|
39
|
my $self = shift; |
60
|
20
|
|
|
|
|
28
|
my $expires = $_[0]; |
61
|
|
|
|
|
|
|
|
62
|
20
|
100
|
|
|
|
42
|
if (@_) { |
63
|
10
|
50
|
33
|
|
|
69
|
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
|
|
|
58
|
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; |