Branch Coverage

blib/script/greple
Criterion Covered Total %
branch 217 414 52.4


line true false branch
36 170 0 if (my $lib = abs_path($0) =~ s[/(?:script/|bin/)?\w+$][/lib]ru)
37 170 0 if -d "$lib/App/Greple"
186 12920 2720 if ref $b ne "CODE"
193 0 4 unless my $var = $optargs{$name}
194 4 0 if (ref $var eq 'SCALAR') { }
0 0 elsif (ref $var eq 'HASH' and @_ == 1) { }
295 0 0 $_[1] ? :
298 0 0 if ($_[1]) { }
365 2 1 if ($_ eq 'all') { }
374 0 0 if (my(@modules) = &uniq($rcloader->modules))
389 0 0 ref $_[0] eq 'HASH' ? :
391 0 0 if (exists $optargs{$name})
393 0 0 if (ref $ref eq 'ARRAY') { }
0 0 elsif (ref $ref eq 'CODE') { }
0 0 elsif (ref $ref eq 'SCALAR') { }
394 0 0 if ($opt->{'append'}) { }
422 0 170 if $ENV{'DEBUG_GETOPT'}
423 0 170 if $ENV{'DEBUG_GETOPTEX'}
427 0 831 utf8::is_utf8($_) ? :
430 170 0 unless (@ARGV and $ARGV[0] eq "--norc" and shift @ARGV or $ENV{'GREPLE_NORC'})
442 0 170 if $ENV{'GREPLEOPTS'}
447 0 170 unless $parser->getoptions(@optargs)
449 0 170 if ($opt_version)
458 0 170 if ($opt_d{'o'})
463 169 1 !defined($opt_m) ? :
465 1 0 if @param % 2
466 0 1 if (¬all(sub { /^(-?\d+)?$/u; } , @param))
471 0 1 if ($length ne '') { }
490 0 170 if ($opt_d{'u'})
492 0 0 if /\|([0-9a-zA-Z])\b/u
497 0 170 if ($opt_man or $opt_show or $opt_path)
499 0 0 /^-M(\w+(::\w++(?![=(]))*)/u ? :
501 0 0 if (@module)
504 0 0 $jp ? :
507 0 0 unless $INC{$file}
508 0 0 if ($opt_man) { }
509 0 0 unless exec "$perldoc $module"
512 0 0 if ($opt_path) { }
516 0 0 unless exec "$pager $file"
528 0 0 if $module =~ /\b \.greplerc $/ux
529 0 0 if $module =~ /\b default $/ux
534 4 166 if (@opt_icode) { }
536 1 3 if (grep {s/^\+//u;} @opt_icode)
540 1 3 if (@opt_icode > 1) { }
1 2 elsif ($opt_icode[0] =~ /^(?:guess|auto)$/iu) { }
559 6 164 if ($opt_filter)
571 0 1 if ($^O =~ /darwin|bsd/iu) { }
1 0 elsif (-r '/proc/cpuinfo') { }
580 1 0 $n =~ /(\d+)/u ? :
582 1 169 if (defined $opt_parallel and $opt_parallel == 0)
593 1 169 if $opt_i
595 9 161 if (@opt_f) { }
597 4 5 $opt_select ? :
603 29 132 unless ($opt_filter or grep {not $_->[0] =~ /^(not|may)/u;} @opt_pattern)
631 5 162 if (@opti > 0)
650 12 155 $must ? :
652 0 14 if (/^-(\d+)$/u) { }
0 14 elsif (/^\+(\d+)$/u) { }
14 0 elsif (/^(\d+)$/u) { }
668 0 0 if (/^-(\d+)$/u) { }
0 0 elsif (/^\+(\d+)$/u) { }
0 0 elsif (/^(\d+)$/u) { }
687 158 9 unless local $_ = shift()
688 1 8 if /[^\d,]/u
689 3 17 $_ eq '' ? :
690 1 7 if (@c == 1)
693 1 6 if @c % 2
697 33 51 if $_[0] < $min
698 17 34 if $max <= 0 or $_[0] <= $max
708 166 0 unless ($opt_noif)
726 0 166 if (@opt_chdir) { }
0 166 elsif (@opt_glob) { }
730 0 0 unless ($opt_h or @opt_chdir == 1 and @argv_files == 1 and @opt_glob == 0)
739 1 0 unless @ARGV or @argv_files or @opt_glob or $opt_readlist
740 5 161 if (@ARGV > 1 || $opt_readlist and not $opt_h)
744 157 9 unless $need_filename
746 0 166 if $opt_joinby ne ""
770 0 166 $opt_ansicolor eq '16' ? :
783 163 3 if ($color_handler->list == 0)
784 163 0 $opt_colorful ? :
788 0 166 if ($opt_ansicolor eq "24bit")
797 0 0 if ($mk eq '-') { }
0 0 elsif ($mk eq '=') { }
0 0 elsif ($s ne '') { }
798 0 0 if $s ne ""
802 0 0 if $c ne ""
812 165 1 unless ($need_color)
824 3 163 if (defined $opt_blockend)
863 0 166 if ($color_index{'S'})
866 0 166 if ($color_index{'A'} or $color_index{'D'}) { }
0 166 elsif ($color_index{'R'}) { }
883 0 166 if ($opt_d{'c'})
897 3 163 if ($opt_border) { }
6 157 elsif ($opt_p) { }
906 4 162 if ($opt_C)
944 0 21 if callable($_)
945 18 3 if $pattern
946 0 3 unless $_ = parse_func($_)
965 0 166 if ($opt_d{'m'})
969 0 0 $pat->is_positive ? :
0 0 $pat->is_negative ? :
0 0 $pat->is_required ? :
974 0 0 $pat->is_function ? :
0 0 @colors > 1 ? :
984 2 164 if (@opt_pf)
988 0 165 if defined $opt_usage
990 0 165 unless open SAVESTDIN, "<&", \*STDIN
991 0 165 unless open SAVESTDOUT, ">&", \*STDOUT
992 0 165 unless open SAVESTDERR, ">&", \*STDERR
995 0 163 unless open STDIN, "<&", \*SAVESTDIN
998 0 1 unless open STDERR, ">&", \*SAVESTDERR
1003 0 3 unless open STDOUT, ">&", \*SAVESTDOUT
1018 163 2 if ($opt_error =~ /^(?: fatal | skip | retry )$/ux) { }
1 1 elsif ($opt_error eq 'ignore') { }
1019 1 162 if ($opt_warn{'read'}) { }
1023 1 0 if $@
1033 0 1 if ($opt_warn{'read'}) { }
1063 163 1 !$need_color ? :
1066 0 164 if ($opt_d{'n'} and $opt_d{'f'}) { }
0 164 elsif ($opt_d{'n'}) { }
0 164 elsif ($opt_d{'f'}) { }
1080 0 164 if ($opt_d{'n'}) { }
1081 0 0 if $n
1094 0 164 if ($opt_d{'s'})
1104 0 160 if ($opt_d{'n'})
1108 0 0 if ($opt_uniqcolor and $opt_d{'c'})
1113 0 160 if ($opt_d{'s'})
1123 0 0 ref $v eq 'ARRAY' ? :
1132 0 160 if ($opt_d{'p'})
1147 7 159 unless (defined $content)
1148 1 6 if ($opt_error eq "fatal")
1151 4 2 if ($opt_error ne "retry")
1152 3 1 if $opt_warn{'skip'}
1158 0 2 unless (seek STDIN, 0, 0)
1160 0 0 if $opt_warn{'skip'}
1164 0 2 unless (defined $content)
1165 0 0 if $opt_warn{'skip'}
1168 1 1 if $opt_warn{'retry'}
1195 0 0 $opt_usage ? :
1196 0 0 if $help eq "ignore"
1216 0 0 if $opt_d{'d'}
1217 0 0 unless chdir $start_directory
1218 0 0 unless chdir $dir
1225 1 166 unless utf8::is_utf8($file)
1228 0 167 if (do { $file =~ m[^https?://]u }) { }
1 166 elsif ($file eq '-') { }
1230 0 0 unless open STDIN, "-|" or exec "w3m -dump $file"
1236 0 166 unless (open STDIN, "<", $file)
1237 0 0 unless -l $file
1242 2 165 if (my(@filters) = $filter_d->get_filters($file))
1246 0 166 if ($file_code eq 'binary') { }
1267 0 0 if (my $msg = $@)
1268 0 0 if ($msg =~ /^SKIP/iu) { }
1269 0 0 if $opt_warn{'begin'}
1277 0 161 if $progress_show
1297 1 2 /P/iu ? :
3 5 /G/iu ? :
8 153 $opt_capture_group ? :
1320 0 161 if ($opt_l) { }
2 159 elsif ($opt_c) { }
129 30 elsif (@{$grep->result_ref}) { }
1321 0 0 if ($matched)
1322 0 0 if $progress_reset
1324 0 0 if $opt_c
1329 0 2 if $progress_reset
1330 0 2 if $need_filename
1334 0 129 if $progress_reset
1336 5 124 if @opt_of
1340 3 124 if @opt_of
1350 0 159 if $opt_clean
1359 0 127 if ($opt_filestyle eq "once")
1380 180 83 @pieces ? :
1385 0 263 if (@opt_print)
1390 0 0 unless ($opt_continue)
1391 0 0 if defined $block
1396 8 255 if ($opt_n)
1397 3 5 @pieces ? :
1407 2 261 if $opt_filestyle eq "separate"
1411 2 261 if $opt_n and $opt_linestyle eq "separate"
1414 3 260 if grep {$_;} do { print &$_file($current_file) if $opt_filestyle eq "separate" }, do { print &$_line($line) if $opt_n and $opt_linestyle eq "separate" }, do { print &$_block($block_number) if $opt_b and $opt_blockstyle eq "separate" }
1415 0 263 if $opt_b and $opt_blockstyle eq "separate"
1420 0 263 if ($indexer)
1421 0 0 if $indexer->block
1422 0 0 $indexer->reverse ? :
1427 180 83 @pieces ? :
1436 3 333 if ($callback)
1438 0 3 if (ref $callback eq 'CODE') { }
3 0 elsif (callable($callback)) { }
1453 1 335 if ($opt_join)
1454 0 1 if ($opt_n and $opt_linestyle eq 'line') { }
1461 0 336 if $opt_uniqcolor
1466 0 263 if $block eq ""
1469 8 255 if ($opt_n)
1470 6 2 if ($opt_linestyle eq 'line') { }
1471 6 0 $block =~ /[\n$mark]/u ? :
1473 7 0 unless $+{'mark'}
1475 0 7 $+{'mark'} ? :
1482 0 263 if $colormap{'TEXT'} ne ""
1484 6 257 if (@line)
1488 0 263 if ($opt_b and $opt_blockstyle eq "line")
1493 7 256 if ($opt_filestyle eq "line")
1498 0 263 if $is_top and $_top ne ""
1500 54 209 if $opt_newline and not $block =~ /\n\z/u
1501 23 240 if $need_blockend
1502 127 136 if ($is_bottom) { }
1503 0 127 if $_bottom ne ""
1505 0 136 if $_middle ne ""