Branch Coverage

blib/lib/Getopt/Class.pm
Criterion Covered Total %
branch 143 372 38.4


line true false branch
39 0 6 unless $self->_is_hash($param)
48 0 6 unless $self->_is_hash($dict)
89 0 96 if (index($k, "-") != -1 and $k eq $k2_dash)
95 24 72 if $k2_dash ne $k2_under
97 18 78 if (not ref $def->{'alias'} and length $def->{'alias'})
102 18 78 if ($self->_is_array($def->{'alias'}))
104 18 0 if scalar @{$def->{'alias'};}
109 78 18 unless exists $def->{'alias'}
110 96 0 unless scalar grep(/^$k2_dash$/, @{$$def{"alias"};})
111 24 72 unless scalar grep(/^$k2_under$/, @{$$def{"alias"};})
115 48 48 if (length $def->{'default'}) { }
124 24 72 if ($def->{'type'} eq 'string') { }
6 66 elsif ($def->{'type'} eq 'string-hash') { }
6 60 elsif ($def->{'type'} eq 'array' or $def->{'type'} eq 'file-array') { }
24 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') { }
135 0 6 unless length $def->{'default'}
136 0 0 unless exists $def->{'min'} or exists $def->{'max'}
145 0 0 unless length $def->{'default'}
165 0 0 unless exists $def->{'code'}
166 0 0 if ref $def->{'code'} ne "CODE"
174 6 90 if ($def->{'min'})
182 0 96 if ($def->{'re'} and ref $def->{'re'} ne "Regexp")
198 0 1 if ref $class
200 0 1 if scalar @_ and $self->_is_hash($_[0])
211 1 3 $def->{'name'} ? :
213 0 0 if (not !$p->{'required'} and $def->{'required'})
215 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};})
223 1 3 if ($def->{'re'}) { }
0 6 elsif ($def->{'type'} eq 'decimal' and not $v->{$f} =~ /^\d+(\.\d{1,12})?$/) { }
225 0 1 if ($def->{'type'} eq 'string' and length $v->{$f} and not $v->{$f} =~ /$def->{'re'}/) { }
1 0 elsif ($def->{'type'} eq 'array') { }
234 1 0 unless ($this =~ /$def->{'re'}/)
254 0 4 if ref $class
256 0 4 unless ref $classes
257 0 4 if scalar keys %$classes and not exists $classes->{$class}
259 0 4 unless scalar keys %$dict
263 44 20 unless exists $def->{'class'}
270 4 28 unless exists $classes->{$class}
275 32 0 if ($def->{'alias'} and scalar @{$def->{'alias'};})
286 0 4 unless exists $classes->{$class}
296 0 2 unless length $class
306 0 6 if $self->{'configured'}
308 0 6 if ref $_[0]
309 6 0 unless scalar @$conf
311 0 6 if ($INC{'threads.pm'} and not exists $INC{'forks.pm'})
316 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)
319 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 (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 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 unless (defined $Nice::Try::BREAK)
0 6 if (defined $Nice::Try::WANTARRAY and !&Scalar::Util::blessed($Nice::Try::RETVAL[0]) || &Scalar::Util::blessed($Nice::Try::RETVAL[0]) && !$Nice::Try::RETVAL[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 ? :
332 0 6 unless $self->configure
336 0 6 unless $self->_is_hash($dict)
337 0 6 unless scalar keys %$dict
339 0 6 unless $self->_is_hash($opts)
340 0 6 unless scalar keys %$opts
342 0 6 unless $self->_is_array($params)
343 0 6 unless scalar @$params
346 0 6 unless $self->_is_array($required)
362 0 6 unless ($getopt->getoptions($opts, @$params))
364 0 0 if ref $usage eq "CODE"
370 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};}))
423 0 1 if ref $class
426 0 1 unless $self->_is_hash($opts)
427 0 1 unless scalar keys %$opts
429 0 1 if scalar @_ and $self->_is_hash($_[0])
433 0 4 if ($ref eq 'hash') { }
1 3 elsif ($ref eq 'array') { }
3 0 elsif (not length $ref) { }
435 0 0 if scalar keys %{$$opts{$f};} > 0
439 1 0 if scalar @{$opts->{$f};} > 0
443 0 3 if length $opts->{$f}
465 25 0 unless length $opts->{$k} or $def->{'default'}
466 0 71 if ref $def ne "HASH"
468 2 69 if ($def->{'type'} eq 'date' || $def->{'type'} eq 'datetime' and length $opts->{$k}) { }
6 63 elsif ($def->{'type'} eq 'array') { }
6 57 elsif ($def->{'type'} eq 'hash' or $def->{'type'} eq 'string-hash') { }
18 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') { }
471 0 2 unless defined $dt
472 2 0 if $dt
485 8 10 $opts->{$k} ? :
494 6 1 if ($self->_is_scalar($opts->{$k})) { }
555 0 6 unless $self->SUPER::init(@_)
556 0 6 unless $self->{'dict'}
557 0 6 unless $self->{'aliases'}
558 0 6 unless $self->_is_hash($self->{'dict'})
559 0 6 unless $self->_is_hash($self->{'aliases'})
560 0 6 unless scalar keys %{$$self{"dict"};}
561 0 6 unless $self->_is_hash($self->{'data'})
565 0 6 unless ($call_offset > 0 and $call_data[0] ne $class and (caller $call_offset - 1)[0] eq $class)
570 6 0 if $call_data[9] or $call_offset > 0 and (caller $call_offset - 1)[0] ne $class
592 0 10 unless exists $self->{$method}
596 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') { }
599 0 10 if $self->{'warnings'}
636 0 0 if $self->{'warnings'}
675 0 0 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
690 18 117 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
707 240 62 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
724 6 1 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
740 63 0 ref $self->{'ITERATOR'} ? :
748 0 0 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
764 126 0 if (caller eq 'Getopt::Class::Value' or not $self->{'enable'}) { }
779 18 0 if (@_)
808 6 0 if @_
814 12 0 unless ($call_offset > 0 and $call_data[0] ne $class and (caller $call_offset - 1)[0] eq $class)
820 0 0 if $call_data[9] or $call_offset > 0 and (caller $call_offset - 1)[0] ne $class
830 0 6 if (&Scalar::Util::reftype($dict) ne 'HASH') { }
0 6 elsif (not scalar keys %$dict) { }
849 0 6 if (&Scalar::Util::reftype($aliases) ne "HASH")
896 53 121 if ($enabled and exists $aliases->{$key}) { }
903 0 53 unless ($self->_is_array($def->{'alias'}))
905 0 0 if $self->{'warnings'}
915 0 53 if (&Scalar::Util::reftype($alias) ne "ARRAY")
917 0 0 if $self->{'warnings'}
924 53 30 if $a eq $key