line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package # |
2
|
|
|
|
|
|
|
ToggleValue { |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
36
|
use v5.14; |
|
3
|
|
|
|
|
11
|
|
5
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
606
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
53
|
|
|
53
|
|
96
|
my $class = shift; |
9
|
53
|
|
|
|
|
119
|
my $obj = bless {}, $class; |
10
|
53
|
|
|
|
|
125
|
my %opt = @_; |
11
|
53
|
|
50
|
|
|
170
|
$obj->{VALUE} = $opt{value} // 1; |
12
|
53
|
|
50
|
|
|
226
|
$obj->{CURRENT} = $obj->{INIT} = $opt{init} // 0; |
13
|
53
|
|
|
|
|
135
|
$obj; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub toggle { |
17
|
17
|
|
|
17
|
|
28
|
my $obj = shift; |
18
|
17
|
|
|
|
|
30
|
my $prev = $obj->{CURRENT}; |
19
|
17
|
|
|
|
|
29
|
$obj->{CURRENT} ^= $obj->{VALUE}; |
20
|
17
|
|
|
|
|
33
|
$prev; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub value { |
24
|
59
|
|
|
59
|
|
98
|
my $obj = shift; |
25
|
59
|
|
|
|
|
195
|
$obj->{CURRENT}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub reset { |
29
|
0
|
|
|
0
|
|
|
my $obj = shift; |
30
|
0
|
|
|
|
|
|
$obj->{CURRENT} = $obj->{INIT}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |