line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Getopt::EX::Util; |
2
|
10
|
|
|
10
|
|
69
|
use version; our $VERSION = version->declare("2.1.4"); |
|
10
|
|
|
|
|
28
|
|
|
10
|
|
|
|
|
84
|
|
3
|
|
|
|
|
|
|
|
4
|
10
|
|
|
10
|
|
880
|
use v5.14; |
|
10
|
|
|
|
|
34
|
|
5
|
10
|
|
|
10
|
|
156
|
use warnings; |
|
10
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
323
|
|
6
|
|
|
|
|
|
|
|
7
|
10
|
|
|
10
|
|
76
|
use Exporter 'import'; |
|
10
|
|
|
|
|
18
|
|
|
10
|
|
|
|
|
3094
|
|
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; |