line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Getopt::EX::Util; |
2
|
10
|
|
|
10
|
|
76
|
use version; our $VERSION = version->declare("2.1.2"); |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
77
|
|
3
|
|
|
|
|
|
|
|
4
|
10
|
|
|
10
|
|
964
|
use v5.14; |
|
10
|
|
|
|
|
36
|
|
5
|
10
|
|
|
10
|
|
199
|
use warnings; |
|
10
|
|
|
|
|
28
|
|
|
10
|
|
|
|
|
339
|
|
6
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
78
|
use Exporter 'import'; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
3154
|
|
8
|
|
|
|
|
|
|
our @EXPORT = qw(); |
9
|
|
|
|
|
|
|
our %EXPORT_TAGS = (); |
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw(); |
11
|
|
|
|
|
|
|
our @ISA = qw(); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Getopt::EX::ToggleValue { |
14
|
|
|
|
|
|
|
sub new { |
15
|
0
|
|
|
0
|
|
|
my $class = shift; |
16
|
0
|
|
|
|
|
|
my $obj = bless {}, $class; |
17
|
0
|
|
|
|
|
|
my %opt = @_; |
18
|
0
|
|
0
|
|
|
|
$obj->{VALUE} = $opt{value} // 1; |
19
|
0
|
|
0
|
|
|
|
$obj->{CURRENT} = $obj->{INIT} = $opt{init} // 0; |
20
|
0
|
|
|
|
|
|
$obj; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
sub toggle { |
23
|
0
|
|
|
0
|
|
|
my $obj = shift; |
24
|
0
|
|
|
|
|
|
my $prev = $obj->{CURRENT}; |
25
|
0
|
|
|
|
|
|
$obj->{CURRENT} ^= $obj->{VALUE}; |
26
|
0
|
|
|
|
|
|
$prev; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
sub value { |
29
|
0
|
|
|
0
|
|
|
my $obj = shift; |
30
|
0
|
|
|
|
|
|
$obj->{CURRENT}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
sub reset { |
33
|
0
|
|
|
0
|
|
|
my $obj = shift; |
34
|
0
|
|
|
|
|
|
$obj->{CURRENT} = $obj->{INIT}; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |