Branch Coverage

blib/lib/OptArgs.pm
Criterion Covered Total %
branch 153 194 78.8


line true false branch
50 1 17 if (my(@missing) = grep({not exists $params->{$_};} @subcmd_required))
54 0 17 if (my(@invalid) = grep({not exists $subcmd_params{$_};} keys %$params))
65 10 7 ref $params->{'cmd'} eq 'ARRAY' ? :
66 0 17 unless @cmd
72 1 16 unless $seen{$parent}
77 1 15 if $seen{$package}
122 4 39 unless $name
123 2 37 if $seen{$package}{$name}
125 2 35 if (my(@missing) = grep({not exists $params->{$_};} @opt_required))
129 1 34 if (my(@invalid) = grep({not exists $opt_params{$_};} keys %$params))
135 1 33 if $params->{'ishelp'} and $params->{'isa'} ne 'Bool'
138 1 32 unless exists $opt_isa{$params->{'isa'}}
148 3 29 if ((my $dashed = $params->{'name'}) =~ s/_/-/g)
153 12 20 if $params->{'alias'}
192 4 28 unless $name
193 2 26 if $seen{$package}{$name}
195 2 24 if (my(@missing) = grep({not exists $params->{$_};} @arg_required))
199 1 23 if (my(@invalid) = grep({not exists $arg_params{$_};} keys %$params))
205 1 22 unless exists $arg_isa{$params->{'isa'}}
208 1 21 if defined $params->{'default'} and defined $params->{'required'}
211 1 20 if $params->{'fallback'} and $params->{'isa'} ne 'SubCmd'
214 1 19 if defined $params->{'fallback'} and ref $params->{'fallback'} ne 'HASH'
227 1 18 if ($params->{'fallback'})
247 0 7 $COLOUR && $terminal ? :
250 0 7 $COLOUR && $terminal ? :
261 0 7 defined &static::list ? :
263 3 4 if ($error)
267 2 5 $ishelp ? :
270 5 3 unless $seen{$parent}
276 3 4 if @parents
280 6 1 if ($last)
283 0 6 unless $def->{'required'}
285 0 6 if $def->{'greedy'}
286 0 6 unless $def->{'required'}
291 7 0 if @opts
296 2 0 if $ishelp and $desc{$caller}
298 0 7 if ($ishelp and my $version = $caller->VERSION)
302 4 3 if ($last and $last->{'isa'} eq 'SubCmd')
312 0 0 if exists $last->{'fallback'} and $ishelp || !$last->{'fallback'}{'hidden'}
314 1 3 if $SORT
319 0 10 if $hidden{$pkg} and not $ishelp
325 1 6 if $SORT
328 0 18 if $opt->{'hidden'} and not $ishelp
332 0 16 if ($opt->{'isa'} eq 'Bool' and $opt->{'default'})
336 15 3 if $opt->{'alias'}
345 15 3 $opt->{'alias'} ? :
349 7 0 if (@uopts)
359 4 3 if (@usage)
364 2 5 if (@uargs and $last->{'isa'} ne 'SubCmd')
370 7 0 if (@uopts)
391 32 56 unless $seen{$parent}
396 28 4 if @parents
398 12 20 if (my $last = $args[$#args])
401 0 12 unless $def->{'required'}
403 0 12 if $def->{'greedy'}
404 0 12 unless $def->{'required'}
425 27 23 if (not @_ and @ARGV) { }
429 27 0 if ($CODESET)
441 0 84 if not defined $_
445 1 0 unless exists $opts{$package} or exists $args{$package}
459 155 55 if ($try->{'type'} eq 'opt') { }
55 0 elsif ($try->{'type'} eq 'arg') { }
460 0 155 if (exists $$source_hash{$try->{'name'}}) { }
468 34 21 if (@$source) { }
0 21 elsif (exists $$source_hash{$try->{'name'}}) { }
2 36 elsif ($try->{'required'} and not $ishelp) { }
469 0 34 if $source->[0] =~ /^--\S/
476 0 34 if $source->[0] =~ /^-\S/ and not $source->[0] =~ /^-\d/ && ($try->{'isa'} ne 'Num' || $try->{'isa'} ne 'Int')
479 2 32 if ($try->{'greedy'}) { }
481 0 2 if (@config and @$source > @config)
485 0 2 if ($try->{'isa'} eq 'ArrayRef') { }
0 2 elsif ($try->{'isa'} eq 'HashRef') { }
499 1 31 if ($try->{'isa'} eq 'ArrayRef') { }
1 30 elsif ($try->{'isa'} eq 'HashRef') { }
520 10 43 if ($try->{'isa'} eq 'SubCmd' and $result)
523 6 4 if ($ABBREV)
530 6 0 if defined $abbrev{$result}
536 8 2 if (exists $seen{$newpackage}) { }
2 0 elsif (not $ishelp) { }
542 1 1 if ($try->{'fallback'}) { }
559 51 155 if (defined $result) { }
16 139 elsif (defined $try->{'default'}) { }
564 8 8 if ref $try->{'default'} eq 'CODE'
568 2 64 if $result and $try->{'ishelp'}
572 2 46 if ($ishelp) { }
2 44 elsif ($missing_required) { }
2 42 elsif (@$source) { }
0 42 elsif (my(@unexpected) = keys %$source_hash) { }
598 0 37 if $dispatching{$caller}
607 0 13 unless $caller
609 0 13 if $dispatching{$caller}
611 0 13 unless eval "require $caller;"
615 0 8 unless eval "require $class;1;"
623 2 14 unless $method and $class
624 1 13 unless eval "require $class;1;"
629 0 8 unless $sub
634 4 4 if wantarray