line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
10
|
|
|
10
|
|
66
|
use strict; |
|
10
|
|
|
|
|
26
|
|
|
10
|
|
|
|
|
286
|
|
2
|
10
|
|
|
10
|
|
49
|
use warnings; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
485
|
|
3
|
|
|
|
|
|
|
package Time::C::Sentinel; |
4
|
|
|
|
|
|
|
$Time::C::Sentinel::VERSION = '0.024'; |
5
|
10
|
|
|
10
|
|
59
|
use Carp qw/ croak /; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
487
|
|
6
|
10
|
|
|
10
|
|
56
|
use Exporter qw/ import /; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
3523
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw/ sentinel /; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub sentinel :lvalue { |
11
|
24697
|
|
|
24697
|
0
|
53874
|
my %args = @_; |
12
|
|
|
|
|
|
|
|
13
|
24697
|
|
|
|
|
37953
|
my $value = $args{value}; |
14
|
24697
|
|
|
|
|
33277
|
my $set = $args{set}; |
15
|
|
|
|
|
|
|
|
16
|
24697
|
50
|
|
|
|
49378
|
croak "sentinel: no setter given" unless defined $set; |
17
|
|
|
|
|
|
|
|
18
|
24697
|
|
|
|
|
50134
|
tie my $ret, __PACKAGE__, $value, $set; |
19
|
|
|
|
|
|
|
|
20
|
24697
|
|
|
|
|
65170
|
return $ret; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub TIESCALAR { |
24
|
24697
|
|
|
24697
|
|
42312
|
my ($c, $val, $set) = @_; |
25
|
|
|
|
|
|
|
|
26
|
24697
|
|
|
|
|
64739
|
bless { value => $val, set => $set }, $c; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub STORE { |
30
|
4049
|
|
|
4049
|
|
7320
|
my ($o, $new) = @_; |
31
|
|
|
|
|
|
|
|
32
|
4049
|
|
|
|
|
9479
|
$o->{value} = $o->{set}->($new); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
28187
|
|
|
28187
|
|
84594
|
sub FETCH { shift->{value}; } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |