Branch Coverage

blib/lib/App/perlmv.pm
Criterion Covered Total %
branch 90 200 45.0


line true false branch
30 39 0 if ($ENV{'TESTING_HOME'}) { }
40 0 0 unless $homedir
72 0 0 if ($type eq 'arg') { }
0 0 elsif ($type eq 'optval') { }
74 0 0 if ($argpos == 0 and not exists $seen_opts->{'-x'} and not exists $seen_opts->{'--execute'} and not exists $seen_opts->{'-e'} and not exists $seen_opts->{'--eval'}) { }
84 0 0 ref $args{'opt'} eq 'ARRAY' ? :
86 0 0 if (grep {$_ =~ /\A(-x|--execute|-D|--delete|-s|--show|-w|--write)\z/;} @$opts)
90 0 0 unless $_ eq "-M"
0 0 if (grep {$_ eq "--mode" unless $_ eq "-M";} @$opts)
123 0 0 unless GetOptionsWithCompletion(sub { my(%args) = @_; my $word = $args{'word'}; my $type = $args{'type'}; my $seen_opts = $args{'seen_opts'}; if ($type eq "arg") { my $argpos = $args{'argpos'}; if ($argpos == 0 and not exists $seen_opts->{'-x'} and not exists $seen_opts->{'--execute'} and not exists $seen_opts->{'-e'} and not exists $seen_opts->{'--eval'}) { require Complete::App::perlmv; return Complete::App::perlmv::complete_perlmv_scriptlet("word", $word); } else { require Complete::File; return Complete::File::complete_file("word", $word); } ; } elsif ($type eq "optval") { my $opts = ref $args{'opt'} eq "ARRAY" ? $args{'opt'} : [$args{'opt'}]; my @comps; if (grep {$_ =~ /\A(-x|--execute|-D|--delete|-s|--show|-w|--write)\z/;} @$opts) { require Complete::App::perlmv; push @comps, Complete::App::perlmv::complete_perlmv_scriptlet("word", $word); } ; if (grep {$_ eq "--mode" unless $_ eq "-M";} @$opts) { require Complete::Util; push @comps, Complete::Util::complete_array_elem("word", $word, "array", ["copy", "symlink", "link", "move", "rename"]); } ; require Complete::Util; return Complete::Util::combine_answers(@comps); } ; undef; } , "c|check", \$self->{'check'}, "D|delete=s", \$self->{'delete'}, "d|dry-run", \$self->{'dry_run'}, "N|no-dry-run", sub { $self->{'dry_run'} = 0; } , "e|eval=s", $self->{'codes'}, "h|help", sub { $self->print_help; } , "l|list", \$self->{'list'}, "M|mode=s", \$self->{'mode'}, "o|overwrite", \$self->{'overwrite'}, "p|parents", \$self->{'parents'}, "R|recursive", \$self->{'recursive'}, "r|reverse", sub { $self->{'sort_mode'} = -1; } , "s|show=s", \$self->{'show'}, "T|no-sort", sub { $self->{'sort_mode'} = 0; } , "v|verbose", \$self->{'verbose'}, "w|write=s", \$self->{'write'}, "f|files", sub { $self->{'process_dir'} = 0; } , "S|no-symlinks", sub { $self->{'process_symlink'} = 0; } , "V|version", sub { $self->print_version; } , "x|execute=s", sub { push @{$$self{"codes"};}, \$_[1]; } , "a|arg=s%", $self->{'args'}, "<>", sub { $self->parse_extra_opts(@_); } )
130 0 0 if ($^O =~ /win32/i) { }
131 0 0 if ($arg =~ /[*?{}\[\]]/) { }
144 0 0 $0 =~ /perlmv/ ? :
0 0 $0 =~ /perlln/ ? :
0 0 $0 =~ /perlln_s/ ? :
0 0 $0 =~ /perlcp/ ? :
151 0 0 if $self->{'dry_run'}
154 0 0 if ($self->{'list'})
157 0 0 $self->{'verbose'} ? :
165 0 0 if ($self->{'show'})
170 0 0 if ($self->{'write'})
172 0 0 unless @{$self->{'codes'};} and not ref $self->{'codes'}[0]
177 0 0 if ($self->{'delete'})
182 0 0 unless (@{$self->{'codes'};})
184 0 0 unless $self->{'items'}
189 0 0 if ref $_ eq "SCALAR"
193 0 0 unless $self->{'items'}
274 1 21 unless $self->{'scriptlets'}{$name}
275 6 15 if (defined(my $mod = $self->{'scriptlets'}{$name}{'module'})) { }
279 0 6 unless ${"${mod}::SCRIPTLET";}
315 20 0 if (%App::perlmv::scriptlets::std::scriptlets)
322 0 20 if (%App::perlmv::scriptlets::scriptlets)
328 0 20 if (-d "/usr/share/perlmv/scriptlets")
334 0 0 if $code
339 2 18 if (-d "$self->{'homedir'}/.perlmv/scriptlets")
346 1 0 if $code
361 0 3 unless $self->valid_scriptlet_name($name)
363 0 3 unless $code
365 1 2 unless (-d $path)
366 0 1 unless mkdir $path
369 1 2 unless (-d $path)
370 0 1 unless mkdir $path
373 1 2 if (-e $path and not $self->{'overwrite'}) { }
378 0 2 unless close $fh
398 0 31 if $@
410 0 0 if (ref $code eq 'CODE') { }
414 0 0 if $@
429 18 89 if (ref $code eq 'CODE') { }
433 0 89 if $@
435 56 51 if (defined $res and length $res and $_ eq $orig_)
441 31 1 $self->{'sort_mode'} == 1 ? :
1 32 $self->{'sort_mode'} == -1 ? :
451 0 107 if ($item->{'cwd'})
452 0 0 unless chdir $item->{'cwd'}
454 0 107 if not $self->{'process_symlink'} and -l $item->{'real_name'}
455 0 107 if (-d $item->{'real_name'})
456 0 0 unless $self->{'process_dir'}
457 0 0 if ($self->{'recursive'})
459 0 0 if (chdir $item->{'real_name'}) { }
461 0 0 if $self->{'verbose'}
467 0 0 if $_ ne "."
475 0 0 unless chdir $cwd
490 449 0 ref $_ ? :
496 0 107 unless defined $aold
512 105 2 if -e $aold
513 6 101 if $aold eq $anew
516 9 92 unless ($code_is_final)
522 83 9 if (not defined $self->{'mode'} or $self->{'mode'} =~ /^(rename|r)$/) { }
0 9 elsif ($self->{'mode'} =~ /^(move|mv|m)$/) { }
3 6 elsif ($self->{'mode'} =~ /^(copy|cp|c)$/) { }
3 3 elsif ($self->{'mode'} =~ /^(symlink|sym|s)$/) { }
3 0 elsif ($self->{'mode'} =~ /^(hardlink|h|link|l)$/) { }
538 89 3 unless ($self->{'overwrite'})
541 14 89 if (-e $new or defined $anew and exists $self->{'_exists'}{$anew}) { }
551 83 9 if $action eq "rename" or $action eq "move"
552 3 89 if $self->{'dry_run'}
555 5 87 if $self->{'verbose'}
556 89 3 unless ($self->{'dry_run'})
559 1 88 if ($self->{'parents'})
561 1 0 unless (-e $dir)
565 0 0 $file eq '' ? :
568 0 1 if @$err
573 0 89 if ($action eq 'move') { }
80 9 elsif ($action eq 'rename') { }
3 6 elsif ($action eq 'copy') { }
3 3 elsif ($action eq 'symlink') { }
3 0 elsif ($action eq 'link') { }
575 0 0 unless $res
578 1 79 unless $res
581 0 3 unless $res
585 0 3 unless $res
588 0 3 unless $res
590 1 88 unless $res
598 0 0 unless $self->{'scriptlets'}{$name}
601 0 0 $self->{'scriptlets'}{$name}{'code'} =~ /\n\z/ ? :
607 33 0 if (@args) { }
615 0 33 if ($self->{'_compiled'})
623 30 6 unless $self->{'compiled'} or ref $code eq "CODE"
624 0 36 if $self->{'check'}
626 3 33 if $i