line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CHI::Cascade::Target; |
2
|
|
|
|
|
|
|
|
3
|
15
|
|
|
15
|
|
141
|
use strict; |
|
15
|
|
|
|
|
31
|
|
|
15
|
|
|
|
|
588
|
|
4
|
15
|
|
|
15
|
|
77
|
use warnings; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
437
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
5124
|
use Time::HiRes; |
|
15
|
|
|
|
|
12927
|
|
|
15
|
|
|
|
|
85
|
|
7
|
15
|
|
|
15
|
|
1864
|
use Time::Duration::Parse; |
|
15
|
|
|
|
|
1991
|
|
|
15
|
|
|
|
|
142
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
4
|
|
|
4
|
0
|
652
|
my ($class, %opts) = @_; |
11
|
|
|
|
|
|
|
|
12
|
4
|
|
33
|
|
|
35
|
bless { %opts }, ref($class) || $class; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub lock { |
16
|
8
|
|
|
8
|
0
|
42
|
$_[0]->{locked} = $$; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub locked { |
20
|
|
|
|
|
|
|
exists $_[0]->{locked} |
21
|
43
|
100
|
|
43
|
0
|
297
|
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
|
10780
|
$_[0]->{time} || 0; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub touch { |
33
|
10
|
|
|
10
|
0
|
37
|
$_[0]->{time} = Time::HiRes::time; |
34
|
10
|
|
|
|
|
20
|
delete $_[0]->{finish_time}; |
35
|
10
|
|
|
|
|
20
|
delete $_[0]->{expires_finish_time}; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub actual_stamp { |
39
|
3
|
|
|
3
|
0
|
12
|
$_[0]->{actual_stamp} = Time::HiRes::time; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub is_actual { |
43
|
5
|
|
50
|
5
|
0
|
1981
|
( $_[0]->{actual_stamp} || $_[0]->{time} || 0 ) + $_[1] >= Time::HiRes::time; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub ttl { |
47
|
25
|
|
|
25
|
0
|
7873
|
my $self = shift; |
48
|
|
|
|
|
|
|
|
49
|
25
|
50
|
|
|
|
64
|
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
|
|
|
96
|
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
|
36
|
my $self = shift; |
60
|
20
|
|
|
|
|
46
|
my $expires = $_[0]; |
61
|
|
|
|
|
|
|
|
62
|
20
|
100
|
|
|
|
42
|
if (@_) { |
63
|
10
|
50
|
33
|
|
|
72
|
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
|
|
|
59
|
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; |