Branch Coverage

blib/lib/Getopt/Euclid.pm
Criterion Covered Total %
branch 231 274 84.3


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 214 46 $var_count == 1 ? :
0 260 $var_count == 0 ? :
289 14 466 if ($false_vals and $arg_flag =~ /\A $false_vals \z/msx)
290 1 13 $variant_val ? :
293 25 455 if ($repeatable) { }
298 54 426 if $vars_prefix
301 28 232 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 ? :
424 14 50 unless (defined $SCRIPT_VERSION)
427 14 50 unless (defined $SCRIPT_VERSION)
428 13 1 -e $0 ? :
437 51 0 unless defined $req_name
443 55 0 unless defined $opt_name
454 22 106 unless defined $name_re
487 42 9 if ($opt_name)
488 33 9 if $arg_summary
507 40 11 if ($req_name || '') =~ /\S/
509 42 9 if ($opt_name || '') =~ /\S/
516 36 15 if $licence
542 41 497 if ($minimal_keys)
546 1 40 if $seen->{$minimal}
569 248 238 unless $arg->{'src'} =~ s/^ =for \s+ Euclid\b [^\n]* \s* (.*) \z//imsx
582 8 230 if (@false_vals)
592 1 402 unless ($arg->{'name'} =~ /\Q<$var>\E/msx)
598 2 400 if ($field eq 'type.error') { }
238 162 elsif ($field eq 'type') { }
154 8 elsif ($field eq 'default' or $field eq 'opt_default') { }
1 7 elsif ($field eq 'excludes.error') { }
6 1 elsif ($field eq 'excludes') { }
605 18 220 if ($comma and length $constraint) { }
38 182 elsif (length $constraint) { }
609 0 18 unless $arg->{'var'}{$var}{'constraint'} = eval "sub{ $constraint }"
614 0 38 unless $arg->{'var'}{$var}{'constraint'} = eval "sub{ \$_[0] $constraint }"
621 4 178 $matchtype =~ m[\A\s*/.*/\s*\z]msx ? :
1 181 unless $arg->{'var'}{$var}{'constraint'} = $matchtype =~ m[\A\s*/.*/\s*\z]msx ? sub { 1; } : $std_constraint_for{$matchtype}
627 1 153 unless eval "\$val = $val; 1"
632 2 151 exists $arg->{$has_field} ? :
635 7 146 if ($field eq "opt_default")
637 1 6 if ($arg->{'name'} =~ /^
642 1 5 unless ($arg->{'name'} =~ /\Q[<$var>]\E/msx)
654 1 7 if ($var eq $excl_var)
666 6 1 if $arg->{'has_default'}
667 0 7 if $arg->{'has_opt_default'}
670 1 230 if ($info =~ /\G \s* ([^\s\0\1] [^\n]*) /cgmsx)
681 1 6 unless (exists $all_var_list{$excl_var})
688 3 136 if (exists $arg->{'var'}{$var}{$type} and exists $excluded_by_def{$var}{$type})
691 2 1 if ($$arg{"has_$type"} == 0)
712 9 383 if ($val =~ /[\$\@\%]/) { }
715 9 1 if (not ref $s) { }
719 1 10 if $var_name =~ /main(?:'|::)/
724 1 9 if $new_name eq $var_name
752 2 11 unless $tmp =~ /^[\$\@\%]+[_a-z]/i
770 0 97 if ref $arg_ref ne "HASH"
795 5 7 if ($error =~ /\A ((\W) (\w) (\w+))/msx)
798 2 3 unless _doesnt_match($matcher, $argv, $arg_specs_ref)
805 50 4 unless $error =~ /\A [\s\0\1]* ($arg_spec_ref->{'generic_matcher'})/msx and $bad_type
836 286 0 if (ref $arg eq 'HASH') { }
838 35 277 if (ref $var eq 'ARRAY') { }
845 0 0 if (ref $arg eq 'ARRAY') { }
865 266 46 if $var_name
874 3 0 if (exists $seen_vars{$var_name} and exists $seen_vars{$excluded_var})
878 1 2 if (exists $var->{'excludes_error'}) { }
900 124 1 unless exists $ARGV{$arg_name} or ($arg_specs->{'has_default'} or $arg_specs->{'has_opt_default'})
915 258 0 if (exists $ARGV{$arg_name})
917 228 30 if (ref $entry eq 'HASH' and defined $entry->{$var}) { }
0 60 elsif (ref $entry ne 'HASH' and defined $entry) { }
919 35 193 ref $entry->{$var} eq 'ARRAY' ? :
925 5 323 if ($arg_vars->{'constraint'} and not $arg_vars->{'constraint'}->($val))
935 0 0 ref $entry eq 'ARRAY' ? :
941 0 0 if ($arg_vars->{'constraint'} and not $arg_vars->{'constraint'}->($val))
948 0 0 unless defined $ARGV{$arg_name}
957 13 1 unless exists $arg_vars->{'default'} or exists $arg_vars->{'opt_default'}
961 2 15 exists $arg_vars->{'opt_default'} ? :
966 35 227 unless (@{$ARGV{$arg_name};})
971 5 31 unless exists $arg_vars->{'default'}
975 3 2 if (exists $seen_vars{$excl_var})
992 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}
1041 38 309 $var_rep ? :
1046 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)
1050 6 429 if ($arg->{'is_repeatable'}) { }
1056 8 421 $arg->{'false_vals'} ? :
1069 4 343 $type =~ m[\A\s*/.*/\s*\z]msx ? :
1091 0 0 if ($paged)
1093 0 0 unless eval { do { require IO::Pager::Page } }
1097 0 0 unless open my $parser_in, "<", \$pod
1109 303 185 if ($name =~ /[<>]/) { }
1113 449 393 unless $s =~ /[<>]/
1115 2 391 if ($s =~ /[<>]/)
1119 378 13 unless exists $var_names{$s}
1136 37 761 if $arg_desc[0] =~ /\A (< [^>]+ >)/msx
1146 1164 1883 if ($arg_desc_without =~ s/ \[ [^][]* \] //msx)
1149 1164 1883 if ($arg_desc_with =~ / [[(] ([^][()]*) [])] /msx)
1168 0 536 unless length $a <=> length $b
1178 13 32 ref $value ? :
1209 0 67 if ($has_run)
1216 4 63 if ($caller[1] =~ /[.]pm \z/msx)
1222 0 4 if *{"$caller[0]::import";}{"CODE"}
1232 62 1 if -e $0
1251 132 340 if (exists $var->{$default_type}) { }
1252 1 131 if (ref $var->{$default_type} eq 'ARRAY') { }
131 0 elsif (ref $var->{$default_type} eq '') { }
1265 1 435 if ($item_spec =~ /(\S+(\.(?:opt_)?default))/)