Branch Coverage

blib/lib/Getopt/Lucid.pm
Criterion Covered Total %
branch 285 302 94.3


line true false branch
41 7 27 if @_
46 1 8 if @_
51 4 8 if scalar @_
63 0 2 unless grep {$self->{'type'} eq $_;} 'parameter', 'list', 'keypair'
64 0 2 $self->{'type'} eq 'keypair' ? :
71 5 28 if ($self->{'type'} eq 'keypair') { }
4 24 elsif ($self->{'type'} eq 'list') { }
72 2 3 if (ref $_[0] eq 'HASH') { }
2 1 elsif (@_ % 2 == 0) { }
105 8 181 ref $_[-1] eq 'HASH' ? :
106 48 141 ref $target eq 'ARRAY' ? :
110 0 189 ref $class ? :
112 1 188 unless ref $self->{'raw_spec'} eq 'ARRAY'
128 3 1 @_ % 2 == 0 ? :
4 4 ref $_[0] eq 'HASH' ? :
134 17 29 unless exists $append{$strip}
136 15 14 if (/switch|parameter/)
140 4 10 if (/counter/)
144 5 5 if (/list/)
146 1 4 if ref $append{$strip} and ref $append{$strip} ne 'ARRAY'
149 2 2 ref $append{$strip} eq 'ARRAY' ? :
153 5 0 if (/keypair/)
155 1 4 if ref $append{$strip} and ref $append{$strip} ne 'HASH'
164 1 26 unless _validate_value($self, $self->{'default'}{$strip}, $spec->{'valid'})
186 2 139 if ($self eq 'Getopt::Lucid')
187 1 1 unless ref $spec eq 'ARRAY'
194 15 272 if $raw =~ /^--$/
196 24 248 if _unbundle($self, $orig, $val)
197 23 225 $orig =~ s/^$NEGATIVE(.*)$/$1/ ? :
199 232 16 if ($arg) { }
202 23 209 $neg ? :
204 24 0 /keypair/ ? :
20 24 /list/ ? :
52 44 /parameter/ ? :
82 96 /counter/ ? :
54 178 /switch/ ? :
212 11 5 if $orig =~ /^-./
230 0 83 if $arg and ref $arg ne 'HASH'
233 7 76 if ($arg and exists $arg->{'requires'})
235 0 7 if $requires and ref $requires ne 'ARRAY'
239 2 5 unless $self->{'seen'}{$p}
255 3 1 @_ % 2 == 0 ? :
4 4 ref $_[0] eq 'HASH' ? :
261 18 29 unless exists $merge{$strip}
263 19 10 if (/switch|counter|parameter/)
267 5 5 if (/list/)
269 1 4 if ref $merge{$strip} and ref $merge{$strip} ne 'ARRAY'
272 2 2 ref $merge{$strip} eq 'ARRAY' ? :
276 5 0 if (/keypair/)
278 1 4 if ref $merge{$strip} and ref $merge{$strip} ne 'HASH'
284 1 26 unless _validate_value($self, $self->{'default'}{$strip}, $spec->{'valid'})
316 3 1 @_ % 2 == 0 ? :
4 4 ref $_[0] eq 'HASH' ? :
323 17 31 if (/switch|counter/)
327 18 13 if (/parameter/)
331 7 6 if (/list/)
333 1 6 if ref $replace{$strip} and ref $replace{$strip} ne 'ARRAY'
334 4 2 if (exists $replace{$strip}) { }
336 2 2 ref $replace{$strip} eq 'ARRAY' ? :
343 6 0 if (/keypair/)
345 1 5 if ref $replace{$strip} and ref $replace{$strip} ne 'HASH'
346 1 4 unless exists $replace{$strip}
352 1 45 unless _validate_value($self, $self->{'default'}{$strip}, $spec->{'valid'})
376 100 105 unless $self->{'seen'}{$key}
377 95 10 unless exists $self->{'spec'}{$key}{'needs'}
381 5 7 unless $self->{'seen'}{$_}
392 2 80 if defined $val
404 314 30 unless $self->{'strict'}
405 278 66 if exists $self->{'alias_hr'}{$arg}
408 4 10 if $arg =~ /^$_$/i
421 4 20 if ($neg) { }
425 3 17 defined $val ? :
426 1 16 unless (defined $val or defined $value)
430 3 16 unless $value =~ /[^=]+=.+/
435 4 12 unless _validate_value($self, {$key, $data}, $self->{'spec'}{$arg}{'valid'})
447 4 16 if ($neg) { }
451 3 13 defined $val ? :
452 13 3 unless (defined $val)
453 1 12 unless (defined $value)
459 1 14 if not defined $val and _find_arg($self, $value)
462 1 13 unless _validate_value($self, $value, $self->{'spec'}{$arg}{'valid'})
474 6 46 if ($neg) { }
475 1 5 if defined $val
479 7 39 defined $val ? :
480 39 7 unless (defined $val)
481 2 37 unless (defined $value)
486 3 41 if not defined $val and _find_arg($self, $value)
489 4 37 unless _validate_value($self, $value, $self->{'spec'}{$arg}{'valid'})
506 494 32 unless $self->{'strict'}
509 16 824 if $opt->{'nocase'}
526 49 366 ref $d eq 'HASH' ? :
48 415 ref $d eq 'ARRAY' ? :
533 59 215 if (/switch/)
534 4 55 $neg ? :
537 102 113 if (/counter/)
538 3 99 $neg ? :
541 42 71 if (/parameter/)
542 5 37 $neg ? :
545 40 31 if (/list/)
546 4 36 if ($neg) { }
548 2 2 $value ? :
554 31 0 if (/keypair/)
555 4 27 if ($neg) { }
556 2 2 if ($value->[0]) { }
573 3 171 unless defined $valid
574 10 161 if (ref $valid eq 'CODE') { }
591 232 349 exists $spec->{'default'} ? :
594 0 54 if $type eq 'list' and defined $d and ref $d ne 'ARRAY'
596 1 61 if $type eq 'keypair' and defined $d and ref $d ne 'HASH'
598 217 363 if (defined $d)
600 1 216 unless _validate_value($self, $d, $spec->{'valid'})
604 39 114 defined $d ? :
51 88 defined $d ? :
32 22 defined $d ? :
32 29 defined $d ? :
61 0 /keypair/ ? :
54 61 /list/ ? :
172 115 /parameter/ ? :
139 287 /counter/ ? :
153 426 /switch/ ? :
622 27 245 if ($raw =~ /^($NEGATIVE?$VALID_NAME|$SHORT_BUNDLE)=(.*)/) { }
637 2 52 if defined $val
639 48 4 unless ($neg)
641 1 47 if $self->{'seen'}{$arg} > 1
652 24 248 if ($arg =~ /^$SHORT_BUNDLE$/)
654 4 20 if defined $val
671 505 18 unless exists $self->{'spec'}{$key}{'needs'}
673 18 0 ref $needs eq 'ARRAY' ? :
675 1 23 unless _find_arg($self, $_)
692 801 48 unless $self->{'strict'}
693 2 847 unless $name =~ /^$VALID_NAME$/
698 3 844 if exists $self->{'alias_hr'}{$alt_name}
703 0 844 if grep {$strip eq $_;} values %{$$self{'strip'};}
708 1 1879 unless grep {$key eq $_;} @valid_keys
713 2 526 unless grep {$type eq $_;} @valid_types
722 286 102 unless defined $valid
723 30 72 if (ref $value eq 'HASH') { }
20 52 elsif (ref $value eq 'ARRAY') { }
727 2 42 unless _regex_or_code($k, $valid_key)
728 2 40 unless _regex_or_code($v, $valid_val)
733 0 36 unless _regex_or_code($_, $valid)
749 189 15 if $name eq 'DESTROY'
751 15 0 if ($action)
756 12 33 if ($maybe_opt eq $known_opt)
762 3 30 if ($maybe_opt eq $fuzzy_opt)
769 0 15 unless $opt
773 5 10 if ($action eq 'set')
776 1 3 ref $self->{'options'}{$opt} eq 'HASH' ? :
1 4 ref $self->{'options'}{$opt} eq 'ARRAY' ? :
780 3 9 ref $ans eq 'HASH' ? :
3 12 ref $ans eq 'ARRAY' ? :