OptArgs.pm

filter: Statementstmt 93.7% 358 / 382 Branchbran 75.0% 165 / 220 Conditioncond 62.8% 61 / 97 MC/DCmcdc 44.0% 26 / 59 Subroutinesub 95.2% 20 / 21 Podpod 100% 7 / 7 totaltotal 81.0% 637 / 786 CC 154 SCAR 42.5
CC
154
Cov
84%
_usage
149.5
_optargs
59.1
arg
15.0
CRAP 70.0
« Getopt/Args.pm ↑ Summary App/optargs.pm »
1 package OptArgs;
2 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use Carp qw/croak carp/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use Encode qw/decode/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 use Exporter::Tidy
7 11 ▶ default => [qw/opt arg optargs usage subcmd/],
Subroutine BEGIN: called CC=1 SCAR=0.0
8 11 other => [qw/dispatch class_optargs/];
9 11 ▶use Getopt::Long qw/GetOptionsFromArray/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 11 ▶use List::Util qw/max/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 11 our $VERSION = '0.1.21';
13 11 our $COLOUR = 0;
14 11 our $ABBREV = 0;
15 11 our $SORT = 0;
16 11 our $PRINT_DEFAULT = 0;
17 11 our $PRINT_ISA = 0;
18  
19 11 my %seen; # hash of hashes keyed by 'caller', then opt/arg name
20 my %opts; # option configuration keyed by 'caller'
21 11 my %args; # argument configuration keyed by 'caller'
22 11 my %caller; # current 'caller' keyed by real caller
23 11 my %desc; # sub-command descriptions
24 11 my %dispatching; # track optargs() calls from dispatch classes
25 11 my %hidden; # subcmd hiding by default
26  
27 # internal function for App::optargs
28 4 ▶sub _cmdlist {
Subroutine _cmdlist: called CC=1 SCAR=0.0
29 4 return sort grep { $_ ne 'App::optargs' } keys %seen;
30 }
31  
32 # ------------------------------------------------------------------------
33 # Sub-command definition
34 #
35 # This works by faking caller context in opt() and arg()
36 # ------------------------------------------------------------------------
37 11 my %subcmd_params = (
38 cmd => undef,
39 comment => undef,
40 hidden => undef,
41  
42 # alias => '',
43 # ishelp => undef,
44 );
45  
46 11 my @subcmd_required = (qw/cmd comment/);
47  
48 18 ▶sub subcmd {
Subroutine subcmd: called CC=7 SCAR=19.5
Pod documented
49 18 my $params = {@_};
50 18 my $caller = caller;
51  
52 18 ▶ if ( my @missing = grep { !exists $params->{$_} } @subcmd_required ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@missing) = grep({not exists $params->{$_};} @subcmd_required)) 1 17 18
53 1 croak "missing required parameter(s): @missing";
54 }
55  
56 17 ▶ if ( my @invalid = grep { !exists $subcmd_params{$_} } keys %$params ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@invalid) = grep({not exists $subcmd_params{$_};} keys %$params)) 0 17 17
57 0 my @valid = keys %subcmd_params;
58 0 croak "invalid parameter(s): @invalid (valid: @valid)";
59 }
60  
61 # croak "'ishelp' can only be applied to Bool opts"
62 # if $params->{ishelp} and $params->{isa} ne 'Bool';
63  
64 my @cmd =
65 ref $params->{cmd} eq 'ARRAY'
66 10 ? @{ $params->{cmd} }
67 17 ▶ : ( $params->{cmd} );
Branch: 1 branch
BranchTrueFalseTotal
ref $params->{'cmd'} eq 'ARRAY' ? : 10 7 17
68 17 ▶ croak 'missing cmd elements' unless @cmd;
Branch: 1 branch
BranchTrueFalseTotal
unless @cmd 0 17 17
69  
70 17 my $name = pop @cmd;
71 17 my $parent = join( '::', $caller, @cmd );
72 17 $parent =~ s/-/_/g;
73  
74 17 ▶ croak "parent command not found: @cmd" unless $seen{$parent};
Branch: 1 branch
BranchTrueFalseTotal
unless $seen{$parent} 1 16 17
75  
76 16 my $package = $parent . '::' . $name;
77 16 $package =~ s/-/_/g;
78  
79 16 ▶ croak "sub command already defined: @cmd $name" if $seen{$package};
Branch: 1 branch
BranchTrueFalseTotal
if $seen{$package} 1 15 16
80  
81 15 $caller{$caller} = $package;
82 15 $desc{$package} = $params->{comment};
83 15 $seen{$package} = {};
84 15 $opts{$package} = [];
85 15 $args{$package} = [];
86 15 $hidden{$package} = $params->{hidden};
87  
88 15 my $parent_arg = ( grep { $_->{isa} eq 'SubCmd' } @{ $args{$parent} } )[0];
89 15 push( @{ $parent_arg->{subcommands} }, $name );
90  
91 15 return;
92 }
93  
94 # ------------------------------------------------------------------------
95 # Option definition
96 # ------------------------------------------------------------------------
97 11 my %opt_params = (
98 isa => undef,
99 isa_name => undef,
100 comment => undef,
101 default => undef,
102 alias => '',
103 ishelp => undef,
104 hidden => undef,
105 );
106  
107 11 my @opt_required = (qw/isa comment/);
108  
109 11 my %opt_isa = (
110 'Bool' => '!',
111 'Counter' => '+',
112 'Str' => '=s',
113 'Int' => '=i',
114 'Num' => '=f',
115 'ArrayRef' => '=s@',
116 'HashRef' => '=s%',
117 );
118  
119 43 ▶sub opt {
Subroutine opt: called CC=12 SCAR=24.8
Pod documented
120 43 my $name = shift;
121 43 my $params = {@_};
122 43 my $caller = caller;
123 43 ▶ my $package = $caller{$caller} || $caller;
Condition66%2/3
$caller{$caller} || $caller
l!l&&r!l&&!r
10330
MC/DC0%0/2
$caller{$caller} || $caller
$caller{$caller} $caller
Truth table66%2/3
A || B
A= $caller{$caller}B= $caller
ABresult
1X1
011
000
124  
125 43 ▶ croak 'usage: opt $name => (%parameters)' unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 4 39 43
126 39 ▶ croak "'$name' already defined" if $seen{$package}->{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $seen{$package}{$name} 2 37 39
127  
128 37 ▶ if ( my @missing = grep { !exists $params->{$_} } @opt_required ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@missing) = grep({not exists $params->{$_};} @opt_required)) 2 35 37
129 2 croak "missing required parameter(s): @missing";
130 }
131  
132 35 ▶ if ( my @invalid = grep { !exists $opt_params{$_} } keys %$params ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@invalid) = grep({not exists $opt_params{$_};} keys %$params)) 1 34 35
133 1 my @valid = keys %opt_params;
134 1 croak "invalid parameter(s): @invalid (valid: @valid)";
135 }
136  
137 croak "'ishelp' can only be applied to Bool opts"
138 34 ▶ if $params->{ishelp} and $params->{isa} ne 'Bool';
Branch: 1 branch
BranchTrueFalseTotal
if $params->{"ishelp"} and $params->{"isa"} ne "Bool" 1 33 34
Condition100%3/3
$params->{"ishelp"} and $params->{"isa"} ne "Bool"
!ll&&!rl&&r
3121
MC/DC100%2/2
$params->{"ishelp"} and $params->{"isa"} ne "Bool"
$params->{"ishelp"} $params->{"isa"} ne "Bool"
Truth table100%3/3
A and B
A= $params->{"ishelp"}B= $params->{"isa"} ne "Bool"
ABresult
0X0
100
111
139  
140 croak "unknown type: $params->{isa}"
141 33 ▶ unless exists $opt_isa{ $params->{isa} };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $opt_isa{$params->{"isa"}} 1 32 33
142  
143 32 $params = { %opt_params, %$params };
144 32 $params->{package} = $package;
145 32 $params->{name} = $name;
146 32 $params->{length} = length $name;
147 32 $params->{acount} = do { my @tmp = split( '|', $params->{alias} ) };
148 32 $params->{type} = 'opt';
149 32 $params->{ISA} = $params->{name};
150  
151 32 ▶ if ( ( my $dashed = $params->{name} ) =~ s/_/-/g ) {
Branch: 1 branch
BranchTrueFalseTotal
if ((my $dashed = $params->{"name"}) =~ s/_/-/g) 3 29 32
152 3 $params->{dashed} = $dashed;
153 3 $params->{ISA} .= '|' . $dashed;
154 }
155  
156 32 ▶ $params->{ISA} .= '|' . $params->{alias} if $params->{alias};
Branch: 1 branch
BranchTrueFalseTotal
if $params->{"alias"} 12 20 32
157 32 $params->{ISA} .= $opt_isa{ $params->{isa} };
158  
159 32 push( @{ $opts{$package} }, $params );
160 32 ▶ $args{$package} ||= [];
Condition100%2/2
$args{$package} ||= []
l!l
266
MC/DC100%1/1
$args{$package} ||= []
$args{$package}
Truth table100%2/2
A
A= $args{$package}
Aresult
11
00
161 32 $seen{$package}->{$name}++;
162  
163 32 return;
164 }
165  
166 # ------------------------------------------------------------------------
167 # Argument definition
168 # ------------------------------------------------------------------------
169 11 my %arg_params = (
170 isa => undef,
171 comment => undef,
172 required => undef,
173 default => undef,
174 greedy => undef,
175 fallback => undef,
176 );
177  
178 11 my @arg_required = (qw/isa comment/);
179  
180 11 my %arg_isa = (
181 'Str' => '=s',
182 'Int' => '=i',
183 'Num' => '=f',
184 'ArrayRef' => '=s@',
185 'HashRef' => '=s%',
186 'SubCmd' => '=s',
187 );
188  
189 32 ▶sub arg {
Subroutine arg: called CC=15 SCAR=27.1
Pod documented
190 32 my $name = shift;
191 32 my $params = {@_};
192 32 my $caller = caller;
193 32 ▶ my $package = $caller{$caller} || $caller;
Condition66%2/3
$caller{$caller} || $caller
l!l&&r!l&&!r
4280
MC/DC0%0/2
$caller{$caller} || $caller
$caller{$caller} $caller
Truth table66%2/3
A || B
A= $caller{$caller}B= $caller
ABresult
1X1
011
000
194  
195 32 ▶ croak 'usage: arg $name => (%parameters)' unless $name;
Branch: 1 branch
BranchTrueFalseTotal
unless $name 4 28 32
196 28 ▶ croak "'$name' already defined" if $seen{$package}->{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $seen{$package}{$name} 2 26 28
197  
198 26 ▶ if ( my @missing = grep { !exists $params->{$_} } @arg_required ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@missing) = grep({not exists $params->{$_};} @arg_required)) 2 24 26
199 2 croak "missing required parameter(s): @missing";
200 }
201  
202 24 ▶ if ( my @invalid = grep { !exists $arg_params{$_} } keys %$params ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@invalid) = grep({not exists $arg_params{$_};} keys %$params)) 1 23 24
203 1 my @valid = keys %arg_params;
204 1 croak "invalid parameter(s): @invalid (valid: @valid)";
205 }
206  
207 croak "unknown type: $params->{isa}"
208 23 ▶ unless exists $arg_isa{ $params->{isa} };
Branch: 1 branch
BranchTrueFalseTotal
unless exists $arg_isa{$params->{"isa"}} 1 22 23
209  
210 croak "'default' and 'required' cannot be used together"
211 22 ▶ if defined $params->{default} and defined $params->{required};
Branch: 1 branch
BranchTrueFalseTotal
if defined $params->{"default"} and defined $params->{"required"} 1 21 22
Condition100%3/3
defined $params->{"default"} and defined $params->{"required"}
!ll&&!rl&&r
1921
MC/DC100%2/2
defined $params->{"default"} and defined $params->{"required"}
defined $params->{"default"} defined $params->{"required"}
Truth table100%3/3
A and B
A= defined $params->{"default"}B= defined $params->{"required"}
ABresult
0X0
100
111
212  
213 croak "'fallback' only valid with isa 'SubCmd'"
214 21 ▶ if $params->{fallback} and $params->{isa} ne 'SubCmd';
Branch: 1 branch
BranchTrueFalseTotal
if $params->{"fallback"} and $params->{"isa"} ne "SubCmd" 1 20 21
Condition100%3/3
$params->{"fallback"} and $params->{"isa"} ne "SubCmd"
!ll&&!rl&&r
1821
MC/DC100%2/2
$params->{"fallback"} and $params->{"isa"} ne "SubCmd"
$params->{"fallback"} $params->{"isa"} ne "SubCmd"
Truth table100%3/3
A and B
A= $params->{"fallback"}B= $params->{"isa"} ne "SubCmd"
ABresult
0X0
100
111
215  
216 croak "fallback must be a hashref"
217 20 ▶ if defined $params->{fallback} && ref $params->{fallback} ne 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if defined $params->{"fallback"} and ref $params->{"fallback"} ne "HASH" 1 19 20
Condition100%3/3
defined $params->{"fallback"} and ref $params->{"fallback"} ne "HASH"
!ll&&!rl&&r
1811
MC/DC100%2/2
defined $params->{"fallback"} and ref $params->{"fallback"} ne "HASH"
defined $params->{"fallback"} ref $params->{"fallback"} ne "HASH"
Truth table100%3/3
A and B
A= defined $params->{"fallback"}B= ref $params->{"fallback"} ne "HASH"
ABresult
0X0
100
111
218  
219 19 $params->{package} = $package;
220 19 $params->{name} = $name;
221 19 $params->{length} = length $name;
222 19 $params->{acount} = 0;
223 19 $params->{type} = 'arg';
224 19 $params->{ISA} = $params->{name} . $arg_isa{ $params->{isa} };
225  
226 19 push( @{ $args{$package} }, $params );
227 19 ▶ $opts{$package} ||= [];
Condition100%2/2
$opts{$package} ||= []
l!l
145
MC/DC100%1/1
$opts{$package} ||= []
$opts{$package}
Truth table100%2/2
A
A= $opts{$package}
Aresult
11
00
228 19 $seen{$package}->{$name}++;
229  
230 19 ▶ if ( $params->{fallback} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params->{"fallback"}) 1 18 19
231 1 my $p = $package . '::' . uc $params->{fallback}->{name};
232 1 $p =~ s/-/_/g;
233 1 $opts{$p} = [];
234 1 $args{$p} = [];
235 1 $desc{$p} = $params->{fallback}->{comment};
236 }
237  
238 19 return;
239 }
240  
241 # ------------------------------------------------------------------------
242 # Usage message generation
243 # ------------------------------------------------------------------------
244  
245 7 ▶sub _usage {
Subroutine _usage: called CC=59 SCAR=50.1
246 7 my $caller = shift;
247 7 my $error = shift;
248 7 my $ishelp = shift;
249 7 my $terminal = -t STDOUT;
250 7 ▶ my $red = ( $COLOUR && $terminal ) ? "\e[0;31m" : '';
Branch: 1 branch
BranchTrueFalseTotal
$OptArgs::COLOUR && $terminal ? : 0 7 7
Condition66%2/3
$OptArgs::COLOUR and $terminal
!ll&&!rl&&r
250
MC/DC0%0/2
$OptArgs::COLOUR and $terminal
$OptArgs::COLOUR $terminal
Truth table66%2/3
A and B
A= $OptArgs::COLOURB= $terminal
ABresult
0X0
100
111
251 7 my $yellow = ''; #( $COLOUR && $terminal ) ? "\e[0;33m" : '';
252 7 my $grey = ''; #( $COLOUR && $terminal ) ? "\e[1;30m" : '';
253 7 ▶ my $reset = ( $COLOUR && $terminal ) ? "\e[0m" : '';
Branch: 1 branch
BranchTrueFalseTotal
$OptArgs::COLOUR && $terminal ? : 0 7 7
Condition66%2/3
$OptArgs::COLOUR and $terminal
!ll&&!rl&&r
250
MC/DC0%0/2
$OptArgs::COLOUR and $terminal
$OptArgs::COLOUR $terminal
Truth table66%2/3
A and B
A= $OptArgs::COLOURB= $terminal
ABresult
0X0
100
111
254 7 my $parent = $caller;
255 7 my @args = @{ $args{$caller} };
256 7 my @opts = @{ $opts{$caller} };
257 7 my @parents;
258 my @usage;
259 7 my @uargs;
260 7 my @uopts;
261 7 my $usage;
262  
263 7 require File::Basename;
264 7 ▶ my $me = File::Basename::basename( defined &static::list ? $^X : $0 );
Branch: 1 branch
BranchTrueFalseTotal
defined &static::list ? : 0 7 7
265  
266 7 ▶ if ($error) {
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 3 4 7
267 3 $usage .= "${red}error:$reset $error\n\n";
268 }
269  
270 7 ▶ $usage .= $yellow . ( $ishelp ? 'help:' : 'usage:' ) . $reset . ' ' . $me;
Branch: 1 branch
BranchTrueFalseTotal
$ishelp ? : 2 5 7
271  
272 7 ▶ while ( $parent =~ s/(.*)::(.*)/$1/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent =~ s/(.*)::(.*)/$1/) 8 2 10
273 8 ▶ last unless $seen{$parent};
Branch: 1 branch
BranchTrueFalseTotal
unless $seen{$parent} 5 3 8
274 3 ( my $name = $2 ) =~ s/_/-/g;
275 3 unshift( @parents, $name );
276 3 unshift( @opts, @{ $opts{$parent} } );
277 }
278  
279 7 ▶ $usage .= ' ' . join( ' ', @parents ) if @parents;
Branch: 1 branch
BranchTrueFalseTotal
if @parents 3 4 7
280  
281 7 my $last = $args[$#args];
282  
283 7 ▶ if ($last) {
Branch: 1 branch
BranchTrueFalseTotal
if ($last) 6 1 7
284 6 foreach my $def (@args) {
285 6 $usage .= ' ';
286 6 ▶ $usage .= '[' unless $def->{required};
Branch: 1 branch
BranchTrueFalseTotal
unless $def->{"required"} 0 6 6
287 6 $usage .= uc $def->{name};
288 6 ▶ $usage .= '...' if $def->{greedy};
Branch: 1 branch
BranchTrueFalseTotal
if $def->{"greedy"} 0 6 6
289 6 ▶ $usage .= ']' unless $def->{required};
Branch: 1 branch
BranchTrueFalseTotal
unless $def->{"required"} 0 6 6
290 6 push( @uargs, [ uc $def->{name}, $def->{comment} ] );
291 }
292 }
293  
294 7 ▶ $usage .= ' [OPTIONS...]' if @opts;
Branch: 1 branch
BranchTrueFalseTotal
if @opts 7 0 7
295  
296 7 $usage .= "\n";
297  
298 $usage .= "\n ${grey}Synopsis:$reset\n $desc{$caller}\n"
299 7 ▶ if $ishelp and $desc{$caller};
Branch: 1 branch
BranchTrueFalseTotal
if $ishelp and $desc{$caller} 2 5 7
Condition66%2/3
$ishelp and $desc{$caller}
!ll&&!rl&&r
502
MC/DC50%1/2
$ishelp and $desc{$caller}
$ishelp $desc{$caller}
Truth table66%2/3
A and B
A= $ishelpB= $desc{$caller}
ABresult
0X0
100
111
300  
301 7 ▶ if ( $ishelp and my $version = $caller->VERSION ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ishelp and my $version = $caller->VERSION) 0 7 7
Condition66%2/3
$ishelp and my $version = $caller->VERSION
!ll&&!rl&&r
520
MC/DC0%0/2
$ishelp and my $version = $caller->VERSION
$ishelp my $version = $caller->VERSION
Truth table66%2/3
A and B
A= $ishelpB= my $version = $caller->VERSION
ABresult
0X0
100
111
302 0 $usage .= "\n ${grey}Version:$reset\n $version\n";
303 }
304  
305 7 ▶ if ( $last && $last->{isa} eq 'SubCmd' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($last and $last->{"isa"} eq "SubCmd") 4 3 7
Condition100%3/3
$last and $last->{"isa"} eq "SubCmd"
!ll&&!rl&&r
124
MC/DC100%2/2
$last and $last->{"isa"} eq "SubCmd"
$last $last->{"isa"} eq "SubCmd"
Truth table100%3/3
A and B
A= $lastB= $last->{"isa"} eq "SubCmd"
ABresult
0X0
100
111
306 4 $usage .= "\n ${grey}" . ucfirst( $last->{name} ) . ":$reset\n";
307  
308 4 my @subcommands = @{ $last->{subcommands} };
309  
310 push( @subcommands, uc $last->{fallback}->{name} )
311 if (
312 exists $last->{fallback}
313 && ( $ishelp
314 or !$last->{fallback}->{hidden} )
315 4 ▶ );
Branch: 1 branch
BranchTrueFalseTotal
if exists $last->{"fallback"} and $ishelp || !$last->{"fallback"}{"hidden"} 0 4 4
Condition16%1/6
exists $last->{"fallback"} and $ishelp || !$last->{"fallback"}{"hidden"}
!ll&&!rl&&r
400
$ishelp or not $last->{"fallback"}{"hidden"}
l!l&&r!l&&!r
000
MC/DC0%0/3
exists $last->{"fallback"} and $ishelp || !$last->{"fallback"}{"hidden"}
exists $last->{"fallback"} $ishelp not $last->{"fallback"}{"hidden"}
Truth table25%1/4
A and B or not(C)
A= exists $last->{"fallback"}B= $ishelpC= not $last->{"fallback"}{"hidden"}
ABCresult
0XX0
1000
11X1
1011
316  
317 4 ▶ @subcommands = sort @subcommands if $SORT;
Branch: 1 branch
BranchTrueFalseTotal
if $OptArgs::SORT 1 3 4
318  
319 4 foreach my $subcommand (@subcommands) {
320 10 my $pkg = $last->{package} . '::' . $subcommand;
321 10 $pkg =~ s/-/_/g;
322 10 ▶ next if $hidden{$pkg} and !$ishelp;
Branch: 1 branch
BranchTrueFalseTotal
if $hidden{$pkg} and not $ishelp 0 10 10
Condition66%2/3
$hidden{$pkg} and not $ishelp
!ll&&!rl&&r
820
MC/DC0%0/2
$hidden{$pkg} and not $ishelp
$hidden{$pkg} not $ishelp
Truth table66%2/3
A and not(B)
A= $hidden{$pkg}B= not $ishelp
ABresult
0X0
100
111
323 10 push( @usage, [ $subcommand, $desc{$pkg} ] );
324 }
325  
326 }
327  
328 7 ▶ @opts = sort { $a->{name} cmp $b->{name} } @opts if $SORT;
Branch: 1 branch
BranchTrueFalseTotal
if $OptArgs::SORT 1 6 7
329  
330 7 foreach my $opt (@opts) {
331 18 ▶ next if $opt->{hidden} and !$ishelp;
Branch: 1 branch
BranchTrueFalseTotal
if $opt->{"hidden"} and not $ishelp 0 18 18
Condition33%1/3
$opt->{"hidden"} and not $ishelp
!ll&&!rl&&r
1800
MC/DC0%0/2
$opt->{"hidden"} and not $ishelp
$opt->{"hidden"} not $ishelp
Truth table33%1/3
A and not(B)
A= $opt->{"hidden"}B= not $ishelp
ABresult
0X0
100
111
332  
333 18 ( my $name = $opt->{name} ) =~ s/_/-/g;
334  
335 18 ▶ if ( $opt->{isa} eq 'Bool' and $opt->{default} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt->{"isa"} eq "Bool" and $opt->{"default"}) 0 18 18
Condition66%2/3
$opt->{"isa"} eq "Bool" and $opt->{"default"}
!ll&&!rl&&r
2160
MC/DC0%0/2
$opt->{"isa"} eq "Bool" and $opt->{"default"}
$opt->{"isa"} eq "Bool" $opt->{"default"}
Truth table66%2/3
A and B
A= $opt->{"isa"} eq "Bool"B= $opt->{"default"}
ABresult
0X0
100
111
336 0 $name = 'no-' . $name;
337 }
338  
339 18 my $default = '';
340 18 ▶ if ( $PRINT_DEFAULT && defined $opt->{default} and !$opt->{ishelp} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($OptArgs::PRINT_DEFAULT and defined $opt->{"default"} and not $opt->{"ishelp"}) 0 18 18
Condition33%2/6
$OptArgs::PRINT_DEFAULT and defined $opt->{"default"} and not $opt->{"ishelp"}
!ll&&!rl&&r
1800
$OptArgs::PRINT_DEFAULT and defined $opt->{"default"}
!ll&&!rl&&r
1800
MC/DC0%0/3
$OptArgs::PRINT_DEFAULT and defined $opt->{"default"} and not $opt->{"ishelp"}
$OptArgs::PRINT_DEFAULT defined $opt->{"default"} not $opt->{"ishelp"}
Truth table25%1/4
A and B and not(C)
A= $OptArgs::PRINT_DEFAULTB= defined $opt->{"default"}C= not $opt->{"ishelp"}
ABCresult
0XX0
10X0
1100
1111
341 my $value =
342 ref $opt->{default} eq 'CODE'
343 ? $opt->{default}->( {%$opt} )
344 0 ▶ : $opt->{default};
Branch: 1 branch
BranchTrueFalseTotal
ref $opt->{'default'} eq 'CODE' ? : 0 0 0
345 0 ▶ if ( $opt->{isa} eq 'Bool' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($opt->{"isa"} eq "Bool") 0 0 0
346 0 ▶ $value = $value ? 'true' : 'false';
Branch: 1 branch
BranchTrueFalseTotal
$value ? : 0 0 0
347 }
348 0 $default = " [default: $value]";
349 }
350  
351 18 ▶ if ($PRINT_ISA) {
Branch: 1 branch
BranchTrueFalseTotal
if ($OptArgs::PRINT_ISA) 0 18 18
352 0 ▶ if ( $opt->{isa_name} ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($opt->{'isa_name'}) { } 0 0 0
elsif ($opt->{'isa'} eq 'Str' or $opt->{'isa'} eq 'HashRef' or $opt->{'isa'} eq 'ArrayRef') { } 0 0 0
elsif ($opt->{'isa'} eq 'Int') { } 0 0 0
elsif ($opt->{'isa'} eq 'Num') { } 0 0 0
353 0 $name .= '=' . uc $opt->{isa_name};
354 }
355 ▶ elsif ($opt->{isa} eq 'Str'
Condition0%0/6
$opt->{"isa"} eq "Str" or $opt->{"isa"} eq "HashRef" or $opt->{"isa"} eq "ArrayRef"
l!l&&r!l&&!r
000
$opt->{"isa"} eq "Str" or $opt->{"isa"} eq "HashRef"
l!l&&r!l&&!r
000
MC/DC0%0/3
$opt->{"isa"} eq "Str" or $opt->{"isa"} eq "HashRef" or $opt->{"isa"} eq "ArrayRef"
$opt->{"isa"} eq "Str" $opt->{"isa"} eq "HashRef" $opt->{"isa"} eq "ArrayRef"
Truth table0%0/4
A or B or C
A= $opt->{"isa"} eq "Str"B= $opt->{"isa"} eq "HashRef"C= $opt->{"isa"} eq "ArrayRef"
ABCresult
1XX1
01X1
0011
0000
356 || $opt->{isa} eq 'HashRef'
357 || $opt->{isa} eq 'ArrayRef' )
358 {
359 0 $name .= '=STR';
360 }
361 elsif ( $opt->{isa} eq 'Int' ) {
362 0 $name .= '=INT';
363 }
364 elsif ( $opt->{isa} eq 'Num' ) {
365 0 $name .= '=NUM';
366 }
367 }
368  
369 18 ▶ $name .= ',' if $opt->{alias};
Branch: 1 branch
BranchTrueFalseTotal
if $opt->{"alias"} 15 3 18
370 push(
371 @uopts,
372 [
373 '--' . $name,
374 $opt->{alias}
375 ? '-' . $opt->{alias}
376 : '',
377 18 ▶ $opt->{comment} . $default
Branch: 1 branch
BranchTrueFalseTotal
$opt->{'alias'} ? : 15 3 18
378 ]
379 );
380 }
381  
382 7 ▶ if (@uopts) {
Branch: 1 branch
BranchTrueFalseTotal
if (@uopts) 7 0 7
383 7 my $w1 = max( map { length $_->[0] } @uopts );
384 7 my $fmt = '%-' . $w1 . "s %s";
385  
386 7 @uopts = map { [ sprintf( $fmt, $_->[0], $_->[1] ), $_->[2] ] } @uopts;
387 }
388  
389 7 my $w1 = max( map { length $_->[0] } @usage, @uargs, @uopts );
390 7 my $format = ' %-' . $w1 . "s %s\n";
391  
392 7 ▶ if (@usage) {
Branch: 1 branch
BranchTrueFalseTotal
if (@usage) 4 3 7
393 4 foreach my $row (@usage) {
394 10 $usage .= sprintf( $format, @$row );
395 }
396 }
397 7 ▶ if ( @uargs and $last->{isa} ne 'SubCmd' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@uargs and $last->{"isa"} ne "SubCmd") 2 5 7
Condition100%3/3
@uargs and $last->{"isa"} ne "SubCmd"
!ll&&!rl&&r
142
MC/DC100%2/2
@uargs and $last->{"isa"} ne "SubCmd"
@uargs $last->{"isa"} ne "SubCmd"
Truth table100%3/3
A and B
A= @uargsB= $last->{"isa"} ne "SubCmd"
ABresult
0X0
100
111
398 2 $usage .= "\n ${grey}Arguments:$reset\n";
399 2 foreach my $row (@uargs) {
400 2 $usage .= sprintf( $format, @$row );
401 }
402 }
403 7 ▶ if (@uopts) {
Branch: 1 branch
BranchTrueFalseTotal
if (@uopts) 7 0 7
404 7 $usage .= "\n ${grey}Options:$reset\n";
405 7 foreach my $row (@uopts) {
406 18 $usage .= sprintf( $format, @$row );
407 }
408 }
409  
410 7 $usage .= "\n";
411 7 return bless( \$usage, 'OptArgs::Usage' );
412 }
413  
414 32 ▶sub _synopsis {
Subroutine _synopsis: called CC=9 SCAR=22.1
415 32 my $caller = shift;
416 32 my $parent = $caller;
417 32 my @args = @{ $args{$caller} };
418 32 my @parents;
419  
420 32 require File::Basename;
421 32 my $usage = File::Basename::basename($0);
422  
423 32 ▶ while ( $parent =~ s/(.*)::(.*)/$1/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parent =~ s/(.*)::(.*)/$1/) 88 0 88
424 88 ▶ last unless $seen{$parent};
Branch: 1 branch
BranchTrueFalseTotal
unless $seen{$parent} 32 56 88
425 56 ( my $name = $2 ) =~ s/_/-/g;
426 56 unshift( @parents, $name );
427 }
428  
429 32 ▶ $usage .= ' ' . join( ' ', @parents ) if @parents;
Branch: 1 branch
BranchTrueFalseTotal
if @parents 28 4 32
430  
431 32 ▶ if ( my $last = $args[$#args] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $last = $args[$#args]) 12 20 32
432 12 foreach my $def (@args) {
433 12 $usage .= ' ';
434 12 ▶ $usage .= '[' unless $def->{required};
Branch: 1 branch
BranchTrueFalseTotal
unless $def->{"required"} 0 12 12
435 12 $usage .= uc $def->{name};
436 12 ▶ $usage .= '...' if $def->{greedy};
Branch: 1 branch
BranchTrueFalseTotal
if $def->{"greedy"} 0 12 12
437 12 ▶ $usage .= ']' unless $def->{required};
Branch: 1 branch
BranchTrueFalseTotal
unless $def->{"required"} 0 12 12
438 }
439 }
440  
441 32 return 'usage: ' . $usage . "\n";
442 }
443  
444 0 ▶sub usage {
Subroutine usage: not called CC=1 SCAR=6.9
Pod documented
445 0 my $caller = caller;
446 0 return _usage( $caller, @_ );
447 }
448  
449 # ------------------------------------------------------------------------
450 # Option/Argument processing
451 # ------------------------------------------------------------------------
452 50 ▶sub _optargs {
Subroutine _optargs: called CC=47 SCAR=40.8
453 50 my $caller = shift;
454 50 my $source = \@_;
455 50 my $source_hash = {};
456 50 my $package = $caller;
457  
458 50 ▶ if ( !@_ and @ARGV ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not @_ and @ARGV) { } 27 23 50
Condition100%3/3
not @_ and @ARGV
!ll&&!rl&&r
14927
MC/DC100%2/2
not @_ and @ARGV
not @_ @ARGV
Truth table100%3/3
not(A) and B
A= not @_B= @ARGV
ABresult
0X0
100
111
459 my $CODESET =
460 27 eval { require I18N::Langinfo; I18N::Langinfo::CODESET() };
461  
462 27 ▶ if ($CODESET) {
Branch: 1 branch
BranchTrueFalseTotal
if ($CODESET) 27 0 27
463 27 my $codeset = I18N::Langinfo::langinfo($CODESET);
464 27 $_ = decode( $codeset, $_ ) for @ARGV;
465 }
466  
467 27 $source = \@ARGV;
468 }
469 else {
470 0 $source_hash = { map { %$_ } grep { ref $_ eq 'HASH' } @$source };
471 23 $source = [ grep { ref $_ ne 'HASH' } @$source ];
472 }
473  
474 50 ▶ map { Carp::croak('_optargs argument undefined!') if !defined $_ } @$source;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $_ 0 84 84
475  
476 croak "no option or argument defined for $caller"
477 unless exists $opts{$package}
478 50 ▶ or exists $args{$package};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $opts{$package} or exists $args{$package} 1 49 50
Condition66%2/3
exists $opts{$package} or exists $args{$package}
l!l&&r!l&&!r
4901
MC/DC50%1/2
exists $opts{$package} or exists $args{$package}
exists $opts{$package} exists $args{$package}
Truth table66%2/3
A or B
A= exists $opts{$package}B= exists $args{$package}
ABresult
1X1
011
000
479  
480 49 Getopt::Long::Configure(qw/pass_through no_auto_abbrev no_ignore_case/);
481  
482 49 my @config = ( @{ $opts{$package} }, @{ $args{$package} } );
483  
484 49 my $ishelp;
485 my $missing_required;
486 49 my $optargs = {};
487 49 my @coderef_default_keys;
488  
489 49 ▶ while ( my $try = shift @config ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $try = shift @config) 210 48 258
490 210 my $result;
491  
492 210 ▶ if ( $try->{type} eq 'opt' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($try->{'type'} eq 'opt') { } 155 55 210
elsif ($try->{'type'} eq 'arg') { } 55 0 55
493 155 ▶ if ( exists $source_hash->{ $try->{name} } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $$source_hash{$try->{'name'}}) { } 0 155 155
494 0 $result = delete $source_hash->{ $try->{name} };
495 }
496 else {
497 155 GetOptionsFromArray( $source, $try->{ISA} => \$result );
498 }
499 }
500 elsif ( $try->{type} eq 'arg' ) {
501 55 ▶ if (@$source) {
Branch: 3 branches
BranchTrueFalseTotal
if (@$source) { } 34 21 55
elsif (exists $$source_hash{$try->{'name'}}) { } 0 21 21
elsif ($try->{'required'} and not $ishelp) { } 2 36 38
502 34 ▶ die _usage( $package, qq{Unknown option "$source->[0]"} )
Branch: 1 branch
BranchTrueFalseTotal
if $source->[0] =~ /^--\S/ 0 34 34
503 if $source->[0] =~ m/^--\S/;
504  
505 die _usage( $package, qq{Unknown option "$source->[0]"} )
506 if $source->[0] =~ m/^-\S/
507 and !(
508 $source->[0] =~ m/^-\d/ and ( $try->{isa} ne 'Num'
509 34 ▶ or $try->{isa} ne 'Int' )
Branch: 1 branch
BranchTrueFalseTotal
if $source->[0] =~ /^-\S/ and not $source->[0] =~ /^-\d/ && ($try->{"isa"} ne "Num" || $try->{"isa"} ne "Int") 0 34 34
Condition11%1/9
$source->[0] =~ /^-\S/ and not $source->[0] =~ /^-\d/ && ($try->{"isa"} ne "Num" || $try->{"isa"} ne "Int")
!ll&&!rl&&r
3400
$source->[0] =~ /^-\d/ && ($try->{'isa'} ne 'Num' || $try->{'isa'} ne 'Int')
!ll&&!rl&&r
000
$try->{"isa"} ne "Num" or $try->{"isa"} ne "Int"
l!l&&r!l&&!r
000
MC/DC0%0/4
$source->[0] =~ /^-\S/ and not $source->[0] =~ /^-\d/ && ($try->{"isa"} ne "Num" || $try->{"isa"} ne "Int")
$source->[0] =~ /^-\S/ $source->[0] =~ /^-\d/ $try->{"isa"} ne "Num" $try->{"isa"} ne "Int"
Truth table20%1/5
A and not(B && C or D)
A= $source->[0] =~ /^-\S/B= $source->[0] =~ /^-\d/C= $try->{"isa"} ne "Num"D= $try->{"isa"} ne "Int"
ABCDresult
0XXX0
111X0
11010
10XX1
11001
510 );
511  
512 34 ▶ if ( $try->{greedy} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($try->{'greedy'}) { } 2 32 34
513 2 my @later;
514 2 ▶ if ( @config and @$source > @config ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@config and @$source > @config) 0 2 2
Condition33%1/3
@config and @$source > @config
!ll&&!rl&&r
200
MC/DC0%0/2
@config and @$source > @config
@config @$source > @config
Truth table33%1/3
A and B
A= @configB= @$source > @config
ABresult
0X0
100
111
515 0 push( @later, pop @$source ) for @config;
516 }
517  
518 2 ▶ if ( $try->{isa} eq 'ArrayRef' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($try->{'isa'} eq 'ArrayRef') { } 0 2 2
elsif ($try->{'isa'} eq 'HashRef') { } 0 2 2
519 0 $result = [@$source];
520 }
521 elsif ( $try->{isa} eq 'HashRef' ) {
522 0 $result = { map { split /=/, $_ } @$source };
523 }
524 else {
525 2 $result = "@$source";
526 }
527  
528 2 ▶ shift @$source while @$source;
Branch: 1 branch
BranchTrueFalseTotal
@$source and do { shift @$source } 5 2 7
529 2 push( @$source, @later );
530 }
531 else {
532 32 ▶ if ( $try->{isa} eq 'ArrayRef' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($try->{'isa'} eq 'ArrayRef') { } 1 31 32
elsif ($try->{'isa'} eq 'HashRef') { } 1 30 31
533 1 $result = [ shift @$source ];
534 }
535 elsif ( $try->{isa} eq 'HashRef' ) {
536 1 $result = { split /=/, shift @$source };
537 }
538 else {
539 30 $result = shift @$source;
540 }
541 }
542  
543 # TODO: type check using Param::Utils?
544 }
545 elsif ( exists $source_hash->{ $try->{name} } ) {
546 0 $result = delete $source_hash->{ $try->{name} };
547 }
548 ▶ elsif ( $try->{required} and !$ishelp ) {
Condition100%3/3
$try->{"required"} and not $ishelp
!ll&&!rl&&r
1722
MC/DC100%2/2
$try->{"required"} and not $ishelp
$try->{"required"} not $ishelp
Truth table100%3/3
A and not(B)
A= $try->{"required"}B= not $ishelp
ABresult
0X0
100
111
549 2 $missing_required++;
550 2 next;
551 }
552  
553 53 ▶ if ( $try->{isa} eq 'SubCmd' and $result ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($try->{"isa"} eq "SubCmd" and $result) 10 43 53
Condition100%3/3
$try->{"isa"} eq "SubCmd" and $result
!ll&&!rl&&r
40310
MC/DC100%2/2
$try->{"isa"} eq "SubCmd" and $result
$try->{"isa"} eq "SubCmd" $result
Truth table100%3/3
A and B
A= $try->{"isa"} eq "SubCmd"B= $result
ABresult
0X0
100
111
554  
555 # look up abbreviated words
556 10 ▶ if ($ABBREV) {
Branch: 1 branch
BranchTrueFalseTotal
if ($OptArgs::ABBREV) 6 4 10
557 6 require Text::Abbrev;
558 my %words =
559 13 map { m/^$package\:\:(\w+)$/; $1 => 1 }
560 6 grep { m/^$package\:\:(\w+)$/ }
561 keys %seen;
562 6 my %abbrev = Text::Abbrev::abbrev( keys %words );
563 6 ▶ $result = $abbrev{$result} if defined $abbrev{$result};
Branch: 1 branch
BranchTrueFalseTotal
if defined $abbrev{$result} 6 0 6
564 }
565  
566 10 my $newpackage = $package . '::' . $result;
567 10 $newpackage =~ s/-/_/g;
568  
569 10 ▶ if ( exists $seen{$newpackage} ) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $seen{$newpackage}) { } 8 2 10
elsif (not $ishelp) { } 2 0 2
570 8 $package = $newpackage;
571 0 @config = grep { $_->{type} eq 'opt' } @config;
572 8 push( @config, @{ $opts{$package} }, @{ $args{$package} } );
573 }
574 elsif ( !$ishelp ) {
575 2 ▶ if ( $try->{fallback} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($try->{'fallback'}) { } 1 1 2
576 1 unshift @$source, $result;
577 1 $try->{fallback}->{type} = 'arg';
578 1 unshift( @config, $try->{fallback} );
579 1 next;
580 }
581 else {
582 die _usage( $package,
583 1 "Unknown " . uc( $try->{name} ) . qq{ "$result"} );
584 }
585 }
586  
587 8 $result = undef;
588 }
589  
590 }
591  
592 206 ▶ if ( defined $result ) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $result) { } 51 155 206
elsif (defined $try->{'default'}) { } 16 139 155
593 51 $optargs->{ $try->{name} } = $result;
594 }
595 elsif ( defined $try->{default} ) {
596 push( @coderef_default_keys, $try->{name} )
597 16 ▶ if ref $try->{default} eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $try->{"default"} eq "CODE" 8 8 16
598 16 $optargs->{ $try->{name} } = $result = $try->{default};
599 }
600  
601 206 ▶ $ishelp = 1 if $result and $try->{ishelp};
Branch: 1 branch
BranchTrueFalseTotal
if $result and $try->{"ishelp"} 2 204 206
Condition100%3/3
$result and $try->{"ishelp"}
!ll&&!rl&&r
140642
MC/DC100%2/2
$result and $try->{"ishelp"}
$result $try->{"ishelp"}
Truth table100%3/3
A and B
A= $resultB= $try->{"ishelp"}
ABresult
0X0
100
111
602  
603 }
604  
605 48 ▶ if ($ishelp) {
Branch: 4 branches
BranchTrueFalseTotal
if ($ishelp) { } 2 46 48
elsif ($missing_required) { } 2 44 46
elsif (@$source) { } 2 42 44
elsif (my(@unexpected) = keys %$source_hash) { } 0 42 42
606 2 die _usage( $package, undef, 1 );
607 }
608 elsif ($missing_required) {
609 2 die _usage($package);
610 }
611 elsif (@$source) {
612 2 die _usage( $package, "Unexpected options or arguments: @$source" );
613 }
614 elsif ( my @unexpected = keys %$source_hash ) {
615 0 die _usage( $package,
616 "Unexpected HASH options or arguments: @unexpected" );
617 }
618  
619 # Re-calculate the default if it was a subref
620 42 foreach my $key (@coderef_default_keys) {
621 8 $optargs->{$key} = $optargs->{$key}->( {%$optargs} );
622 }
623  
624 42 return ( $package, $optargs );
625 }
626  
627 37 ▶sub optargs {
Subroutine optargs: called CC=2 SCAR=7.0
Pod documented
628 37 my $caller = caller;
629  
630 carp "optargs() called from dispatch handler"
631 37 ▶ if $dispatching{$caller};
Branch: 1 branch
BranchTrueFalseTotal
if $dispatching{$caller} 0 37 37
632  
633 37 my ( $package, $optargs ) = _optargs( $caller, @_ );
634 34 return $optargs;
635 }
636  
637 13 ▶sub class_optargs {
Subroutine class_optargs: called CC=5 SCAR=17.0
Pod documented
638 13 my $caller = shift;
639  
640 13 ▶ croak 'dispatch($class, [@argv])' unless $caller;
Branch: 1 branch
BranchTrueFalseTotal
unless $caller 0 13 13
641 carp "optargs_class() called from dispatch handler"
642 13 ▶ if $dispatching{$caller};
Branch: 1 branch
BranchTrueFalseTotal
if $dispatching{$caller} 0 13 13
643  
644 13 ▶ die $@ unless eval "require $caller;";
Branch: 1 branch
BranchTrueFalseTotal
unless eval "require $caller;" 0 13 13
645  
646 13 my ( $class, $optargs ) = _optargs( $caller, @_ );
647  
648 8 ▶ croak $@ unless eval "require $class;1;";
Branch: 1 branch
BranchTrueFalseTotal
unless eval "require $class;1;" 0 8 8
649 8 return ( $class, $optargs );
650 }
651  
652 16 ▶sub dispatch {
Subroutine dispatch: called CC=6 SCAR=17.9
Pod documented
653 16 my $method = shift;
654 16 my $class = shift;
655  
656 16 ▶ croak 'dispatch($method, $class, [@argv])' unless $method and $class;
Branch: 1 branch
BranchTrueFalseTotal
unless $method and $class 2 14 16
Condition100%3/3
$method and $class
!ll&&!rl&&r
1114
MC/DC100%2/2
$method and $class
$method $class
Truth table100%3/3
A and B
A= $methodB= $class
ABresult
0X0
100
111
657 14 ▶ croak $@ unless eval "require $class;1;";
Branch: 1 branch
BranchTrueFalseTotal
unless eval "require $class;1;" 1 13 14
658  
659 13 my ( $package, $optargs ) = class_optargs( $class, @_ );
660  
661 8 my $sub = $package->can($method);
662 8 ▶ die "Can't find method $method via package $package" unless $sub;
Branch: 1 branch
BranchTrueFalseTotal
unless $sub 0 8 8
663  
664 8 $dispatching{$class}++;
665 8 my @results = $sub->($optargs);
666 8 $dispatching{$class}--;
667 8 ▶ return @results if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 4 4 8
668 4 return $results[0];
669 }
670  
671 package OptArgs::Usage;
672 use overload
673 7 ▶ bool => sub { 1 },
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
674 7 ▶ '""' => sub { ${ $_[0] } },
Subroutine __ANON__: called CC=1 SCAR=0.0
675 11 fallback => 1;
676  
677 11 1;
678  
679 __END__
« Getopt/Args.pm ↑ Summary App/optargs.pm »