Branch Coverage

blib/lib/Getopt/Euclid.pm
Criterion Covered Total %
branch 232 274 84.6


line true false branch
99 0 0 if $has_run or $^C
110 65 3 unless $defer
113 1 67 if $^C
116 4 63 unless _get_pod_names()
129 60 3 unless $defer
142 0 64 unless open my $pod_fh, '>', \$pod_string
148 67 0 unless ($$args{-'strict'})
155 6 61 if (-e $pod_file)
157 0 6 unless open my $in, '<', $pod_file
161 4 2 unless ($first_line =~ /$skip_keyword/)
171 63 4 unless ($got_pod_file)
175 63 4 if $pod_string
191 64 6 unless ($has_processed_pod)
197 2 55 if (defined $options)
198 1 1 if (exists $$options{-'minimal_keys'})
201 1 1 if (exists $$options{-'vars'})
209 0 57 if (first sub { $_ eq '--man'; } , @$args) { }
0 57 elsif (first sub { $_ eq '--usage'; } , @$args) { }
0 57 elsif (first sub { $_ eq '--help'; } , @$args) { }
0 57 elsif (first sub { $_ eq '--version'; } , @$args) { }
0 57 elsif (first sub { $_ eq '--podfile'; } , @$args) { }
242 7 50 if (my $error = _doesnt_match($matcher, $argv, $all_args_ref))
249 1 100 unless exists $ARGV{$req}
252 1 0 @missing == 1 ? :
1 49 if @missing
272 4 256 if ($repeatable)
281 215 46 $var_count == 1 ? :
0 261 $var_count == 0 ? :
289 14 467 if ($false_vals and $arg_flag =~ /\A $false_vals \z/msx)
290 1 13 $variant_val ? :
293 25 456 if ($repeatable) { }
298 54 427 if $vars_prefix
301 28 233 if ($vars_prefix)
310 3 38 if ($vars_prefix)
316 3 14 if ($$arg_info{'is_repeatable'} or $arg_name =~ />\.\.\./) { }
320 1 13 if (keys %{$$arg_info{'var'};} > 1)
330 6 35 if ($minimal_keys)
340 0 1 unless -e $0
343 0 1 unless open my $out_fh, '>', $pod_file
418 63 1 -e $0 ? :
419 51 1 $2 ? :
425 14 50 unless (defined $SCRIPT_VERSION)
428 14 50 unless (defined $SCRIPT_VERSION)
429 13 1 -e $0 ? :
439 51 0 unless defined $req_name
445 55 0 unless defined $opt_name
456 22 106 unless defined $name_re
489 42 9 if ($opt_name)
490 33 9 if $arg_summary
509 40 11 if ($req_name || '') =~ /\S/
511 42 9 if ($opt_name || '') =~ /\S/
518 36 15 if $licence
544 41 497 if ($minimal_keys)
546 1 40 if $$seen{$minimal}
571 246 235 unless $$arg{'src'} =~ s/^ =for \s+ Euclid\b [^\n]* \s* (.*) \z//imsx
584 8 227 if (@false_vals)
594 1 397 unless ($$arg{'name'} =~ /\Q<$var>\E/msx)
600 2 395 if ($field eq 'type.error') { }
234 161 elsif ($field eq 'type') { }
153 8 elsif ($field eq 'default' or $field eq 'opt_default') { }
1 7 elsif ($field eq 'excludes.error') { }
6 1 elsif ($field eq 'excludes') { }
607 18 216 if ($comma and length $constraint) { }
39 177 elsif (length $constraint) { }
611 0 18 unless $$arg{'var'}{$var}{'constraint'} = eval "sub{ $constraint }"
615 0 39 unless $$arg{'var'}{$var}{'constraint'} = eval "sub{ \$_[0] $constraint }"
623 4 173 $matchtype =~ m[\A\s*/.*/\s*\z]msx ? :
1 176 unless $$arg{'var'}{$var}{'constraint'} = $matchtype =~ m[\A\s*/.*/\s*\z]msx ? sub { 1; } : $std_constraint_for{$matchtype}
629 1 152 unless eval "\$val = $val; 1"
633 2 150 exists $$arg{$has_field} ? :
637 8 144 if ($field eq 'opt_default')
639 1 7 if ($$arg{'name'} =~ /^</msx)
644 1 6 unless ($$arg{'name'} =~ /\Q[<$var>]\E/msx)
656 1 7 if ($var eq $excl_var)
668 6 1 if $$arg{'has_default'}
669 0 7 if $$arg{'has_opt_default'}
672 1 227 if ($info =~ /\G \s* ([^\s\0\1] [^\n]*) /cgmsx)
683 1 6 unless (exists $all_var_list{$excl_var})
690 3 481 if (exists $$arg{'var'}{$var}{$type} and exists $excluded_by_def{$var}{$type})
693 2 1 if ($$arg{"has_$type"} == 0)
714 9 378 if ($val =~ /[\$\@\%]/) { }
717 9 1 if (not ref $s) { }
721 1 10 if $var_name =~ /main(?:'|::)/
726 1 9 if $new_name eq $var_name
754 2 11 unless $tmp =~ /^[\$\@\%]+[_a-z]/i
772 0 97 if ref $arg_ref ne 'HASH'
797 5 7 if ($error =~ /\A ((\W) (\w) (\w+))/msx)
800 2 3 unless _doesnt_match($matcher, $argv, $arg_specs_ref)
807 30 4 unless $error =~ /\A [\s\0\1]* ($$arg_spec_ref{'generic_matcher'})/msx and $bad_type
838 286 0 if (ref $arg eq 'HASH') { }
840 35 277 if (ref $var eq 'ARRAY') { }
847 0 0 if (ref $arg eq 'ARRAY') { }
867 266 46 if $var_name
876 3 10 if (exists $seen_vars{$var_name} and exists $seen_vars{$excluded_var})
880 1 2 if (exists $$var{'excludes_error'}) { }
900 117 35 unless exists $ARGV{$arg_name} or ($$arg_specs{'has_default'} or $$arg_specs{'has_opt_default'})
917 258 0 if (exists $ARGV{$arg_name})
919 229 29 if (ref $entry eq 'HASH' and defined $$entry{$var}) { }
0 58 elsif (ref $entry ne 'HASH' and defined $entry) { }
921 35 194 ref $$entry{$var} eq 'ARRAY' ? :
927 5 324 if ($$arg_vars{'constraint'} and not $$arg_vars{'constraint'}($val))
937 0 0 ref $entry eq 'ARRAY' ? :
943 0 0 if ($$arg_vars{'constraint'} and not $$arg_vars{'constraint'}($val))
949 0 0 unless defined $ARGV{$arg_name}
958 12 1 unless exists $$arg_vars{'default'} or exists $$arg_vars{'opt_default'}
961 2 15 exists $$arg_vars{'opt_default'} ? :
968 35 223 unless (@{$ARGV{$arg_name};})
973 5 32 unless exists $$arg_vars{'default'}
977 3 2 if (exists $seen_vars{$excl_var})
994 3 6 if ($var_error) { }
1039 4 343 $type =~ m[\A\s*/.*/\s*\z]msx ? :
0 347 unless my $matcher = $type =~ m[\A\s*/.*/\s*\z]msx ? eval "qr$type" : $std_matcher_for{$type}
1044 38 309 $var_rep ? :
1049 167 268 unless ($regex =~ s[ < (.*?) >(\.\.\.|) ](my($var_name, $var_rep) = ($1, $2); $var_name =~ s/(\s+)\[\\s\\0\\1]\*/$1/gmsx; my $type = $$arg{'var'}{$var_name}{'type'} || ''; $$arg{'placeholders'}{$var_name} = undef; _fail("Unknown type ($type) in specification: $arg_name") unless my $matcher = $type =~ m[\A\s*/.*/\s*\z]msx ? eval "qr$type" : $std_matcher_for{$type}; $var_rep ? "(?:[\\s\\0\\1]*$no_match($matcher)(?{push \@{(\$ARGV{q{$arg_name}}||=[{}])->[-1]{q{$var_name}}}, \$^N}))+" : "(?:$no_match($matcher)(?{(\$ARGV{q{$arg_name}}||=[{}])->[-1]{q{$var_name}} = \$^N}))";)egmsx)
1053 6 429 if ($$arg{'is_repeatable'}) { }
1056 8 421 $$arg{'false_vals'} ? :
1071 4 343 $type =~ m[\A\s*/.*/\s*\z]msx ? :
1095 0 0 if ($paged)
1097 0 0 unless eval { do { require IO::Pager::Page } }
1101 0 0 unless open my $parser_in, '<', \$pod
1113 296 187 if ($name =~ /[<>]/) { }
1117 437 382 unless $s =~ /[<>]/
1119 2 380 if ($s =~ /[<>]/)
1123 367 13 unless exists $var_names{$s}
1140 37 762 if $arg_desc[0] =~ /\A (< [^>]+ >)/msx
1150 1167 1887 if ($arg_desc_without =~ s/ \[ [^][]* \] //msx)
1153 1167 1887 if ($arg_desc_with =~ / [[(] ([^][()]*) [])] /msx)
1172 0 542 unless length $a <=> length $b
1182 13 32 ref $value ? :
1213 0 67 if ($has_run)
1220 4 63 if ($caller[1] =~ /[.]pm \z/msx)
1226 0 4 if *{"$caller[0]::import";}{'CODE'}
1236 62 1 if -e $0
1255 132 340 if (exists $$var{$default_type}) { }
1256 1 131 if (ref $$var{$default_type} eq 'ARRAY') { }
131 0 elsif (ref $$var{$default_type} eq '') { }
1269 1 435 if ($item_spec =~ /(\S+(\.(?:opt_)?default))/)