Branch Coverage

blib/lib/OptArgs.pm
Criterion Covered Total %
branch 154 212 72.6


line true false branch
52 1 17 if (my(@missing) = grep({not exists $params->{$_};} @subcmd_required))
56 0 17 if (my(@invalid) = grep({not exists $subcmd_params{$_};} keys %$params))
67 10 7 ref $params->{'cmd'} eq 'ARRAY' ? :
68 0 17 unless @cmd
74 1 16 unless $seen{$parent}
79 1 15 if $seen{$package}
125 4 39 unless $name
126 2 37 if $seen{$package}{$name}
128 2 35 if (my(@missing) = grep({not exists $params->{$_};} @opt_required))
132 1 34 if (my(@invalid) = grep({not exists $opt_params{$_};} keys %$params))
138 1 33 if $params->{'ishelp'} and $params->{'isa'} ne "Bool"
141 1 32 unless exists $opt_isa{$params->{'isa'}}
151 3 29 if ((my $dashed = $params->{'name'}) =~ s/_/-/g)
156 12 20 if $params->{'alias'}
195 4 28 unless $name
196 2 26 if $seen{$package}{$name}
198 2 24 if (my(@missing) = grep({not exists $params->{$_};} @arg_required))
202 1 23 if (my(@invalid) = grep({not exists $arg_params{$_};} keys %$params))
208 1 22 unless exists $arg_isa{$params->{'isa'}}
211 1 21 if defined $params->{'default'} and defined $params->{'required'}
214 1 20 if $params->{'fallback'} and $params->{'isa'} ne "SubCmd"
217 1 19 if defined $params->{'fallback'} and ref $params->{'fallback'} ne "HASH"
230 1 18 if ($params->{'fallback'})
250 0 7 $COLOUR && $terminal ? :
253 0 7 $COLOUR && $terminal ? :
264 0 7 defined &static::list ? :
266 3 4 if ($error)
270 2 5 $ishelp ? :
273 5 3 unless $seen{$parent}
279 3 4 if @parents
283 6 1 if ($last)
286 0 6 unless $def->{'required'}
288 0 6 if $def->{'greedy'}
289 0 6 unless $def->{'required'}
294 7 0 if @opts
299 2 0 if $ishelp and $desc{$caller}
301 0 7 if ($ishelp and my $version = $caller->VERSION)
305 4 3 if ($last and $last->{'isa'} eq "SubCmd")
315 0 0 if exists $last->{'fallback'} and $ishelp || !$last->{'fallback'}{'hidden'}
317 1 3 if $SORT
322 0 10 if $hidden{$pkg} and not $ishelp
328 1 6 if $SORT
331 0 18 if $opt->{'hidden'} and not $ishelp
335 0 16 if ($opt->{'isa'} eq "Bool" and $opt->{'default'})
340 0 0 if ($PRINT_DEFAULT and defined $opt->{'default'} and not $opt->{'ishelp'})
344 0 0 ref $opt->{'default'} eq 'CODE' ? :
345 0 0 if ($opt->{'isa'} eq "Bool")
346 0 0 $value ? :
351 0 18 if ($PRINT_ISA)
352 0 0 if ($opt->{'isa_name'}) { }
0 0 elsif ($opt->{'isa'} eq 'Str' or $opt->{'isa'} eq 'HashRef' or $opt->{'isa'} eq 'ArrayRef') { }
0 0 elsif ($opt->{'isa'} eq 'Int') { }
0 0 elsif ($opt->{'isa'} eq 'Num') { }
369 15 3 if $opt->{'alias'}
377 15 3 $opt->{'alias'} ? :
382 7 0 if (@uopts)
392 4 3 if (@usage)
397 2 5 if (@uargs and $last->{'isa'} ne "SubCmd")
403 7 0 if (@uopts)
424 32 56 unless $seen{$parent}
429 28 4 if @parents
431 12 20 if (my $last = $args[$#args])
434 0 12 unless $def->{'required'}
436 0 12 if $def->{'greedy'}
437 0 12 unless $def->{'required'}
458 27 23 if (not @_ and @ARGV) { }
462 27 0 if ($CODESET)
474 0 84 if not defined $_
478 1 0 unless exists $opts{$package} or exists $args{$package}
492 155 55 if ($try->{'type'} eq 'opt') { }
55 0 elsif ($try->{'type'} eq 'arg') { }
493 0 155 if (exists $$source_hash{$try->{'name'}}) { }
501 34 21 if (@$source) { }
0 21 elsif (exists $$source_hash{$try->{'name'}}) { }
2 36 elsif ($try->{'required'} and not $ishelp) { }
502 0 34 if $source->[0] =~ /^--\S/
509 0 34 if $source->[0] =~ /^-\S/ and not $source->[0] =~ /^-\d/ && ($try->{'isa'} ne 'Num' || $try->{'isa'} ne 'Int')
512 2 32 if ($try->{'greedy'}) { }
514 0 2 if (@config and @$source > @config)
518 0 2 if ($try->{'isa'} eq 'ArrayRef') { }
0 2 elsif ($try->{'isa'} eq 'HashRef') { }
532 1 31 if ($try->{'isa'} eq 'ArrayRef') { }
1 30 elsif ($try->{'isa'} eq 'HashRef') { }
553 10 43 if ($try->{'isa'} eq "SubCmd" and $result)
556 6 4 if ($ABBREV)
563 6 0 if defined $abbrev{$result}
569 8 2 if (exists $seen{$newpackage}) { }
2 0 elsif (not $ishelp) { }
575 1 1 if ($try->{'fallback'}) { }
592 51 155 if (defined $result) { }
16 139 elsif (defined $try->{'default'}) { }
597 8 8 if ref $try->{'default'} eq "CODE"
601 2 64 if $result and $try->{'ishelp'}
605 2 46 if ($ishelp) { }
2 44 elsif ($missing_required) { }
2 42 elsif (@$source) { }
0 42 elsif (my(@unexpected) = keys %$source_hash) { }
631 0 37 if $dispatching{$caller}
640 0 13 unless $caller
642 0 13 if $dispatching{$caller}
644 0 13 unless eval "require $caller;"
648 0 8 unless eval "require $class;1;"
656 2 14 unless $method and $class
657 1 13 unless eval "require $class;1;"
662 0 8 unless $sub
667 4 4 if wantarray