Branch Coverage

lib/App/perlbrew.pm
Criterion Covered Total %
branch 328 632 51.9


line true false branch
130 143 73 if (@argv)
158 3 213 if ($opt{'root'})
162 1 215 if ($opt{'builddir'})
170 3 213 if ($self->{'verbose'})
180 0 1239 unless $flavor{$_}{'opt'}
233 213 533 unless $self->{'root'}
235 218 528 if defined $new_root
239 218 528 unless ref $self->{'root'}
242 0 746 unless $self->{'root'}->isa("App::Perlbrew::Path::Root")
254 216 575 unless $self->{'home'}
256 217 574 if defined $new_home
260 216 575 unless ref $self->{'home'}
273 6 680 if $v
279 0 502 if $v
290 9 13 if $x
301 8 454 if $l
307 0 1 unless $name
310 1 0 if -e $executable
328 0 0 if (wantarray)
338 1 10 if $v
340 5 6 unless ($self->{'cpan_mirror'})
350 1265 0 if $name
356 0 0 if $self->env("SHELL") =~ /(t?csh)/
372 0 142 if $self->{'force'} or $self->{'yes'}
380 10 0 ref $self ? :
389 402 951 if ($sym =~ /^run_command_/)
391 400 2 if (ref $glob eq "CODE" or defined *$glob{"CODE"})
432 0 138 if ($self->{'version'}) { }
0 138 elsif (not $x) { }
0 138 elsif ($x eq 'help') { }
440 0 0 unless @args
444 18 120 unless ($s)
449 1 137 unless ($s)
452 0 1 if (@commands > 1) { }
0 1 elsif (@commands == 1) { }
485 2 0 if ($status and not defined $verbose) { }
486 0 2 if ($self->can("run_command_help_$status")) { }
503 2 0 if ($out =~ /\A\s*\Z/)
507 2 0 if $return_text
513 0 0 defined $status ? :
530 1 6 unless defined $cur
533 0 7 if ($self->env("PERLBREW_DEBUG_COMPLETION"))
540 3 4 if (not $subcommand_completed) { }
544 4 0 if ($comp_installed{$subcommand}) { }
0 0 elsif ($subcommand eq 'help') { }
545 4 0 if ($cur <= 2)
547 2 2 if (defined($part = $args[2]))
554 0 0 if ($cur <= 2)
567 4 9 if -f "App::Perlbrew::Path"->new($self->env("HOME"), $path)
574 4 3 if (defined $part)
575 2 2 if ref $part ne ref qr//
608 628 0 if ($perl_version =~ /^(?:(c?perl)-?)?(\d)\.(\d+).(\d+).*/) { }
0 0 elsif ($perl_version =~ /^(?:(c?perl)-?)?-?(blead)$/) { }
610 4 624 $is_cperl ? :
624 4 624 $is_cperl ? :
4 624 $is_cperl ? :
640 0 107 $self->{'reverse'} ? :
669 1 31 if ($available eq $installed->{'name'})
675 0 32 $ctime ? :
0 32 $ctime ? :
32 0 $is_verbose ? :
32 0 $is_verbose ? :
710 2 1 unless ($json)
736 1 0 unless ($html)
740 0 0 if ($html)
765 0 1 if ($self->{'all'})
770 204 46 unless ($ver =~ /^perl-5\.[0-9]*[02468]\.[0-9]+$/)
773 35 11 if (exists $max_release{$release_line})
774 35 0 if ($max_release{$release_line}[0] > $minor)
791 4 1 if ($x)
799 1 0 if ($index)
804 0 4 if $index =~ /href\s*=\s*"\Q$dist_tarball\E"/ms
813 0 1 unless ($json and $result = decode_json($json)->{'hits'}{'hits'}[0])
819 0 0 unless $dist_path or $dist_tarball
838 0 0 unless my $dist_tarball_url = $url{$version}
849 5 0 if (keys %$tarballs)
851 5 0 if (my $x = $tarballs->{$_})
872 0 0 if ($index)
877 0 0 if ($index =~ /href\s*=\s*"\Q$dist_tarball\E"/ms)
890 0 0 unless ($json and $result = decode_json($json)->{'hits'}{'hits'}[0])
896 0 0 unless $dist_path or $dist_tarball
926 2 0 if (my $u = $url{$dist})
943 0 0 if ($html =~ /
957 1 4 if $dist_version and not $dist_type
971 0 5 if $error
973 0 5 if ($error)
984 0 5 if (@args and $args[0] eq "-")
985 0 0 if ($self->current_shell_is_bashish)
1009 7 28 if (not -f $path) { }
1010 0 7 unless open $fh, ">", $path
1016 28 0 if (-w $path and open $fh, '>', $path) { }
1021 0 0 unless $self->{'quiet'}
1031 0 5 if ($ENV{'PERLBREW_SHELLRC_VERSION'}) { }
1037 0 5 if ($shell =~ /(t?csh)/) { }
1 4 elsif ($shell =~ /zsh\d?$/) { }
1 3 elsif ($shell =~ /fish/) { }
1067 4 1 if ($self->home ne "App::Perlbrew::Path"->new($self->env("HOME"), ".perlbrew"))
1069 1 3 if ($shell =~ /fish/) { }
1105 0 5 if (files_are_the_same($executable, $target))
1117 5 0 if ($head eq '#!/') { }
1138 4 1 unless $self->{'quiet'}
1154 0 0 if (`git describe` =~ /v((5\.\d+\.\d+(?:-RC\d)?)(-\d+-\w+)?)$/)
1176 2 1 if (not $dist_version and $dist =~ /blead\.tar.gz$/)
1184 0 3 if ($dist_tarball_url =~ /^file/) { }
1192 2 1 if $error
1207 0 1 if ($self->{'as'}) { }
1223 0 1 $^O =~ /solaris|aix/ ? :
0 1 $dist_tarball =~ /bz2$/ ? :
0 1 $dist_tarball =~ /xz$/ ? :
1231 0 1 if system $extract_command
1234 1 0 if (@things == 1)
1238 0 1 unless (defined $extracted_dir and -d $extracted_dir)
1251 0 2 if -f $dist_tarball_path
1261 2 9 unless my($ver, $minor) = $cand =~ /^perl-(5\.(6|8|[0-9]+[02468])\.[0-9]+)$/
1263 3 6 if not defined $latest_minor or $latest_minor < $minor
1268 0 2 unless defined $latest_ver
1280 0 1 unless $dist_type and $dist_version =~ /^\d\./
1286 0 1 if (-f $dist_tarball_path) { }
1288 0 0 if $self->{'verbose'}
1291 1 0 unless $self->{'quiet'}
1303 1 61 unless ($self->root->exists)
1307 0 61 unless ($dist)
1316 46 15 if (($dist_type, $dist_version) = $dist =~ /^(?:(c?perl)-?)?([\d._]+(?:-RC\d+)?|git|stable|blead)$/) { }
1 14 elsif (-d "$dist/.git") { }
13 1 elsif (-f $dist) { }
1 0 elsif ($dist =~ /^(?:https?|ftp|file)/) { }
1317 2 44 if $dist_version eq "stable"
1322 2 44 if (not $self->{'force'} and $self->is_installed($installation_name))
1326 3 41 if ($dist_type eq 'perl' and $dist_version eq 'blead') { }
1350 1 55 if ($self->{'switch'})
1351 1 0 if (defined(my $installation_name = $self->{'installation_name'})) { }
1365 0 0 if ($self->{'all-variations'}) { }
0 0 elsif ($self->{'common-variations'}) { }
1374 0 0 unless $flavor{$both}
1375 0 0 if $self->{$both}
1376 0 0 if (my $implied_by = $flavor{$both}{'implied_by'})
1377 0 0 if $self->{$implied_by}
1401 0 0 if ($Config::Config{'longsize'} >= 8)
1416 0 0 unless (@dists)
1422 0 0 if $self->{'switch'}
1424 0 0 if $self->{'as'} and @dists > 1
1427 0 0 /-(.*)/ ? :
1447 0 0 if ($@)
1461 0 1 if $dist and $dist eq "stable"
1470 0 1 if (-f $dist_tarball_path and not $self->{'force'}) { }
1474 1 0 unless $self->{'quiet'}
1476 1 0 if ($error)
1484 54 0 if index($_, $self->home) < 0
1485 0 6 wantarray ? :
1538 9 0 if ($dist_tarball_path->basename =~ /(c?perl)-?(5.+)\.tar\.(gz|bz2|xz)\Z/)
1544 0 9 unless ($dist_version and $installation_name)
1569 0 4 if $self->{'as'}
1574 2 2 if ($sitecustomize)
1575 0 2 unless -r $sitecustomize
1580 0 4 if ($self->{'noman'})
1585 0 28 if $self->{$flavor}
1591 0 4 if $dist_version =~ /5\.\d[13579]|git|blead/
1593 0 4 if $looks_like_we_are_installing_cperl
1596 0 4 if (defined $version and $version < $self->comparable_perl_version('5.6.0')) { }
1602 4 0 unless (grep {/eval:scriptdir=/;} @a_options)
1609 4 0 unless $self->{'verbose'}
1618 4 0 unless ($self->{'no-patchperl'} or $looks_like_we_are_installing_cperl)
1621 4 0 unless (-x $patchperl and -f _)
1635 0 4 defined $version && $version < $self->comparable_perl_version('5.8.9') ? :
1643 0 4 $self->{'j'} ? :
1652 4 0 $use_harness ? :
1655 0 4 if $test_target eq "test_harness" and ($self->{'j'} || 1) > 1
1657 1 3 $destdir ? :
1658 4 0 unless $self->{'notest'}
1661 4 0 unless $self->{'force'}
1667 0 4 if ($self->{'verbose'}) { }
1669 0 0 if $self->{'verbose'}
1677 3 1 if ($self->do_system($cmd)) { }
1679 2 1 unless (-e $newperl)
1685 2 1 if ($sitecustomize)
1688 1 1 if $destdir
1692 0 2 unless open my $dst, ">", $target
1694 0 2 unless open my $src, "<", $sitecustomize
1701 0 3 if (-e $version_file)
1702 0 0 unless $version_file->unlink
1720 0 0 if (-f $out and not $self->{'force'} and not $self->{'yes'})
1725 0 0 unless ($ans =~ /^Y/i)
1726 0 0 unless $self->{'quiet'}
1731 2 6 unless my $body = http_get($url)
1733 3 3 unless ($body =~ m[\A#!/]s)
1738 3 0 unless (-f $x)
1748 1 2 if ($body_filter and ref $body_filter eq "CODE")
1753 0 3 unless open my $OUT, ">", $out
1757 0 3 unless $self->{'quiet'}
1799 0 464 unless -f $executable
1805 432 32 if (-e $version_file) { }
1813 32 0 if (defined $orig_version and length $orig_version)
1814 32 0 if (open my $fh, ">", $version_file)
1839 0 415 $self->{'reverse'} ? :
1855 5 4 unless $name =~ /@/
1874 466 0 if ($perl_name)
1888 0 0 if $self->is_installed($name)
1897 31 0 if ($name)
1900 0 31 unless ($perl_name)
1904 0 31 unless (not $lib_name or grep {$_->{'lib_name'} eq $lib_name;} $self->local_libs($perl_name))
1921 0 31 if ($current_local_lib_root =~ /^\Q$pb_home\E/)
1925 31 0 if ($perl_name) { }
1927 31 0 if (-d $installation->child("bin"))
1933 2 29 if ($lib_name) { }
1938 2 0 if (-d $base)
1941 1 1 if ($self->env("PERLBREW_LIB_PREFIX"))
1982 2 3 if ($self->{'no-decoration'}) { }
1995 2 10 $i->{'is_current'} ? :
0 0 index($i->{'name'}, $i->{'version'}) < 0 ? :
0 12 $is_verbose ? :
0 12 $is_verbose ? :
2003 1 3 $lib->{'is_current'} ? :
2017 0 0 if ($shell =~ m[/zsh\d?$])
2020 0 0 if ($^O eq "darwin")
2044 0 0 unless ($ENV{'PERLBREW_VERSION'})
2050 0 0 defined $ENV{'MANPATH'} ? :
2060 0 0 defined $name ? :
2069 0 0 unless ($perl)
2071 0 0 if ($current) { }
2087 0 0 unless ($dist)
2089 0 0 $current ? :
2099 0 0 if $alias and $alias =~ /^perl-/
2102 0 0 unless -d $self->root->perls($dist)
2104 0 0 if ($self->env('PERLBREW_SHELLRC_VERSION') and $self->current_shell_is_bashish) { }
2144 25 3 if (defined $v and $v ne '') { }
2153 3 0 if ($self->env('SHELL') =~ m[(ba|k|z|/)sh\d?$]) { }
2156 3 25 if ($o eq 'unset') { }
2168 0 0 if ($o eq 'unset') { }
2182 0 2 unless (@perls)
2183 0 0 if -d $_
2189 0 0 unless $version
2192 0 0 if $name eq "cperl"
2225 0 0 unless (-w $FindBin::Bin)
2237 0 0 if ($new_version =~ m[App::perlbrew/(\d+\.\d+)$]) { }
2245 0 0 if ($new_version <= $VERSION)
2246 0 0 unless $self->{'quiet'}
2251 0 0 unless $self->{'quiet'}
2260 0 0 unless ($target)
2269 0 0 unless $to_delete
2277 0 0 $self->{'yes'} ? :
2278 0 0 unless (defined $ans)
2288 0 0 if ($ans =~ /^Y/i) { }
2290 0 0 unless $self->{'quiet'}
2292 0 0 unless $self->{'quiet'}
2315 14 3 if ($opts{'with'}) { }
2318 6 8 $opts{'with'} =~ / / ? :
2321 0 21 if $l
2333 1 16 if ($opts{'min'})
2340 1 16 if ($opts{'max'})
2344 0 17 if (0 == @exec_with)
2345 0 0 unless $self->{'quiet'}
2349 9 8 if (1 == @exec_with)
2356 0 28 unless $env{'PERLBREW_PERL'}
2359 196 28 defined $env{$_} ? :
2364 19 0 unless $no_header or $self->{'quiet'}
2366 8 20 if (my $err = $self->do_system_with_exit_code(@ARGV))
2370 1 7 if $exit_code > 255
2373 7 1 unless ($self->{'quiet'})
2377 7 14 /\s/ ? :
2383 3 5 if $opts{'halt-on-error'}
2385 18 7 unless $self->{'quiet'} or $no_header
2387 5 9 unless $overall_success
2412 0 1 unless ($cmd)
2417 0 1 if $name
2418 0 1 if $alias
2420 0 0 if ($alias and -e $path_alias and not -l $path_alias)
2424 0 1 if ($cmd eq 'create') { }
0 1 elsif ($cmd eq 'delete') { }
0 1 elsif ($cmd eq 'rename') { }
0 1 elsif ($cmd eq 'help') { }
2427 0 0 if ($self->is_installed($alias) and not $self->{'force'})
2437 0 0 unless (-l $path_name)
2446 0 0 unless (-l $path_name)
2450 0 0 if (-l $path_alias and not $self->{'force'})
2479 0 12 unless ($subcommand)
2485 11 1 if ($self->can($sub)) { }
2496 1 7 unless $name
2502 1 6 unless ($perl_name)
2510 0 6 if (-d $dir)
2516 6 0 unless $self->{'quiet'}
2524 1 2 unless $name
2536 1 1 if (-d $dir) { }
2538 0 1 if ($fullname eq $current)
2545 1 0 unless $self->{'quiet'}
2557 0 0 unless -d $dir
2559 0 0 unless opendir my $dh, $dir
2560 0 0 if not /^\./
2564 0 0 $current eq $_ ? :
2576 0 0 unless (defined $current)
2583 0 0 if ($current->{'version'} =~ /^$PERL_VERSION_RE$/) { }
2596 0 0 if ($perl =~ /^perl-$PERL_VERSION_RE$/)
2598 0 0 if ($this_release > $latest_available_perl)
2604 0 0 if ($latest_available_perl == $release)
2612 0 0 unless $self->{'quiet'}
2621 0 0 if grep {/$value/;} @d_options
2639 0 1 unless ($success)
2640 0 0 unless ($self->{'quiet'})
2642 0 0 if ($self->{'verbose'})
2657 1 0 unless $rename{$_}
2668 1 78 unless $name
2671 65 13 unless $lib_name
2674 6 72 unless ($self->is_installed($perl_name))
2675 3 3 if ($self->is_installed("perl-$perl_name")) { }
2683 61 14 wantarray ? :
2723 0 4 unless $self->resolve_installation_name($src_perl)
2724 0 4 unless $self->resolve_installation_name($dst_perl)
2726 0 4 if (not $src_perl && $dst_perl or $src_perl eq $dst_perl)
2738 0 4 unless (@modules_to_install)
2739 0 0 unless $self->{'quiet'}
2744 4 0 unless $self->{'quiet'}
2750 2 2 if $self->{'notest'}
2762 3 1 if ($self->current_perl) { }
2770 3 297 / Compiled at (.+)\n/ ? :
2788 2 2 if ($module)
2806 8 2 exists $ENV{'PERLBREW_ROOT'} ? :
3257 0 4 unless open $log_handler, ">>", $self->{'log_file'}