Branch Coverage

lib/App/Options.pm
Criterion Covered Total %
branch 157 442 35.5


line true false branch
364 9 0 if (not $default_option_processor)
366 2 7 $#args > -1 && ref $args[0] eq 'HASH' ? :
368 0 9 unless $#args % 2 == 1
372 2 7 if (defined $$init_args{'values'})
373 0 2 unless ref $$init_args{'values'} eq 'HASH'
408 9 0 if ($option_defs)
409 0 9 if ref $option_defs ne 'HASH'
417 0 6 if (ref $value eq '') { }
422 0 0 if ($arg =~ /^([^=]+)=(.*)$/) { }
0 0 elsif (not defined $$option_def{'default'}) { }
436 0 6 if (not defined $$option_def{'secure'} and $var =~ /(pass|password|passwd)$/)
441 0 9 if ($$init_args{'options'})
443 0 0 if (not defined $$option_defs{$var}{'secure'} and $var =~ /(pass|password|passwd)$/)
477 9 0 if (not $$init_args{'no_cmd_args'}) { }
481 0 0 $2 eq '' ? :
483 0 0 if ($$option_defs{$var} and $$option_defs{$var}{'secure'} and defined $$values{'security_policy_level'} and $$values{'security_policy_level'} >= 2)
490 0 9 if ($#ARGV >= 0 and $ARGV[0] eq '--')
493 0 9 if ($$values{'help'}) { }
0 9 elsif ($$values{'?'}) { }
0 9 elsif ($$values{'version'}) { }
506 0 9 if $debug_options
509 0 0 if $debug_options
522 9 0 if $prog_dir ne '/'
523 0 9 if $prog_dir eq ''
524 0 9 if $^O =~ /MSWin32/ and $prog_dir =~ m[^/]
535 0 9 if (not $prefix and $ENV{'PREFIX'})
542 6 3 unless ($prefix)
545 6 0 if $abs_prog_dir ne '/'
546 0 6 if ($abs_prog_dir =~ s[/bin$][]) { }
0 6 elsif ($abs_prog_dir =~ s[/cgi-bin.*$][]) { }
556 6 3 unless ($prefix)
559 6 0 if $prefix ne '/'
562 0 9 if $debug_options
573 8 1 unless ($app)
577 0 9 if $debug_options
581 9 0 if (not $$init_args{'no_option_file'}) { }
587 0 9 if $$values{'option_file'}
588 9 0 if $ENV{'HOME'} and $app ne 'app'
589 9 0 if $ENV{'HOME'}
590 9 0 if $app ne 'app'
592 9 0 if $app ne 'app'
602 0 9 if $debug_options
609 0 0 if $debug_options
612 0 0 if ($$values{'perl_restart'} and not $ENV{'MOD_PERL'} and not $ENV{'PERL_RESTART'})
621 9 0 if (not $$init_args{'no_env_vars'}) { }
623 0 9 if ($$init_args{'options'})
624 0 0 if ref $$init_args{'options'} ne 'ARRAY'
629 9 0 if ($option_defs)
633 0 9 if $debug_options
636 6 0 unless (defined $$values{$var})
638 6 0 unless ($$init_args{'no_env_vars'})
639 4 2 if ($option_defs and defined $$option_defs{$var}{'env'}) { }
640 0 4 if ($$option_defs{$var}{'env'} eq '') { }
651 6 2 if ($env_var and defined $ENV{$env_var})
653 0 6 if $debug_options >= 4
660 6 0 if (defined $value)
661 0 6 if ($value =~ /\{.*\}/) { }
662 0 0 defined $$values{$1} ? :
663 0 0 defined $ENV{$1} ? :
664 0 0 if $debug_options >= 4
668 0 6 if $debug_options >= 3
678 227 12 unless $env_var =~ /^APP_/
681 10 2 unless (defined $$values{$var})
682 0 0 if ($$option_defs{$var} and $$option_defs{$var}{'secure'} and defined $$values{'security_policy_level'} and $$values{'security_policy_level'} >= 2)
688 0 10 if $debug_options >= 3
695 0 0 if $debug_options
702 3 6 if ($$values{'prefix'}) { }
703 3 0 if ($prefix eq $$values{'prefix'}) { }
704 0 3 if $debug_options
707 0 0 if $debug_options
713 0 6 if $debug_options
720 9 0 if ($option_defs) { }
721 0 9 defined $$init_args{'options'} ? :
724 0 9 if $debug_options
727 0 6 unless (defined $$values{$var})
728 0 0 if (defined $$option_defs{$var} and defined $$option_defs{$var}{'default'} and $$option_defs{$var}{'secure'} and defined $$values{'security_policy_level'} and $$values{'security_policy_level'} >= 2)
735 0 0 if (defined $value)
736 0 0 if ($value =~ /\{.*\}/)
737 0 0 defined $$values{$1} ? :
738 0 0 defined $ENV{$1} ? :
739 0 0 if $debug_options >= 4
744 0 0 if $debug_options >= 3
750 0 0 if $debug_options
761 2 7 if (defined $$values{'perlinc'}) { }
762 2 0 if ($$values{'perlinc'}) { }
764 0 2 if ($debug_options >= 2)
770 0 0 if $debug_options >= 2
780 7 46 if ($incdir =~ /^$libdir/)
805 0 7 unless ($libdir_found)
807 0 0 if ($^V)
810 0 0 if (-d "$libdir/perl5") { }
0 0 elsif (-d "$libdir/perl") { }
818 0 0 if (-d "$prefix/share/perl")
824 0 7 if ($debug_options >= 2)
835 0 9 if ($debug_options >= 7)
838 0 0 if (defined $$values{$var}) { }
851 0 9 if ($show_version)
860 0 9 if ($show_help)
876 9 0 if ($option_defs)
880 6 0 unless $type
882 0 0 unless defined $value
883 0 0 if ($type eq 'integer') { }
0 0 elsif ($type eq 'float') { }
0 0 elsif ($type eq 'string') { }
0 0 elsif ($type eq 'boolean') { }
0 0 elsif ($type eq 'date') { }
0 0 elsif ($type eq 'datetime') { }
0 0 elsif ($type eq 'time') { }
0 0 elsif ($type =~ m[^/(.*)/$]) { }
884 0 0 unless ($value =~ /^-?[0-9_]+$/)
890 0 0 unless ($value =~ /^-?[0-9_]+\.?[0-9_]*([eE][+-]?[0-9_]+)?$/ or $value =~ /^-?\.[0-9_]+([eE][+-]?[0-9_]+)?$/)
900 0 0 unless ($value =~ /^[01]$/)
906 0 0 unless ($value =~ /^[0-9]{4}-[01][0-9]-[0-3][0-9]$/)
912 0 0 unless ($value =~ /^[0-9]{4}-[01][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]$/)
918 0 0 unless ($value =~ /^[0-2][0-9]:[0-5][0-9]:[0-5][0-9]$/)
925 0 0 unless ($value =~ /$regexp/)
932 6 0 if not $$option_defs{$var}{'required'} or defined $$values{$var}
939 0 9 if ($exit_status >= 0)
940 0 0 if ($$init_args{'print_usage'}) { }
956 0 8 if ($path_info and $path_info =~ m[^/([^/]+)])
958 0 0 if ($home_dir and -f "$home_dir/.app/$path_info_app.conf") { }
0 0 elsif (-f "$prog_dir/$path_info_app.conf") { }
0 0 elsif (-f "$prefix/etc/app/$path_info_app.conf") { }
971 8 0 unless ($app)
976 8 0 if (wantarray) { }
986 0 0 unless $values
987 0 0 unless $init_args
990 0 0 if (defined $$init_args{'args_description'}) { }
1001 0 0 if defined $$values{'show_all'}
1002 0 0 unless defined $show_all or defined $$init_args{'option'} or defined $$init_args{'options'}
1004 0 0 if ($$init_args{'options'})
1007 0 0 if ($$init_args{'option'})
1010 0 0 if ($show_all)
1017 0 0 if $option_seen{$var}
1019 0 0 if $var eq '?' or $var eq 'help'
1024 0 0 if not defined $secure and $var =~ /(pass|password|passwd)$/
1025 0 0 if defined $secure and defined $$values{'security_policy_level'}
1027 0 0 $val_desc ? :
0 0 $type eq 'boolean' ? :
1028 0 0 $secure ? :
0 0 defined $value ? :
1029 0 0 $type ? :
1030 0 0 $desc ? :
1042 0 0 if ($$values{'version_packages'})
1046 0 0 if ($package =~ /^[A-Z][A-Za-z0-9:_]*$/)
1050 0 0 if ($@)
1069 0 0 if ($$values{'version_packages'})
1071 0 0 unless defined $version_sys_packages
1074 0 0 if ($$values{'version_packages'})
1088 0 0 if ($$values{'version_packages'} and $show_version ne 'all') { }
1091 0 0 if ($package =~ /$package_pattern/)
1101 0 0 if ($show_module)
1104 0 0 unless $version
1121 0 45 if ($option_file =~ /\$\{prefix\}/)
1122 0 0 if ($$values{'prefix'}) { }
1130 0 45 if $debug_options
1131 9 36 if (open FILE, "< $option_file") { }
1132 0 9 if $debug_options
1140 189 261 if (s/^\s*\[(.*)\]\s*//) { }
1141 0 189 if $debug_options >= 6
1145 36 144 if ($cond =~ /^([^=]+)=(.*)$/) { }
1153 18 162 if ($value =~ m[^/(.*)/$]) { }
27 135 elsif ($var eq 'app' and $value eq '' || $value eq 'ALL') { }
1155 18 0 defined $$values{$var} ? :
9 9 !((defined $$values{$var} ? $$values{$var} : '') =~ /$regexp/) ? :
1156 0 0 $exclude ? :
0 18 if $debug_options >= 6
1162 0 0 $exclude ? :
0 27 if $debug_options >= 6
1167 108 27 defined $$values{$var} ? :
72 63 (defined $$values{$var} ? $$values{$var} : '') ne $value ? :
1168 0 0 defined $$values{$var} ? :
0 0 $exclude ? :
0 135 if $debug_options >= 6
1174 81 99 if $exclude
1177 0 0 $exclude ? :
0 189 if $debug_options >= 5
1178 90 99 if ($_) { }
1180 36 54 if $exclude
1189 0 0 $exclude_section ? :
0 261 if $debug_options >= 5
1191 54 261 if $exclude_section
1196 18 243 if /^$/
1199 243 0 if (/^([^\s=]+)\s*=\s*(.*)/)
1203 243 0 unless ($is_mod_perl)
1204 0 0 if ($var eq 'perl_restart' and $value and $value ne '1')
1206 0 0 unless ($ENV{$env_var})
1215 9 234 if ($value =~ /^<<(.*)/) { }
27 207 elsif ($value =~ /^<\s*(.+)/ or $value =~ /^(.+)\s*\|$/) { }
18 189 elsif ($value =~ s/\\\s*$//) { }
1219 9 18 if $_ =~ /^$heredoc_end\s*$/
1226 27 0 defined $$values{$1} ? :
1227 27 0 if (open FILE2, $value) { }
1238 18 18 if ($_ =~ s/\\\s*[\r\n]*$//) { }
1254 0 243 if $debug_options >= 6
1257 9 234 if ($var =~ /^ENV\{([^{}]+)\}$/) { }
193 41 elsif (not defined $$values{$var}) { }
1262 193 0 unless ($$init_args{'no_env_vars'})
1263 0 193 if ($option_defs and defined $$option_defs{$var} and defined $$option_defs{$var}{'env'}) { }
1264 0 0 if ($$option_defs{$var}{'env'} eq '') { }
1275 0 193 if ($env_var and defined $ENV{$env_var})
1277 0 0 if $debug_options >= 4
1283 193 0 if (defined $value)
1284 32 161 if ($value =~ /\{.*\}/)
1285 0 0 $1 eq 'prefix' ? :
24 0 defined $$values{$1} ? :
1286 4 4 defined $ENV{$1} ? :
1287 0 32 if $debug_options >= 4
1290 0 193 if $debug_options >= 3
1291 0 0 if ($$option_defs{$var} and $$option_defs{$var}{'secure'} and defined $$values{'security_policy_level'} and $$values{'security_policy_level'} >= 2 and not &file_is_secure($option_file))
1305 9 0 if ($$values{'flush_imports'})
1309 0 9 if ($$values{'import'})
1315 0 36 if $debug_options
1324 0 0 if ($^O =~ /MSWin32/) { }
1329 0 0 unless (defined $secure)
1331 0 0 if (not $mode & 256) { }
0 0 elsif ($mode & 63) { }
1343 0 0 unless (defined $secure)
1345 0 0 if ($uid >= 100 and $uid != $>) { }
0 0 elsif ($mode & 63) { }
1359 0 0 unless defined $secure