Branch Coverage

blib/lib/Getopt/Lucid.pm
Criterion Covered Total %
branch 301 322 93.4


line true false branch
43 7 29 if @_
48 1 9 if @_
53 4 9 if scalar @_
65 0 2 unless grep {$self->{'type'} eq $_;} 'parameter', 'list', 'keypair'
66 0 2 $self->{'type'} eq 'keypair' ? :
73 6 31 if ($self->{'type'} eq 'keypair') { }
5 26 elsif ($self->{'type'} eq 'list') { }
74 2 4 if (ref $_[0] eq 'HASH') { }
3 1 elsif (@_ % 2 == 0) { }
111 8 182 ref $_[-1] eq 'HASH' ? :
112 48 142 ref $target eq 'ARRAY' ? :
116 0 190 ref $class ? :
118 1 189 unless ref $self->{'raw_spec'} eq 'ARRAY'
134 3 1 @_ % 2 == 0 ? :
4 4 ref $_[0] eq 'HASH' ? :
140 13 29 unless exists $append{$strip}
142 15 14 if (/switch|parameter/)
146 4 10 if (/counter/)
150 5 5 if (/list/)
152 1 4 if ref $append{$strip} and ref $append{$strip} ne 'ARRAY'
155 2 2 ref $append{$strip} eq 'ARRAY' ? :
159 5 0 if (/keypair/)
161 1 4 if ref $append{$strip} and ref $append{$strip} ne 'HASH'
170 1 26 unless _validate_value($self, $self->{'default'}{$strip}, $spec->{'valid'})
192 2 139 if ($self eq 'Getopt::Lucid')
193 1 1 unless ref $spec eq 'ARRAY'
200 15 272 if $raw =~ /^--$/
202 24 248 if _unbundle($self, $orig, $val)
203 23 225 $orig =~ s/^$NEGATIVE(.*)$/$1/ ? :
205 232 16 if ($arg) { }
208 23 209 $neg ? :
210 24 0 /keypair/ ? :
20 24 /list/ ? :
52 44 /parameter/ ? :
82 96 /counter/ ? :
54 178 /switch/ ? :
218 11 5 if $orig =~ /^-./
236 0 83 if $arg and ref $arg ne 'HASH'
239 7 76 if ($arg and exists $arg->{'requires'})
241 0 7 if $requires and ref $requires ne 'ARRAY'
245 0 7 unless exists $self->{'spec'}{$p}
247 2 5 unless $self->{'seen'}{$p}
263 3 1 @_ % 2 == 0 ? :
4 4 ref $_[0] eq 'HASH' ? :
269 15 29 unless exists $merge{$strip}
271 19 10 if (/switch|counter|parameter/)
275 5 5 if (/list/)
277 1 4 if ref $merge{$strip} and ref $merge{$strip} ne 'ARRAY'
280 2 2 ref $merge{$strip} eq 'ARRAY' ? :
284 5 0 if (/keypair/)
286 1 4 if ref $merge{$strip} and ref $merge{$strip} ne 'HASH'
292 1 26 unless _validate_value($self, $self->{'default'}{$strip}, $spec->{'valid'})
324 3 1 @_ % 2 == 0 ? :
4 4 ref $_[0] eq 'HASH' ? :
331 15 30 if (/switch|counter/)
335 18 12 if (/parameter/)
339 5 7 if (/list/)
341 1 4 if ref $replace{$strip} and ref $replace{$strip} ne 'ARRAY'
342 4 0 if (exists $replace{$strip}) { }
344 2 2 ref $replace{$strip} eq 'ARRAY' ? :
351 7 0 if (/keypair/)
353 1 6 if ref $replace{$strip} and ref $replace{$strip} ne 'HASH'
354 2 4 unless exists $replace{$strip}
360 1 42 unless _validate_value($self, $self->{'default'}{$strip}, $spec->{'valid'})
414 8 0 @$list == 1 ? :
418 6 2 length $list->[0] > 1 ? :
8 6 if @$list
427 3 4 defined $doc ? :
428 3 4 unless defined $default
429 1 3 if length $str
431 1 3 if ($type eq 'list') { }
1 2 elsif ($type eq 'keypair') { }
451 102 103 unless $self->{'seen'}{$key}
452 93 10 unless exists $self->{'spec'}{$key}{'needs'}
456 5 7 unless $self->{'seen'}{$_}
467 2 80 if defined $val
479 314 30 unless $self->{'strict'}
480 278 66 if exists $self->{'alias_hr'}{$arg}
483 4 10 if $arg =~ /^$_$/i
496 4 20 if ($neg) { }
500 3 17 defined $val ? :
501 1 16 unless (defined $val or defined $value)
505 3 16 unless $value =~ /[^=]+=.+/
510 4 12 unless _validate_value($self, {$key, $data}, $self->{'spec'}{$arg}{'valid'})
522 4 16 if ($neg) { }
526 3 13 defined $val ? :
527 13 3 unless (defined $val)
528 1 12 unless (defined $value)
534 1 14 if not defined $val and _find_arg($self, $value)
537 1 13 unless _validate_value($self, $value, $self->{'spec'}{$arg}{'valid'})
549 6 46 if ($neg) { }
550 1 5 if defined $val
554 7 39 defined $val ? :
555 39 7 unless (defined $val)
556 2 37 unless (defined $value)
561 3 41 if not defined $val and _find_arg($self, $value)
564 4 37 unless _validate_value($self, $value, $self->{'spec'}{$arg}{'valid'})
578 0 541 unless $type eq 'Getopt::Lucid::Spec'
589 501 32 unless $self->{'strict'}
592 16 832 if $opt->{'nocase'}
609 49 366 ref $d eq 'HASH' ? :
48 415 ref $d eq 'ARRAY' ? :
616 59 215 if (/switch/)
617 4 55 $neg ? :
620 102 113 if (/counter/)
621 3 99 $neg ? :
624 42 71 if (/parameter/)
625 5 37 $neg ? :
628 40 31 if (/list/)
629 4 36 if ($neg) { }
631 2 2 $value ? :
637 31 0 if (/keypair/)
638 4 27 if ($neg) { }
639 2 2 if ($value->[0]) { }
656 3 171 unless defined $valid
657 10 161 if (ref $valid eq 'CODE') { }
674 236 352 exists $spec->{'default'} ? :
677 0 55 if $type eq 'list' and defined $d and ref $d ne 'ARRAY'
679 1 62 if $type eq 'keypair' and defined $d and ref $d ne 'HASH'
681 221 366 if (defined $d)
683 1 220 unless _validate_value($self, $d, $spec->{'valid'})
687 39 116 defined $d ? :
52 88 defined $d ? :
33 22 defined $d ? :
33 29 defined $d ? :
62 0 /keypair/ ? :
55 62 /list/ ? :
174 117 /parameter/ ? :
140 291 /counter/ ? :
155 431 /switch/ ? :
705 27 245 if ($raw =~ /^($NEGATIVE?$VALID_NAME|$SHORT_BUNDLE)=(.*)/) { }
720 2 52 if defined $val
722 48 4 unless ($neg)
724 1 47 if $self->{'seen'}{$arg} > 1
735 24 248 if ($arg =~ /^$SHORT_BUNDLE$/)
737 4 20 if defined $val
754 511 18 unless exists $self->{'spec'}{$key}{'needs'}
756 18 0 ref $needs eq 'ARRAY' ? :
758 1 23 unless _find_arg($self, $_)
775 809 48 unless $self->{'strict'}
776 2 855 unless $name =~ /^$VALID_NAME$/
781 3 852 if exists $self->{'alias_hr'}{$alt_name}
786 0 852 if grep {$strip eq $_;} values %{$$self{'strip'};}
791 1 1908 unless grep {$key eq $_;} @valid_keys
796 2 533 unless grep {$type eq $_;} @valid_types
805 288 101 unless defined $valid
806 30 71 if (ref $value eq 'HASH') { }
19 52 elsif (ref $value eq 'ARRAY') { }
810 2 42 unless _regex_or_code($k, $valid_key)
811 2 40 unless _regex_or_code($v, $valid_val)
816 0 36 unless _regex_or_code($_, $valid)
832 190 15 if $name eq 'DESTROY'
834 15 0 if ($action)
839 12 33 if ($maybe_opt eq $known_opt)
845 3 30 if ($maybe_opt eq $fuzzy_opt)
852 0 15 unless $opt
856 5 10 if ($action eq 'set')
859 1 3 ref $self->{'options'}{$opt} eq 'HASH' ? :
1 4 ref $self->{'options'}{$opt} eq 'ARRAY' ? :
863 3 9 ref $ans eq 'HASH' ? :
3 12 ref $ans eq 'ARRAY' ? :