Branch Coverage

blib/lib/Getopt/Compact/WithCmd.pm
Criterion Covered Total %
branch 226 252 89.6


line true false branch
32 37 162 exists $args{'usage'} && !$args{'usage'} ? :
50 199 0 unless $args{'configure'}
52 199 0 if @gconf
58 79 116 if ($args{'command_struct'}) { }
59 62 17 if (my(@gopts) = $self->_parse_argv)
62 2 60 unless $$self{'ret'}
63 0 60 if $self->_want_help
69 6 110 unless $$self{'ret'}
70 7 103 if $self->_want_help
81 0 40 unless (ref $args eq 'ARRAY')
90 1 37 unless (defined $str)
100 0 3 unless $_[0]{'error'}
110 5 46 if ($$self{'usage'} and $$opt{'help'} || $self->status == 0)
123 9 28 if (defined $self->command and $self->command eq 'help' or @targets)
125 7 2 unless @targets
128 0 8 unless defined $target
129 0 8 if (not ref $$self{'_struct'}{$target} eq 'HASH') { }
139 3 5 if (ref $$self{'_struct'}{$target}{'command_struct'} eq 'HASH') { }
152 7 30 if $error
154 2 35 if ($name)
156 1 1 if $version
160 14 23 if ($self->command and $self->command ne 'help') { }
161 14 0 @{$self->commands;} ? :
166 6 17 if keys %$summary
168 7 30 $args ? :
172 3 59 unless defined $desc
174 62 59 length $_ > 1 ? :
176 3 59 unless length $onames[0] == 1
182 6 56 $$opts{'required'} ? :
183 1 61 defined $$opts{'default'} ? :
189 37 0 if (@help)
196 5 32 if (defined $other_usage and length $other_usage > 0)
201 26 11 if (not $self->command or $$self{'has_sub_command'})
206 8 18 if (@commands)
212 2 6 if (@{$self->commands;})
233 29 1 if ($shell eq 'bash') { }
270 5 25 if (ref $$s{'command_struct'} eq 'HASH')
325 5 25 if (scalar @{$$command{'subcmd'};} > 0) { }
329 1 5 if scalar @{$$subcommand{'opts'};} <= 0
418 69 209 if (ref $cmd eq 'HASH') { }
436 62 62 length $_ > 1 ? :
438 0 62 if $arg eq 'Incr'
474 106 156 unless defined $spec
476 110 46 if ($type)
477 1 0 $type eq 'o' ? :
1 1 $type eq 'f' ? :
7 2 $type eq 'i' ? :
48 9 $type eq 's' ? :
1 57 $type eq '+' ? :
52 58 $type eq '!' ? :
485 11 145 if ($dest)
486 7 0 $dest eq '%' ? :
4 7 $dest eq '@' ? :
508 38 148 if $$stuff[0] > 0
522 21 74 unless (defined $command)
527 74 0 unless ($$command_map{'help'})
535 4 70 unless (exists $$command_map{$command})
543 14 56 if ($command eq 'help')
546 8 6 if (defined $ARGV[0] and exists $$command_struct{$ARGV[0]})
548 5 3 if $nested_struct
558 10 46 if (my $nested_struct = $$command_struct{$command}{'command_struct'}) { }
565 1 9 if ($self->_want_help)
569 1 9 unless $$self{'ret'}
576 2 44 if ($self->_want_help)
586 10 216 exists $_[0]{'opt'}{'help'} && $_[0]{'opt'}{'help'} ? :
602 239 16 GetOptionsFromArray($argv, %$opthash) ? :
617 62 28 if exists $$struct{$argv}
635 414 0 $longname ? :
638 27 387 if (ref $cb eq 'CODE') { }
639 9 9 substr($type, -1, 1) eq '%' ? :
9 18 substr($type, -1, 1) eq '@' ? :
642 0 27 if (ref $ref eq 'CODE') { }
20 7 elsif (ref $ref) { }
646 6 14 if (ref $ref eq 'SCALAR' or ref $ref eq 'REF') { }
6 8 elsif (ref $ref eq 'ARRAY') { }
8 0 elsif (ref $ref eq 'HASH') { }
647 2 2 $t eq 'Hash' ? :
2 4 $t eq 'Array' ? :
656 7 13 if ($t eq 'Array') { }
6 7 elsif ($t eq 'Hash') { }
657 2 5 if (ref $ref eq 'SCALAR' or ref $ref eq 'REF') { }
2 3 elsif (ref $ref eq 'ARRAY') { }
3 0 elsif (ref $ref eq 'HASH') { }
665 1 2 unless @kv == 2
671 2 4 if (ref $ref eq 'SCALAR' or ref $ref eq 'REF') { }
2 2 elsif (ref $ref eq 'ARRAY') { }
2 0 elsif (ref $ref eq 'HASH') { }
683 2 5 if (ref $ref eq 'SCALAR' or ref $ref eq 'REF') { }
2 3 elsif (ref $ref eq 'ARRAY') { }
3 0 elsif (ref $ref eq 'HASH') { }
691 1 2 unless @kv == 2
700 2 3 if ($t eq 'Array') { }
2 1 elsif ($t eq 'Hash') { }
715 26 361 ref $ref ? :
717 26 388 if (exists $$opts{'default'})
719 3 23 if (ref $value eq 'ARRAY') { }
6 17 elsif (ref $value eq 'HASH') { }
12 5 elsif (not ref $value) { }
733 3 9 if (not $spec or ($$TYPE_MAP{$spec} || $spec) eq '!') { }
734 3 0 if $value
737 9 0 if defined $value
747 33 381 if $$opts{'required'}
750 5 267 if $$self{'error'}
751 19 248 if (@$default_args)
754 1 18 unless $$self{'ret'}
762 41 19 ref $struct eq 'HASH' ? :
210 60 ref $struct eq 'ARRAY' ? :
764 4 266 if (ref $$self{'modes'} eq 'ARRAY')
773 220 50 if $$self{'usage'} and not $self->_has_option('help')
783 41 0 ref $data eq 'HASH' ? :
787 1 37 defined $$data{'alias'} ? :
3 38 ref $$data{'alias'} eq 'ARRAY' ? :
802 289 138 if not defined $spec or $spec eq ''
803 95 43 if $self->_opt_spec2name($spec)
805 20 23 if ($spec =~ /^(Array|Hash)\[(\w+)\]$/) { }
23 0 elsif ($type = $$TYPE_MAP{$spec}) { }
807 10 10 $1 eq 'Array' ? :
821 0 2 unless (defined $name and $src_type and ref $cb eq 'CODE')
824 0 2 unless ($$TYPE_MAP{$src_type})
833 95 121 if ($command_struct) { }
846 65 67 if exists $$command_option{$key}
853 19 15 unless (defined $$self{'opt'}{$dest})
854 17 2 unless (defined ${$$self{'parsed_opthash'}{$$self{'requires'}{$dest}};})
867 694 1 ref $m eq 'ARRAY' ? :
868 600 0 if $la < 2 or $lb < 2
876 2 221 if grep {$_ eq $option;} map({$self->_option_names($$_[0]);} @{$$self{'struct'};})