Branch Coverage

lib/App/perlbrew.pm
Criterion Covered Total %
branch 337 648 52.0


line true false branch
130 149 76 if (@argv)
158 3 222 if ($opt{'root'})
162 1 224 if ($opt{'builddir'})
170 3 222 if ($self->{'verbose'})
180 0 1281 unless $flavor{$_}{'opt'}
234 222 562 unless $self->{'root'}
236 227 557 if defined $new_root
240 227 557 unless ref $self->{'root'}
243 0 784 unless $self->{'root'}->isa("App::Perlbrew::Path::Root")
255 225 588 unless $self->{'home'}
257 226 587 if defined $new_home
261 225 588 unless ref $self->{'home'}
274 6 695 if $v
280 0 515 if $v
291 9 13 if $x
302 8 463 if $l
308 0 1 unless $name
311 1 0 if -e $executable
329 0 0 if (wantarray)
339 1 10 if $v
341 5 6 unless ($self->{'cpan_mirror'})
351 1308 0 if $name
357 0 0 if $self->env("SHELL") =~ /(t?csh)/
373 0 149 if $self->{'force'} or $self->{'yes'}
381 10 0 ref $self ? :
390 422 931 if ($sym =~ /^run_command_/)
392 420 2 if (ref $glob eq "CODE" or defined *$glob{"CODE"})
433 0 145 if ($self->{'version'}) { }
0 145 elsif (not $x) { }
0 145 elsif ($x eq 'help') { }
441 0 0 unless @args
445 24 121 unless ($s)
450 1 144 unless ($s)
453 0 1 if (@commands > 1) { }
0 1 elsif (@commands == 1) { }
486 2 0 if ($status and not defined $verbose) { }
487 0 2 if ($self->can("run_command_help_$status")) { }
504 2 0 if ($out =~ /\A\s*\Z/)
508 2 0 if $return_text
514 0 0 defined $status ? :
531 1 6 unless defined $cur
534 0 7 if ($self->env("PERLBREW_DEBUG_COMPLETION"))
541 3 4 if (not $subcommand_completed) { }
545 4 0 if ($comp_installed{$subcommand}) { }
0 0 elsif ($subcommand eq 'help') { }
546 4 0 if ($cur <= 2)
548 2 2 if (defined($part = $args[2]))
555 0 0 if ($cur <= 2)
568 4 9 if -f "App::Perlbrew::Path"->new($self->env("HOME"), $path)
575 4 3 if (defined $part)
576 2 2 if ref $part ne ref qr//
609 630 0 if ($perl_version =~ /^(?:(c?perl)-?)?(\d)\.(\d+).(\d+).*/) { }
0 0 elsif ($perl_version =~ /^(?:(c?perl)-?)?-?(blead)$/) { }
611 0 630 $is_cperl ? :
625 0 630 $is_cperl ? :
0 630 $is_cperl ? :
641 0 109 $self->{'reverse'} ? :
670 1 27 if ($available eq $installed->{'name'})
676 0 28 $ctime ? :
0 28 $ctime ? :
28 0 $is_verbose ? :
28 0 $is_verbose ? :
709 2 1 unless my $json = http_get("https://fastapi.metacpan.org/v1/release/versions/perl")
739 0 1 if ($self->{'all'})
744 204 46 unless ($ver =~ /^perl-5\.[0-9]*[02468]\.[0-9]+$/)
747 35 11 if (exists $max_release{$release_line})
748 35 0 if ($max_release{$release_line}[0] > $minor)
765 4 1 if ($x)
773 1 0 if ($index)
778 0 4 if $index =~ /href\s*=\s*"\Q$dist_tarball\E"/ms
787 0 1 unless ($json and $result = decode_json($json)->{'hits'}{'hits'}[0])
793 0 0 unless $dist_path or $dist_tarball
805 5 0 if (keys %$tarballs)
807 5 0 if (my $x = $tarballs->{$_})
828 0 0 if ($index)
833 0 0 if ($index =~ /href\s*=\s*"\Q$dist_tarball\E"/ms)
846 0 0 unless ($json and $result = decode_json($json)->{'hits'}{'hits'}[0])
852 0 0 unless $dist_path or $dist_tarball
868 1 3 if $dist_version and not $dist_type
881 0 4 unless ($self->can($m_local) and $self->can($m_remote))
886 0 4 if $error
888 0 4 if ($error)
899 0 5 if (@args and $args[0] eq "-")
900 0 0 if ($self->current_shell_is_bashish)
924 7 28 if (not -f $path) { }
925 0 7 unless open $fh, ">", $path
931 28 0 if (-w $path and open $fh, '>', $path) { }
936 0 0 unless $self->{'quiet'}
946 0 5 if ($ENV{'PERLBREW_SHELLRC_VERSION'}) { }
952 0 5 if ($shell =~ /(t?csh)/) { }
1 4 elsif ($shell =~ /zsh\d?$/) { }
1 3 elsif ($shell =~ /fish/) { }
982 4 1 if ($self->home ne "App::Perlbrew::Path"->new($self->env("HOME"), ".perlbrew"))
984 1 3 if ($shell =~ /fish/) { }
1020 0 5 if (files_are_the_same($executable, $target))
1032 5 0 if ($head eq '#!/') { }
1053 4 1 unless $self->{'quiet'}
1069 0 0 if (`git describe` =~ /v((5\.\d+\.\d+(?:-RC\d)?)(-\d+-\w+)?)$/)
1091 2 1 if (not $dist_version and $dist =~ /blead\.tar.gz$/)
1099 0 3 if ($dist_tarball_url =~ /^file/) { }
1107 2 1 if $error
1122 0 1 if ($self->{'as'}) { }
1138 0 1 $^O =~ /solaris|aix/ ? :
0 1 $dist_tarball =~ /bz2$/ ? :
0 1 $dist_tarball =~ /xz$/ ? :
1146 0 1 if system $extract_command
1149 1 0 if (@things == 1)
1153 0 1 unless (defined $extracted_dir and -d $extracted_dir)
1166 0 2 if -f $dist_tarball_path
1176 2 9 unless my($ver, $minor) = $cand =~ /^perl-(5\.(6|8|[0-9]+[02468])\.[0-9]+)$/
1178 3 6 if not defined $latest_minor or $latest_minor < $minor
1183 0 2 unless defined $latest_ver
1195 0 1 unless $dist_type and $dist_version =~ /^\d\./
1201 0 1 if (-f $dist_tarball_path) { }
1203 0 0 if $self->{'verbose'}
1206 1 0 unless $self->{'quiet'}
1218 1 62 unless ($self->root->exists)
1222 0 62 unless ($dist)
1231 47 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)/) { }
1232 2 45 if $dist_version eq "stable"
1237 2 45 if (not $self->{'force'} and $self->is_installed($installation_name))
1241 3 42 if ($dist_type eq 'perl' and $dist_version eq 'blead') { }
1265 1 56 if ($self->{'switch'})
1266 1 0 if (defined(my $installation_name = $self->{'installation_name'})) { }
1280 0 0 if ($self->{'all-variations'}) { }
0 0 elsif ($self->{'common-variations'}) { }
1289 0 0 unless $flavor{$both}
1290 0 0 if $self->{$both}
1291 0 0 if (my $implied_by = $flavor{$both}{'implied_by'})
1292 0 0 if $self->{$implied_by}
1316 0 0 if ($Config::Config{'longsize'} >= 8)
1331 0 0 unless (@dists)
1337 0 0 if $self->{'switch'}
1339 0 0 if $self->{'as'} and @dists > 1
1342 0 0 /-(.*)/ ? :
1362 0 0 if ($@)
1376 0 1 if $dist and $dist eq "stable"
1385 0 1 if (-f $dist_tarball_path and not $self->{'force'}) { }
1389 1 0 unless $self->{'quiet'}
1391 1 0 if ($error)
1399 54 0 if index($_, $self->home) < 0
1400 0 6 wantarray ? :
1453 9 0 if ($dist_tarball_path->basename =~ /(c?perl)-?(5.+)\.tar\.(gz|bz2|xz)\Z/)
1459 0 9 unless ($dist_version and $installation_name)
1484 0 4 if $self->{'as'}
1489 2 2 if ($sitecustomize)
1490 0 2 unless -r $sitecustomize
1495 0 4 if ($self->{'noman'})
1500 0 28 if $self->{$flavor}
1506 0 4 if $dist_version =~ /5\.\d[13579]|git|blead/
1508 0 4 if $looks_like_we_are_installing_cperl
1511 0 4 if (defined $version and $version < $self->comparable_perl_version('5.6.0')) { }
1517 4 0 unless (grep {/eval:scriptdir=/;} @a_options)
1524 4 0 unless $self->{'verbose'}
1533 4 0 unless ($self->{'no-patchperl'} or $looks_like_we_are_installing_cperl)
1536 4 0 unless (-x $patchperl and -f _)
1550 0 4 defined $version && $version < $self->comparable_perl_version('5.8.9') ? :
1558 0 4 $self->{'j'} ? :
1567 4 0 $use_harness ? :
1570 0 4 if $test_target eq "test_harness" and ($self->{'j'} || 1) > 1
1572 1 3 $destdir ? :
1573 4 0 unless $self->{'notest'}
1576 4 0 unless $self->{'force'}
1582 0 4 if ($self->{'verbose'}) { }
1584 0 0 if $self->{'verbose'}
1592 3 1 if ($self->do_system($cmd)) { }
1594 2 1 unless (-e $newperl)
1600 2 1 if ($sitecustomize)
1603 1 1 if $destdir
1607 0 2 unless open my $dst, ">", $target
1609 0 2 unless open my $src, "<", $sitecustomize
1616 0 3 if (-e $version_file)
1617 0 0 unless $version_file->unlink
1635 0 0 if (-f $out and not $self->{'force'} and not $self->{'yes'})
1640 0 0 unless ($ans =~ /^Y/i)
1641 0 0 unless $self->{'quiet'}
1646 2 6 unless my $body = http_get($url)
1649 3 3 unless ($body =~ m[\A#!/]s)
1654 3 0 unless (-f $x)
1664 1 2 if ($body_filter and ref $body_filter eq "CODE")
1669 0 3 unless open my $OUT, ">", $out
1673 0 3 unless $self->{'quiet'}
1715 0 470 unless -f $executable
1721 437 33 if (-e $version_file) { }
1729 33 0 if (defined $orig_version and length $orig_version)
1730 33 0 if (open my $fh, ">", $version_file)
1755 0 415 $self->{'reverse'} ? :
1771 5 4 unless $name =~ /@/
1790 472 0 if ($perl_name)
1804 0 0 if $self->is_installed($name)
1813 37 1 if ($name)
1816 0 37 unless ($perl_name)
1820 0 37 unless (not $lib_name or grep {$_->{'lib_name'} eq $lib_name;} $self->local_libs($perl_name))
1837 0 38 if ($current_local_lib_root =~ /^\Q$pb_home\E/)
1841 37 1 if ($perl_name) { }
1843 37 0 if (-d $installation->child("bin"))
1849 2 35 if ($lib_name) { }
1854 2 0 if (-d $base)
1857 1 1 if ($self->env("PERLBREW_LIB_PREFIX"))
1898 2 3 if ($self->{'no-decoration'}) { }
1911 2 10 $i->{'is_current'} ? :
0 0 index($i->{'name'}, $i->{'version'}) < 0 ? :
0 12 $is_verbose ? :
0 12 $is_verbose ? :
1919 1 3 $lib->{'is_current'} ? :
1933 0 0 if ($shell =~ m[/zsh\d?$])
1936 0 0 if ($^O eq "darwin")
1960 0 0 unless ($ENV{'PERLBREW_VERSION'})
1966 0 0 defined $ENV{'MANPATH'} ? :
1976 0 0 defined $name ? :
1985 0 0 unless ($perl)
1987 0 0 if ($current) { }
2003 0 0 unless ($dist)
2005 0 0 $current ? :
2015 0 0 if $alias and $alias =~ /^perl-/
2018 0 0 unless -d $self->root->perls($dist)
2020 0 0 if ($self->env('PERLBREW_SHELLRC_VERSION') and $self->current_shell_is_bashish) { }
2059 39 7 if (defined $v and $v ne '') { }
2070 3 4 if ($self->env('SHELL') =~ m[(ba|k|z|/)sh\d?$]) { }
2073 3 25 if ($o eq 'unset') { }
2085 4 14 if ($o eq 'unset') { }
2107 0 2 unless (@perls)
2108 0 0 if -d $_
2114 0 0 unless $version
2117 0 0 if $name eq "cperl"
2150 0 0 unless (-w $FindBin::Bin)
2162 0 0 if ($new_version =~ m[App::perlbrew/(\d+\.\d+)$]) { }
2170 0 0 if ($new_version <= $VERSION)
2171 0 0 unless $self->{'quiet'}
2176 0 0 unless $self->{'quiet'}
2185 0 0 unless ($target)
2194 0 0 unless $to_delete
2202 0 0 $self->{'yes'} ? :
2203 0 0 unless (defined $ans)
2213 0 0 if ($ans =~ /^Y/i) { }
2215 0 0 unless $self->{'quiet'}
2217 0 0 unless $self->{'quiet'}
2240 14 3 if ($opts{'with'}) { }
2243 6 8 $opts{'with'} =~ / / ? :
2246 0 21 if $l
2258 1 16 if ($opts{'min'})
2265 1 16 if ($opts{'max'})
2269 0 17 if (0 == @exec_with)
2270 0 0 unless $self->{'quiet'}
2274 9 8 if (1 == @exec_with)
2281 0 28 unless $env{'PERLBREW_PERL'}
2284 196 28 defined $env{$_} ? :
2289 19 0 unless $no_header or $self->{'quiet'}
2291 8 20 if (my $err = $self->do_system_with_exit_code(@ARGV))
2295 1 7 if $exit_code > 255
2298 7 1 unless ($self->{'quiet'})
2302 7 14 /\s/ ? :
2308 3 5 if $opts{'halt-on-error'}
2310 18 7 unless $self->{'quiet'} or $no_header
2312 5 9 unless $overall_success
2337 0 1 unless ($cmd)
2342 0 1 if $name
2343 0 1 if $alias
2345 0 0 if ($alias and -e $path_alias and not -l $path_alias)
2349 0 1 if ($cmd eq 'create') { }
0 1 elsif ($cmd eq 'delete') { }
0 1 elsif ($cmd eq 'rename') { }
0 1 elsif ($cmd eq 'help') { }
2352 0 0 if ($self->is_installed($alias) and not $self->{'force'})
2362 0 0 unless (-l $path_name)
2371 0 0 unless (-l $path_name)
2375 0 0 if (-l $path_alias and not $self->{'force'})
2404 0 12 unless ($subcommand)
2410 11 1 if ($self->can($sub)) { }
2421 1 7 unless $name
2427 1 6 unless ($perl_name)
2435 0 6 if (-d $dir)
2441 6 0 unless $self->{'quiet'}
2449 1 2 unless $name
2461 1 1 if (-d $dir) { }
2463 0 1 if ($fullname eq $current)
2470 1 0 unless $self->{'quiet'}
2482 0 0 unless -d $dir
2484 0 0 unless opendir my $dh, $dir
2485 0 0 if not /^\./
2489 0 0 $current eq $_ ? :
2501 0 0 unless (defined $current)
2508 0 0 if ($current->{'version'} =~ /^$PERL_VERSION_RE$/) { }
2521 0 0 if ($perl =~ /^perl-$PERL_VERSION_RE$/)
2523 0 0 if ($this_release > $latest_available_perl)
2529 0 0 if ($latest_available_perl == $release)
2537 0 0 unless $self->{'quiet'}
2546 0 0 if grep {/$value/;} @d_options
2564 0 1 unless ($success)
2565 0 0 unless ($self->{'quiet'})
2567 0 0 if ($self->{'verbose'})
2582 1 0 unless $rename{$_}
2593 1 84 unless $name
2596 71 13 unless $lib_name
2599 6 78 unless ($self->is_installed($perl_name))
2600 3 3 if ($self->is_installed("perl-$perl_name")) { }
2608 67 14 wantarray ? :
2648 0 4 unless $self->resolve_installation_name($src_perl)
2649 0 4 unless $self->resolve_installation_name($dst_perl)
2651 0 4 if (not $src_perl && $dst_perl or $src_perl eq $dst_perl)
2663 0 4 unless (@modules_to_install)
2664 0 0 unless $self->{'quiet'}
2669 4 0 unless $self->{'quiet'}
2675 2 2 if $self->{'notest'}
2687 3 1 if ($self->current_perl) { }
2695 3 297 / Compiled at (.+)\n/ ? :
2713 2 2 if ($module)
2731 1 5 unless ($program)
2738 2 3 if (-f $output)
2742 1 2 unless my $current_env = $self->current_env
2759 0 2 unless open my $fh, ">", "$output"
2764 0 2 if ($self->{'verbose'})
2772 0 0 unless ($program)
2777 0 0 unless my $current_env = $self->current_env
2782 0 0 if (-f $output)
2786 0 0 unless my $path_program = $self->whereis_in_env($program, $current_env)
2788 0 0 unless my $path_pp = $self->whereis_in_env("pp", $current_env)
2800 0 0 if ($self->current_lib)
2815 0 0 $locallib ? :
2842 8 2 exists $ENV{'PERLBREW_ROOT'} ? :
3293 0 4 unless open $log_handler, ">>", $self->{'log_file'}