Branch Coverage

lib/Getopt/Class.pm
Criterion Covered Total %
branch 157 326 48.1


line true false branch
38 0 6 unless $self->_is_hash($param)
39 0 6 unless $self->SUPER::init($param)
46 0 6 unless $self->_is_hash($dict)
83 0 114 if $def->{'__no_value_assign'}
86 42 72 if ($def->{'type'} eq "boolean" and not exists $def->{'mirror'})
90 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)}) { }
111 18 24 if (defined $mirror_opt)
121 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'} ? :
129 18 0 if exists $def->{'default'} and defined $def->{'default'}
131 0 18 if (ref $val eq 'CODE') { }
148 18 0 if exists $def->{'mirror'}{'default'}
155 0 0 if $def->{'mirror'}{'is_set'}
163 0 3 if $copy->{'mirror'}{'is_set'}
186 0 132 if (index($k, "-") != -1 and $k eq $k2_dash)
192 60 72 if $k2_dash ne $k2_under
194 18 114 if (not ref $def->{'alias'} and length $def->{'alias'})
199 18 114 if ($self->_is_array($def->{'alias'}))
201 18 0 if scalar @{$def->{'alias'};}
206 114 18 unless exists $def->{'alias'}
207 132 0 unless scalar grep(/^$k2_dash$/, @{$$def{"alias"};})
208 60 72 unless scalar grep(/^$k2_under$/, @{$$def{"alias"};})
212 84 48 if (defined $def->{'default'} and ref $def->{'default'} || length $def->{'default'}) { }
214 0 84 if ($def->{'type'} eq 'file') { }
216 0 0 if (not ref $def->{'default'} or $self->_can_overload($def->{'default'}, "\"\""))
231 24 108 if ($def->{'type'} eq 'string' or $def->{'type'} eq 'scalar') { }
6 102 elsif ($def->{'type'} eq 'string-hash') { }
6 96 elsif ($def->{'type'} eq 'array' or $def->{'type'} eq 'file-array' or $def->{'type'} eq 'uri-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' or $def->{'type'} eq 'float' or $def->{'type'} eq 'number') { }
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') { }
0 0 elsif ($def->{'type'} eq 'uri') { }
244 0 6 unless length $def->{'default'}
245 0 0 unless exists $def->{'min'} or exists $def->{'max'}
250 0 0 if (exists $def->{'code'} and ref $def->{'code'} eq "CODE" and ref($opts->{$k2_under} // "") ne "CODE")
261 0 0 unless length $def->{'default'}
281 0 0 unless exists $def->{'code'}
282 0 0 if ref $def->{'code'} ne "CODE"
294 6 126 if ($def->{'min'})
302 0 132 if ($def->{'re'} and ref $def->{'re'} ne "Regexp")
318 0 1 if ref $class
320 0 1 if scalar @_ and $self->_is_hash($_[0])
331 1 3 $def->{'name'} ? :
333 0 0 if (not !$p->{'required'} and $def->{'required'})
335 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};})
343 1 3 if ($def->{'re'}) { }
0 6 elsif ($def->{'type'} eq 'decimal' and not $v->{$f} =~ /^\d+(\.\d{1,12})?$/) { }
345 0 1 if ($def->{'type'} eq 'string' and length $v->{$f} and not $v->{$f} =~ /$def->{'re'}/) { }
1 0 elsif ($def->{'type'} eq 'array') { }
354 1 0 unless ($this =~ /$def->{'re'}/)
374 0 4 if ref $class
376 0 4 unless ref $classes
377 0 4 if scalar keys %$classes and not exists $classes->{$class}
379 0 4 unless scalar keys %$dict
383 68 20 unless exists $def->{'class'}
390 4 28 unless exists $classes->{$class}
395 32 0 if ($def->{'alias'} and scalar @{$def->{'alias'};})
406 0 4 unless exists $classes->{$class}
416 0 2 unless length $class
426 0 6 if $self->{'configured'}
428 0 6 if ref $_[0]
429 6 0 unless scalar @$conf
438 0 6 if ($@)
454 0 6 unless $self->configure
458 0 6 unless $self->_is_hash($dict)
459 0 6 unless scalar keys %$dict
461 0 6 unless $self->_is_hash($opts)
462 0 6 unless scalar keys %$opts
464 0 6 unless $self->_is_array($params)
465 0 6 unless scalar @$params
468 0 6 unless $self->_is_array($required)
484 0 6 unless ($getopt->getoptions($opts, @$params))
486 0 0 if ref $usage eq "CODE"
492 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};}))
545 0 1 if ref $class
548 0 1 unless $self->_is_hash($opts)
549 0 1 unless scalar keys %$opts
551 0 1 if scalar @_ and $self->_is_hash($_[0])
555 0 4 if ($ref eq 'hash') { }
1 3 elsif ($ref eq 'array') { }
3 0 elsif (not length $ref) { }
557 0 0 if scalar keys %{$$opts{$f};} > 0
561 1 0 if scalar @{$opts->{$f};} > 0
565 0 3 if length $opts->{$f}
587 25 0 unless length $opts->{$k} or $def->{'default'}
588 0 107 if ref $def ne "HASH"
590 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' or $def->{'type'} eq 'scalar') { }
7 18 elsif ($def->{'type'} eq 'integer' or $def->{'decimal'}) { }
0 18 elsif ($def->{'type'} eq 'file' and length($opts->{$k} // '')) { }
0 18 elsif ($def->{'type'} eq 'file-array') { }
0 18 elsif ($def->{'type'} eq 'uri') { }
0 18 elsif ($def->{'type'} eq 'uri-array') { }
593 0 2 unless defined $dt
594 2 0 if $dt
607 3 33 if (exists $def->{'mirror'} and exists $def->{'mirror'}{'value'})
612 41 13 $opts->{$k} ? :
621 6 1 if ($self->_is_scalar($opts->{$k})) { }
645 0 0 exists $def->{'package'} ? :
650 0 0 exists $def->{'package'} ? :
699 0 6 unless $self->SUPER::init(@_)
700 0 6 unless $self->{'dict'}
701 0 6 unless $self->{'aliases'}
702 0 6 unless $self->_is_hash($self->{'dict'})
703 0 6 unless $self->_is_hash($self->{'aliases'})
704 0 6 unless scalar keys %{$$self{"dict"};}
705 0 6 unless $self->_is_hash($self->{'data'})
709 0 6 unless ($call_offset > 0 and $call_data[0] ne $class and (caller $call_offset - 1)[0] eq $class)
714 6 0 if $call_data[9] or $call_offset > 0 and (caller $call_offset - 1)[0] ne $class
739 0 10 unless exists $self->{$method}
743 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 $def->{'type'} eq 'scalar' or builtin::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') { }
0 0 elsif ($def->{'type'} eq 'file') { }
0 0 elsif ($def->{'type'} eq 'file-array') { }
0 0 elsif ($def->{'type'} eq 'uri') { }
0 0 elsif ($def->{'type'} eq 'uri-array') { }
0 0 elsif ($def->{'type'} eq 'uri') { }
0 0 elsif ($def->{'type'} eq 'uri-array') { }
746 0 10 if $self->{'warnings'}
788 0 0 if (@_)
801 0 0 exists $def->{'package'} ? :
806 0 0 exists $def->{'package'} ? :
807 0 0 if (@_)
824 0 0 if (@_)
837 0 0 if $self->{'warnings'}
876 0 0 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
891 78 1299 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
908 514 861 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
925 0 0 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
941 0 0 ref $self->{'ITERATOR'} ? :
949 6 1 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
965 126 0 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
980 18 0 if (@_)
1009 6 0 if @_
1015 12 0 unless ($call_offset > 0 and $call_data[0] ne $class and (caller $call_offset - 1)[0] eq $class)
1021 0 0 if $call_data[9] or $call_offset > 0 and (caller $call_offset - 1)[0] ne $class
1031 0 6 if (builtin::reftype($dict) ne 'HASH') { }
0 6 elsif (not scalar keys %$dict) { }
1050 0 6 if (builtin::reftype($aliases) ne "HASH")
1096 92 160 if ($enabled and exists $aliases->{$key}) { }
1103 0 92 unless ($self->_is_array($def->{'alias'}))
1105 0 0 if $self->{'warnings'}
1115 0 92 if (builtin::reftype($alias) ne "ARRAY")
1117 0 0 if $self->{'warnings'}
1123 92 69 if $a eq $key