line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package # |
2
|
|
|
|
|
|
|
ToggleValue { |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
38
|
use v5.14; |
|
3
|
|
|
|
|
14
|
|
5
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
563
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
59
|
|
|
59
|
|
96
|
my $class = shift; |
9
|
59
|
|
|
|
|
128
|
my $obj = bless {}, $class; |
10
|
59
|
|
|
|
|
162
|
my %opt = @_; |
11
|
59
|
|
50
|
|
|
184
|
$obj->{VALUE} = $opt{value} // 1; |
12
|
59
|
|
50
|
|
|
247
|
$obj->{CURRENT} = $obj->{INIT} = $opt{init} // 0; |
13
|
59
|
|
|
|
|
162
|
$obj; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub toggle { |
17
|
17
|
|
|
17
|
|
31
|
my $obj = shift; |
18
|
17
|
|
|
|
|
56
|
my $prev = $obj->{CURRENT}; |
19
|
17
|
|
|
|
|
50
|
$obj->{CURRENT} ^= $obj->{VALUE}; |
20
|
17
|
|
|
|
|
38
|
$prev; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub value { |
24
|
59
|
|
|
59
|
|
105
|
my $obj = shift; |
25
|
59
|
|
|
|
|
208
|
$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; |