line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package # |
2
|
|
|
|
|
|
|
ToggleValue { |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
37
|
use v5.14; |
|
3
|
|
|
|
|
11
|
|
5
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
571
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
53
|
|
|
53
|
|
88
|
my $class = shift; |
9
|
53
|
|
|
|
|
118
|
my $obj = bless {}, $class; |
10
|
53
|
|
|
|
|
130
|
my %opt = @_; |
11
|
53
|
|
50
|
|
|
166
|
$obj->{VALUE} = $opt{value} // 1; |
12
|
53
|
|
50
|
|
|
237
|
$obj->{CURRENT} = $obj->{INIT} = $opt{init} // 0; |
13
|
53
|
|
|
|
|
145
|
$obj; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub toggle { |
17
|
17
|
|
|
17
|
|
25
|
my $obj = shift; |
18
|
17
|
|
|
|
|
29
|
my $prev = $obj->{CURRENT}; |
19
|
17
|
|
|
|
|
32
|
$obj->{CURRENT} ^= $obj->{VALUE}; |
20
|
17
|
|
|
|
|
34
|
$prev; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub value { |
24
|
59
|
|
|
59
|
|
111
|
my $obj = shift; |
25
|
59
|
|
|
|
|
211
|
$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; |