Branch Coverage

lib/Getopt/Class.pm
Criterion Covered Total %
branch 166 418 39.7


line true false branch
40 0 6 unless $self->_is_hash($param)
41 0 6 unless $self->SUPER::init($param)
48 0 6 unless $self->_is_hash($dict)
85 0 114 if $def->{'__no_value_assign'}
88 42 72 if ($def->{'type'} eq "boolean" and not exists $def->{'mirror'})
92 0 42 if (substr($k, 0, 5) eq 'with_' and not exists $$dict{'without_' . substr($k, 5)}) { }
6 36 elsif (substr($k, 0, 8) eq 'without_' and not exists $$dict{'with_' . substr($k, 8)}) { }
6 30 elsif (substr($k, 0, 7) eq 'enable_' and not exists $$dict{'disable_' . substr($k, 7)}) { }
6 48 elsif (substr($k, 0, 8) eq 'disable_' and not exists $$dict{'enable_' . substr($k, 8)}) { }
113 18 24 if (defined $mirror_opt)
123 0 18 $self->_is_scalar($def->{'default'}) || $self->_is_code($def->{'default'}) || ref $def->{'default'} ? :
0 0 exists $def->{'code'} ? :
18 0 exists $def->{'default'} ? :
131 18 0 if exists $def->{'default'} and defined $def->{'default'}
133 0 18 if (ref $val eq 'CODE') { }
150 18 0 if exists $def->{'mirror'}{'default'}
157 0 0 if $def->{'mirror'}{'is_set'}
165 0 3 if $copy->{'mirror'}{'is_set'}
188 0 132 if (index($k, "-") != -1 and $k eq $k2_dash)
194 60 72 if $k2_dash ne $k2_under
196 18 114 if (not ref $def->{'alias'} and length $def->{'alias'})
201 18 114 if ($self->_is_array($def->{'alias'}))
203 18 0 if scalar @{$def->{'alias'};}
208 114 18 unless exists $def->{'alias'}
209 132 0 unless scalar grep(/^$k2_dash$/, @{$$def{"alias"};})
210 60 72 unless scalar grep(/^$k2_under$/, @{$$def{"alias"};})
214 84 48 if (defined $def->{'default'} and ref $def->{'default'} || length $def->{'default'}) { }
223 24 108 if ($def->{'type'} eq 'string') { }
6 102 elsif ($def->{'type'} eq 'string-hash') { }
6 96 elsif ($def->{'type'} eq 'array' or $def->{'type'} eq 'file-array') { }
60 36 elsif ($def->{'type'} eq 'boolean') { }
0 36 elsif ($def->{'type'} eq 'hash') { }
18 18 elsif ($def->{'type'} eq 'code' and ref $def->{'code'} eq 'CODE') { }
12 6 elsif ($def->{'type'} eq 'integer') { }
0 6 elsif ($def->{'type'} eq 'decimal') { }
6 0 elsif ($def->{'type'} eq 'date' or $def->{'type'} eq 'datetime') { }
0 0 elsif ($def->{'type'} eq 'code') { }
0 0 elsif ($def->{'type'} eq 'file') { }
234 0 6 unless length $def->{'default'}
235 0 0 unless exists $def->{'min'} or exists $def->{'max'}
240 0 0 if (exists $def->{'code'} and ref $def->{'code'} eq "CODE" and ref($opts->{$k2_under} // "") ne "CODE")
251 0 0 unless length $def->{'default'}
271 0 0 unless exists $def->{'code'}
272 0 0 if ref $def->{'code'} ne "CODE"
280 6 126 if ($def->{'min'})
288 0 132 if ($def->{'re'} and ref $def->{'re'} ne "Regexp")
304 0 1 if ref $class
306 0 1 if scalar @_ and $self->_is_hash($_[0])
317 1 3 $def->{'name'} ? :
319 0 0 if (not !$p->{'required'} and $def->{'required'})
321 0 0 if ($def->{'type'} =~ /^(?:boolean|decimal|integer|string)/ and not length $v->{$f} or $def->{'type'} eq 'hash' || $def->{'type'} eq 'string-hash' and not scalar keys %{$$v{$f};} or $def->{'type'} eq "array" and not scalar @{$v->{$f};})
329 1 3 if ($def->{'re'}) { }
0 6 elsif ($def->{'type'} eq 'decimal' and not $v->{$f} =~ /^\d+(\.\d{1,12})?$/) { }
331 0 1 if ($def->{'type'} eq 'string' and length $v->{$f} and not $v->{$f} =~ /$def->{'re'}/) { }
1 0 elsif ($def->{'type'} eq 'array') { }
340 1 0 unless ($this =~ /$def->{'re'}/)
360 0 4 if ref $class
362 0 4 unless ref $classes
363 0 4 if scalar keys %$classes and not exists $classes->{$class}
365 0 4 unless scalar keys %$dict
369 68 20 unless exists $def->{'class'}
376 4 28 unless exists $classes->{$class}
381 32 0 if ($def->{'alias'} and scalar @{$def->{'alias'};})
392 0 4 unless exists $classes->{$class}
402 0 2 unless length $class
412 0 6 if $self->{'configured'}
414 0 6 if ref $_[0]
415 6 0 unless scalar @$conf
417 0 6 if ($INC{'threads.pm'} and not exists $INC{'forks.pm'})
422 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::TRY ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if defined $Nice::Try::LAST_VAL
0 6 if ($Nice::Try::WANTARRAY) { }
6 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 6 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 6 length $@ ? :
6 0 unless &Scalar::Util::blessed($@)
0 0 if ($Nice::Try::HAS_CATCH)
0 6 if ($Nice::Try::DIED)
425 0 0 if not defined $Nice::Try::WANTARRAY and scalar @Nice::Try::LAST_VAL
0 0 &$Nice::Try::CATCH ? :
0 0 if scalar @Nice::Try::VOID
0 0 if ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 elsif ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 if ($Nice::Try::WANTARRAY) { }
0 0 elsif (defined $Nice::Try::WANTARRAY) { }
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if $@
0 6 if (defined $Nice::Try::CATCH_DIED)
0 0 if (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__NEXT__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__LAST__') { }
0 0 elsif (defined $Nice::Try::RETVAL[0] and $Nice::Try::RETVAL[0] eq '__REDO__') { }
0 0 elsif (defined $Nice::Try::BREAK and $Nice::Try::BREAK eq 'return') { }
0 0 if ($Nice::Try::WANT eq 'LIST') { }
0 0 elsif ($Nice::Try::WANT eq 'VOID') { }
0 0 elsif ($Nice::Try::WANT eq 'OBJECT') { }
0 0 elsif ($Nice::Try::WANT eq 'REFSCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'SCALAR') { }
0 0 elsif ($Nice::Try::WANT eq 'BOOLEAN') { }
0 0 elsif ($Nice::Try::WANT eq 'CODE') { }
0 0 elsif ($Nice::Try::WANT eq 'HASH') { }
0 0 elsif ($Nice::Try::WANT eq 'ARRAY') { }
0 0 elsif ($Nice::Try::WANT eq 'GLOB') { }
0 0 $Nice::Try::WANTARRAY ? :
0 0 if (defined $Nice::Try::WANT and length $Nice::Try::WANT) { }
0 0 if (not defined $Nice::Try::BREAK or $Nice::Try::BREAK eq "return")
0 0 scalar @Nice::Try::VOID > 1 ? :
0 6 if (defined $Nice::Try::WANTARRAY || defined $Nice::Try::BREAK && $Nice::Try::BREAK eq 'return' and !&Scalar::Util::blessed($Nice::Try::RETVAL[0]) || &Scalar::Util::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[0]->isa('Nice::Try::SENTINEL')) { }
0 6 elsif (scalar @Nice::Try::VOID and !&Scalar::Util::blessed($Nice::Try::VOID[0]) || &Scalar::Util::blessed($Nice::Try::VOID[0]) && !$Nice::Try::VOID[0]->isa('Nice::Try::SENTINEL')) { }
0 0 if ($Nice::Try::BREAK eq 'next') { }
0 0 elsif ($Nice::Try::BREAK eq 'last') { }
0 0 elsif ($Nice::Try::BREAK eq 'redo') { }
0 6 if (defined $Nice::Try::BREAK)
0 6 scalar @Nice::Try::LAST_VAL > 1 ? :
438 0 6 unless $self->configure
442 0 6 unless $self->_is_hash($dict)
443 0 6 unless scalar keys %$dict
445 0 6 unless $self->_is_hash($opts)
446 0 6 unless scalar keys %$opts
448 0 6 unless $self->_is_array($params)
449 0 6 unless scalar @$params
452 0 6 unless $self->_is_array($required)
468 0 6 unless ($getopt->getoptions($opts, @$params))
470 0 0 if ref $usage eq "CODE"
476 0 0 if (exists $opts->{$key} and !(defined $opts->{$key} && length $opts->{$key}) || $opts->{$key} =~ /^[[:blank:]]*$/ || ref $opts->{$key} eq 'SCALAR' && (!length(${$opts->{$key};}) || ${$opts->{$key};} =~ /^[[:blank:]]*$/) || ref $opts->{$key} eq 'ARRAY' && !scalar(@{$opts->{$key};}))
529 0 1 if ref $class
532 0 1 unless $self->_is_hash($opts)
533 0 1 unless scalar keys %$opts
535 0 1 if scalar @_ and $self->_is_hash($_[0])
539 0 4 if ($ref eq 'hash') { }
1 3 elsif ($ref eq 'array') { }
3 0 elsif (not length $ref) { }
541 0 0 if scalar keys %{$$opts{$f};} > 0
545 1 0 if scalar @{$opts->{$f};} > 0
549 0 3 if length $opts->{$f}
571 25 0 unless length $opts->{$k} or $def->{'default'}
572 0 107 if ref $def ne "HASH"
574 2 105 if ($def->{'type'} eq 'date' || $def->{'type'} eq 'datetime' and length $opts->{$k}) { }
6 99 elsif ($def->{'type'} eq 'array') { }
6 93 elsif ($def->{'type'} eq 'hash' or $def->{'type'} eq 'string-hash') { }
54 39 elsif ($def->{'type'} eq 'boolean') { }
14 25 elsif ($def->{'type'} eq 'string') { }
7 18 elsif ($def->{'type'} eq 'integer' or $def->{'decimal'}) { }
0 18 elsif ($def->{'type'} eq 'file') { }
0 18 elsif ($def->{'type'} eq 'file-array') { }
577 0 2 unless defined $dt
578 2 0 if $dt
591 3 33 if (exists $def->{'mirror'} and exists $def->{'mirror'}{'value'})
596 41 13 $opts->{$k} ? :
605 6 1 if ($self->_is_scalar($opts->{$k})) { }
669 0 6 unless $self->SUPER::init(@_)
670 0 6 unless $self->{'dict'}
671 0 6 unless $self->{'aliases'}
672 0 6 unless $self->_is_hash($self->{'dict'})
673 0 6 unless $self->_is_hash($self->{'aliases'})
674 0 6 unless scalar keys %{$$self{"dict"};}
675 0 6 unless $self->_is_hash($self->{'data'})
679 0 6 unless ($call_offset > 0 and $call_data[0] ne $class and (caller $call_offset - 1)[0] eq $class)
684 6 0 if $call_data[9] or $call_offset > 0 and (caller $call_offset - 1)[0] ne $class
708 0 10 unless exists $self->{$method}
712 10 0 if (not exists $def->{'type'} && defined $def->{'type'}) { }
0 0 elsif ($def->{'type'} eq 'boolean' or $self->_is_object($self->{$f}) and $self->{$f}->isa('Module::Generic::Boolean')) { }
0 0 elsif ($def->{'type'} eq 'string' or &Scalar::Util::reftype($self->{$f}) eq 'SCALAR') { }
0 0 elsif ($def->{'type'} eq 'integer' or $def->{'type'} eq 'decimal') { }
0 0 elsif ($def->{'type'} eq 'date' or $def->{'type'} eq 'datetime') { }
0 0 elsif ($def->{'type'} eq 'array') { }
0 0 elsif ($def->{'type'} eq 'hash' or $def->{'type'} eq 'string-hash') { }
0 0 elsif ($def->{'type'} eq 'code') { }
715 0 10 if $self->{'warnings'}
752 0 0 if $self->{'warnings'}
792 0 0 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
807 66 153 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
824 234 87 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
841 6 1 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
857 75 0 ref $self->{'ITERATOR'} ? :
865 0 0 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
881 114 0 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
896 18 0 if (@_)
926 6 0 if @_
932 12 0 unless ($call_offset > 0 and $call_data[0] ne $class and (caller $call_offset - 1)[0] eq $class)
938 0 0 if $call_data[9] or $call_offset > 0 and (caller $call_offset - 1)[0] ne $class
948 0 6 if (&Scalar::Util::reftype($dict) ne 'HASH') { }
0 6 elsif (not scalar keys %$dict) { }
967 0 6 if (&Scalar::Util::reftype($aliases) ne "HASH")
1014 92 160 if ($enabled and exists $aliases->{$key}) { }
1021 0 92 unless ($self->_is_array($def->{'alias'}))
1023 0 0 if $self->{'warnings'}
1033 0 92 if (&Scalar::Util::reftype($alias) ne "ARRAY")
1035 0 0 if $self->{'warnings'}
1042 92 69 if $a eq $key