Branch Coverage

blib/lib/Getopt/Declare.pm
Criterion Covered Total %
branch 147 288 51.0


line true false branch
11 5 0 if @_ < 2 or not length $defn
13 0 0 unless $_[2]
19 0 0 if $Getopt::Declare::AUTOLOAD =~ /::DESTROY$/
85 0 38 if $seen{$name} or not $stdtype{$name}
97 1 29 if $stdtype{$name}{'action'}
101 2 34 if $stdtype{$name}{'action'}
110 0 3 unless ($_[1] =~ /\S/)
112 3 0 if $_[1] and not $_[3]
113 0 3 if $_[1] and $_[3]
114 1 2 if $_[2]
132 12 24 $trailing ? :
134 0 36 if (not $stdtype and $$self{'type'} =~ m[\A:/([^/]+)/\Z])
135 0 36 unless ($stdtype)
141 36 0 unless ($stdtype =~ s/\%F//)
172 23 11 if $_[2] > 1
181 32 4 unless $_[0]{'nows'}
193 0 2 defined $trailing && !$trailing ? :
206 1 1 if (@actions)
224 0 2 if $_[2] > 1
255 12 0 if $_[2] > 1
264 9 3 unless $_[0]{'nows'}
278 18 0 if exists $helpcmd{$_}
285 3 0 if exists $versioncmd{$_}
293 3 96 if not $negflagpat and @flags
300 3 12 if not $posflagpat and @flags
333 0 69 if ($spec =~ s/\A(\s*)\[/$1/) { }
0 69 elsif ($spec =~ s/\A\s*\]//) { }
346 34 35 if ($arg) { }
35 0 elsif ($spec =~ s/\A(\s*)((\\.|[^] \t\n[<])+)//) { }
348 0 34 unless $arg =~ /\A(\s*)(<)([a-zA-Z]\w*)(:[^>]+|)>/
353 2 32 if ($spec =~ s/\A\.\.\.//) { }
372 23 12 if ($first) { }
393 0 25 if exists $helpcmd{$$self{'flag'}}
394 0 25 if exists $versioncmd{$$self{'flag'}}
408 0 27 Getopt::Declare::_nocase() || $$self{'nocase'} ? :
410 26 1 !($$self{'repeatable'} || $$owner{'_internal'}{'all_rep'}) ? :
414 0 25 if ($flag and $clump == 1 && !($flag =~ /\A[^a-z0-9]+[a-z0-9]\Z/i) || $clump < 3 && @{$$self{'args'};})
425 25 2 if ($flag) { }
2 0 elsif (not +(Getopt::Declare::ScalarArg::stdtype($$self{'args'}[0]{'type'}) || '') =~ /\%F/) { }
453 0 24 unless defined $trailer[$i - 1]
456 24 3 if (@{$$self{'args'};})
472 25 2 if ($flag)
486 0 25 $$owner{'_internal'}{'mutex'}{$flag} ? :
503 3 24 if ($flag and $$self{'items'} == 0)
512 24 3 if ($flag =~ /\A([^a-z0-9]+)/i) { }
572 0 1 if @_ == 3 and !defined($_[2]) || $_[2] eq '-SKIP'
578 0 13 if ($_grammar =~ /\A(-[A-Z]+)+/)
583 0 0 unless $seen{$1}
584 0 0 if $predef or not $_grammar
608 0 39 if s/\A[ \t]*#.*\n//
612 3 36 if (/\A\s*\[\s*pvtype:/ and $_action = extract_codeblock($_, '[]'))
620 2 34 if ($_action = extract_codeblock()) { }
0 34 elsif (/\A(\s*[{].*)/) { }
626 0 2 unless eval 'no strict;my $ref = sub ' . $_check_action . ';1'
629 0 2 if ($#_args < 0)
644 25 9 if (s/\A(.*?\S.*?)(\t.*\n)//)
653 1 24 if $_lastdesc and $desc =~ s/\A\s*\[\s*ditto\s*\]/$_lastdesc/
670 0 9 if $decorator =~ /\[\s*repeatable\s*\]/
676 1 24 if ($_lastactions and $$_{'ditto'} and not @{$$_{'actions'};}) { }
686 0 0 unless length $$b{'flag'} <=> length $$a{'flag'} or $$b{'flag'} eq $$a{'flag'} and $#{$$b{'args'};} <=> $#{$$a{'args'};}
693 0 13 $_grammar =~ /\[\s*cluster:(.*)\s*\]/i ? :
0 13 $_grammar =~ /\[\s*cluster:\s*any\s*\]/i ? :
0 13 $_grammar =~ /\[\s*cluster:\s*flags?\s*\]/i ? :
0 13 $_grammar =~ /\[\s*cluster:\s*singles?\s*\]/i ? :
0 13 $_grammar =~ /\[\s*cluster:\s*none\s*\]/i ? :
720 0 13 if $main::Declare_debug
726 0 1 unless defined $self->parse($_[2])
1 12 if (@_ == 3) { }
727 0 12 unless defined $self->parse
741 0 0 unless open FILE, $_
742 0 0 if (-t FILE) { }
753 0 0 unless @found
754 0 0 unless $text
764 1 13 if (@_ > 1) { }
766 0 1 if (not defined $source) { }
0 1 elsif (ref $source eq 'CODE') { }
0 1 elsif (ref $source eq 'GLOB') { }
0 1 elsif (ref $source eq 'IO::Handle') { }
0 1 elsif (ref $source eq 'ARRAY') { }
778 0 0 if (-t *$source) { }
793 0 0 if (not $source->fileno and -t STDIN) { }
808 0 0 if (@$source == 1 and !defined($$source[0]) || $$source[0] eq '-BUILD' || $$source[0] eq '-SKIP') { }
0 0 elsif (@$source == 1 and $$source[0] eq '-STDIN') { }
0 0 elsif (@$source == 1 and $$source[0] eq '-CONFIG') { }
835 0 1 if length $source > 7
838 0 1 unless defined $_args
853 0 14 unless (eval $self->code($$self{'_internal'}{'caller'}))
855 0 0 if $@
881 0 0 unless eval 'no strict; my $ref = sub { ' . $expr . ' }; 1'
890 0 40 if $_[0]
901 0 34 if ($desc =~ /\[\s*no\s*case\s*\]/i)
903 0 3 if ($arg) { }
907 25 9 if (defined $arg)
909 0 25 if $desc =~ /.*\[\s*excludes:\s*(.*?)\]/i
911 0 25 if $desc =~ /.*\[\s*requires:\s*(.*?)\]/i
927 3 0 if $desc =~ s/\A\s*([^] \t\n]+)//
3 0 unless ($name)
928 0 3 unless $name
933 0 0 if $desc =~ s/\A\s*(:?)\s*([^] \t\n]+)// and $pat = $2
0 3 unless ($pat)
935 0 3 unless $pat
938 0 0 $pat ? :
0 3 if $desc =~ /\A\s*([^] \t\n])(\S*)/
948 0 2 if ($originaldesc =~ /\n.*\n/) { }
968 0 0 unless $$mref{$flag}
971 0 0 if $flag eq $otherflag
983 0 0 unless ($flag eq $excluded)
985 0 0 unless $$mref{$flag}
997 0 1 if ($main::VERSION) { }
999 0 1 if defined $exit_status
1009 0 1 if ($use_pager)
1016 0 1 if ($use_pager)
1021 0 1 if (defined $exit_status)
1046 0 43 if s/\A[ \t]*#.*\n//
1050 5 38 if (/\A\s*\[\s*pvtype:/ and extract_bracketed $_, '[{}]')
1057 3 35 if (extract_bracketed $_, '[{}]')
1059 0 3 unless defined $decfirst
1064 27 8 if (s/\A(.*?\S.*?\t+)(.*?\n)//)
1066 3 24 unless defined $decfirst
1075 0 27 if $desc =~ /\[\s*undocumented\s*\]/i
1078 14 0 if $uoff += 1 + length($2)
1084 2 25 if ($ditto) { }
0 25 elsif ($desc =~ /\A\s*\Z/) { }
1085 2 0 $lastdesc ? :
1091 27 0 if $spec =~ /\A\s*(\S+)/
1099 8 0 if (s/((?:(?!\[\s*pvtype:).)*)(\n|(?=\[\s*pvtype:))//)
1104 0 8 unless defined $decfirst or $desc =~ /\A\s*\Z/
1118 0 27 if ($$arg{'required'})
1133 3 0 unless ($$self{'_internal'}{'source'})
1136 3 0 if $helpcmd
1137 3 0 if $versioncmd
1138 3 0 unless $decfirst and $usage =~ /\A[ \t]*\n/
1140 3 0 unless $decfirst
1146 0 0 if wantarray
1152 0 0 if (ref $val eq 'ARRAY') { }
0 0 elsif (ref $val eq 'HASH') { }
1156 0 0 $nested || /^-/ ? :
1168 0 0 /^_/ ? :
1169 0 0 if wantarray
1178 15 0 $$self{'_internal'}{'clump'} ? :
1272 27 0 unless $$arg{'required'}
1276 0 0 if ($$self{'_internal'}{'mutex'}{$arg->name})
1288 0 27 if ($$arg{'requires'})
1303 0 15 if ($$self{'_internal'}{'strict'})