Branch Coverage

lib/App/perlbrew.pm
Criterion Covered Total %
branch 329 634 51.8


line true false branch
116 143 72 if (@argv)
143 3 212 if ($opt{'root'})
147 1 214 if ($opt{'builddir'})
155 3 212 if ($self->{'verbose'})
165 0 1239 unless $flavor{$_}{'opt'}
216 212 533 unless $self->{'root'}
218 217 528 if defined $new_root
222 217 528 unless ref $self->{'root'}
225 0 745 unless $self->{'root'}->isa("App::Perlbrew::Path::Root")
236 215 575 unless $self->{'home'}
238 216 574 if defined $new_home
242 215 575 unless ref $self->{'home'}
255 6 680 if $v
261 0 502 if $v
272 9 13 if $x
283 8 454 if $l
289 0 1 unless $name
292 1 0 if -e $executable
310 0 0 if (wantarray)
320 1 10 if $v
322 5 6 unless ($self->{'cpan_mirror'})
332 1265 0 if $name
338 0 0 if $self->env("SHELL") =~ /(t?csh)/
354 0 142 if $self->{'force'} or $self->{'yes'}
362 6 0 ref $self ? :
371 242 587 if ($sym =~ /^run_command_/)
373 240 2 if (ref $glob eq "CODE" or defined *$glob{"CODE"})
395 0 40 $d < $SIMILAR_DISTANCE ? :
398 0 1 if (@commands)
426 0 138 if ($self->{'version'}) { }
0 138 elsif (not $x) { }
0 138 elsif ($x eq 'help') { }
434 0 0 unless @args
438 18 120 unless ($s)
443 1 137 unless ($s)
446 0 1 if (@commands > 1) { }
0 1 elsif (@commands == 1) { }
477 2 0 if ($status and not defined $verbose) { }
478 0 2 if ($self->can("run_command_help_$status")) { }
495 2 0 if ($out =~ /\A\s*\Z/)
499 2 0 if $return_text
505 0 0 defined $status ? :
522 1 6 unless defined $cur
525 0 7 if ($self->env("PERLBREW_DEBUG_COMPLETION"))
532 3 4 if (not $subcommand_completed) { }
536 4 0 if ($comp_installed{$subcommand}) { }
0 0 elsif ($subcommand eq 'help') { }
537 4 0 if ($cur <= 2)
539 2 2 if (defined($part = $args[2]))
547 0 0 if ($cur <= 2)
560 4 9 if -f "App::Perlbrew::Path"->new($self->env("HOME"), $path)
567 4 3 if (defined $part)
568 2 2 if ref $part ne ref qr//
601 628 0 if ($perl_version =~ /^(?:(c?perl)-?)?(\d)\.(\d+).(\d+).*/) { }
0 0 elsif ($perl_version =~ /^(?:(c?perl)-?)?-?(blead)$/) { }
603 4 624 $is_cperl ? :
616 4 624 $is_cperl ? :
4 624 $is_cperl ? :
632 0 106 $self->{'reverse'} ? :
665 1 31 if ($available eq $installed->{'name'})
671 0 32 $ctime ? :
0 32 $ctime ? :
32 0 $is_verbose ? :
32 0 $is_verbose ? :
707 2 1 unless ($json)
733 1 0 unless ($html)
737 0 0 if ($html)
762 0 1 if ($self->{'all'})
767 204 46 unless ($ver =~ /^perl-5\.[0-9]*[02468]\.[0-9]+$/)
770 35 11 if (exists $max_release{$release_line})
771 35 0 if ($max_release{$release_line}[0] > $minor)
788 4 1 if ($x)
796 1 0 if ($index)
801 0 4 if $index =~ /href\s*=\s*"\Q$dist_tarball\E"/ms
810 0 1 unless ($json and $result = decode_json($json)->{'hits'}{'hits'}[0])
816 0 0 unless $dist_path or $dist_tarball
834 0 0 unless my $dist_tarball_url = $url{$version}
845 5 0 if (keys %$tarballs)
847 5 0 if (my $x = $tarballs->{$_})
868 0 0 if ($index)
873 0 0 if ($index =~ /href\s*=\s*"\Q$dist_tarball\E"/ms)
886 0 0 unless ($json and $result = decode_json($json)->{'hits'}{'hits'}[0])
892 0 0 unless $dist_path or $dist_tarball
921 2 0 if (my $u = $url{$dist})
940 0 0 if ($html =~ /
954 1 4 if $dist_version and not $dist_type
968 0 5 if $error
970 0 5 if ($error)
981 0 5 if (@args and $args[0] eq "-")
982 0 0 if ($self->current_shell_is_bashish)
1004 7 28 if (not -f $path) { }
1005 0 7 unless open $fh, ">", $path
1010 28 0 if (-w $path and open $fh, '>', $path) { }
1015 0 0 unless $self->{'quiet'}
1024 0 5 if ($ENV{'PERLBREW_SHELLRC_VERSION'}) { }
1029 0 5 if ($shell =~ /(t?csh)/) { }
1 4 elsif ($shell =~ /zsh\d?$/) { }
1 3 elsif ($shell =~ /fish/) { }
1055 4 1 if ($self->home ne "App::Perlbrew::Path"->new($self->env("HOME"), ".perlbrew"))
1057 1 3 if ($shell =~ /fish/) { }
1092 0 5 if (files_are_the_same($executable, $target))
1104 5 0 if ($head eq '#!/') { }
1124 4 1 unless $self->{'quiet'}
1140 0 0 if (`git describe` =~ /v((5\.\d+\.\d+(?:-RC\d)?)(-\d+-\w+)?)$/)
1161 2 1 if (not $dist_version and $dist =~ /blead\.tar.gz$/)
1169 0 3 if ($dist_tarball_url =~ /^file/) { }
1177 2 1 if $error
1192 0 1 if ($self->{'as'}) { }
1207 0 1 $^O =~ /solaris|aix/ ? :
0 1 $dist_tarball =~ /bz2$/ ? :
0 1 $dist_tarball =~ /xz$/ ? :
1213 0 1 if system $extract_command
1216 1 0 if (@things == 1)
1220 0 1 unless (defined $extracted_dir and -d $extracted_dir)
1233 0 2 if -f $dist_tarball_path
1243 2 9 unless my($ver, $minor) = $cand =~ /^perl-(5\.(6|8|[0-9]+[02468])\.[0-9]+)$/
1245 3 6 if not defined $latest_minor or $latest_minor < $minor
1250 0 2 unless defined $latest_ver
1262 0 1 unless $dist_type and $dist_version =~ /^\d\./
1268 0 1 if (-f $dist_tarball_path) { }
1270 0 0 if $self->{'verbose'}
1273 1 0 unless $self->{'quiet'}
1285 1 61 unless ($self->root->exists)
1289 0 61 unless ($dist)
1298 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)/) { }
1299 2 44 if $dist_version eq "stable"
1304 2 44 if (not $self->{'force'} and $self->is_installed($installation_name))
1308 3 41 if ($dist_type eq 'perl' and $dist_version eq 'blead') { }
1331 1 55 if ($self->{'switch'})
1332 1 0 if (defined(my $installation_name = $self->{'installation_name'})) { }
1346 0 0 if ($self->{'all-variations'}) { }
0 0 elsif ($self->{'common-variations'}) { }
1355 0 0 unless $flavor{$both}
1356 0 0 if $self->{$both}
1357 0 0 if (my $implied_by = $flavor{$both}{'implied_by'})
1358 0 0 if $self->{$implied_by}
1380 0 0 if ($Config::Config{'longsize'} >= 8)
1394 0 0 unless (@dists)
1400 0 0 if $self->{'switch'}
1402 0 0 if $self->{'as'} and @dists > 1
1405 0 0 /-(.*)/ ? :
1425 0 0 if ($@)
1443 0 1 if $dist and $dist eq "stable"
1452 0 1 if (-f $dist_tarball_path and not $self->{'force'}) { }
1456 1 0 unless $self->{'quiet'}
1458 1 0 if ($error)
1466 54 0 if index($_, $self->home) < 0
1467 0 6 wantarray ? :
1520 9 0 if ($dist_tarball_path->basename =~ /(c?perl)-?(5.+)\.tar\.(gz|bz2|xz)\Z/)
1526 0 9 unless ($dist_version and $installation_name)
1550 0 4 if $self->{'as'}
1555 2 2 if ($sitecustomize)
1556 0 2 unless -r $sitecustomize
1561 0 4 if ($self->{'noman'})
1567 0 28 if $self->{$flavor}
1572 0 4 if $dist_version =~ /5\.\d[13579]|git|blead/
1574 0 4 if $looks_like_we_are_installing_cperl
1577 0 4 if (defined $version and $version < $self->comparable_perl_version('5.6.0')) { }
1581 4 0 unless (grep {/eval:scriptdir=/;} @a_options)
1587 4 0 unless $self->{'verbose'}
1599 4 0 unless ($self->{'no-patchperl'} or $looks_like_we_are_installing_cperl)
1602 4 0 unless (-x $patchperl and -f _)
1616 0 4 defined $version && $version < $self->comparable_perl_version('5.8.9') ? :
1625 0 4 $self->{'j'} ? :
1633 4 0 if ($dist_version =~ /^5\.(\d+)\.(\d+)/ and $1 >= 8 || $1 == 7 && $2 == 3)
1638 0 4 if $test_target eq "test_harness" and ($self->{'j'} || 1) > 1
1640 1 3 $destdir ? :
1641 4 0 unless $self->{'notest'}
1643 4 0 unless $self->{'force'}
1655 0 4 if ($self->{'verbose'}) { }
1657 0 0 if $self->{'verbose'}
1664 3 1 if ($self->do_system($cmd)) { }
1666 2 1 unless (-e $newperl)
1672 2 1 if ($sitecustomize)
1675 1 1 if $destdir
1679 0 2 unless open my $dst, ">", $target
1681 0 2 unless open my $src, "<", $sitecustomize
1689 0 3 if (-e $version_file)
1690 0 0 unless $version_file->unlink
1708 0 0 if (-f $out and not $self->{'force'} and not $self->{'yes'})
1713 0 0 unless ($ans =~ /^Y/i)
1714 0 0 unless $self->{'quiet'}
1719 2 6 unless my $body = http_get($url)
1721 3 3 unless ($body =~ m[\A#!/]s)
1725 3 0 unless (-f $x)
1735 1 2 if ($body_filter and ref $body_filter eq "CODE")
1740 0 3 unless open my $OUT, ">", $out
1744 0 3 unless $self->{'quiet'}
1788 0 464 unless -f $executable
1794 432 32 if (-e $version_file) { }
1801 32 0 if (defined $orig_version and length $orig_version)
1802 32 0 if (open my $fh, ">", $version_file)
1823 0 415 $self->{'reverse'} ? :
1838 5 4 unless $name =~ /@/
1857 466 0 if ($perl_name)
1871 0 0 if $self->is_installed($name)
1880 31 0 if ($name)
1883 0 31 unless ($perl_name)
1887 0 31 unless (not $lib_name or grep {$_->{'lib_name'} eq $lib_name;} $self->local_libs($perl_name))
1904 0 31 if ($current_local_lib_root =~ /^\Q$pb_home\E/)
1908 31 0 if ($perl_name) { }
1910 31 0 if (-d $installation->child("bin"))
1916 2 29 if ($lib_name) { }
1921 2 0 if (-d $base)
1924 1 1 if ($self->env("PERLBREW_LIB_PREFIX"))
1963 2 3 if ($self->{'no-decoration'}) { }
1976 2 10 $i->{'is_current'} ? :
0 0 index($i->{'name'}, $i->{'version'}) < 0 ? :
0 12 $is_verbose ? :
0 12 $is_verbose ? :
1982 1 3 $lib->{'is_current'} ? :
1996 0 0 if ($shell =~ m[/zsh\d?$])
1999 0 0 if ($^O eq "darwin")
2023 0 0 unless ($ENV{'PERLBREW_VERSION'})
2028 0 0 defined $ENV{'MANPATH'} ? :
2038 0 0 defined $name ? :
2047 0 0 unless ($perl)
2049 0 0 if ($current) { }
2064 0 0 unless ($dist)
2066 0 0 $current ? :
2077 0 0 if $alias and $alias =~ /^perl-/
2080 0 0 unless -d $self->root->perls($dist)
2082 0 0 if ($self->env('PERLBREW_SHELLRC_VERSION') and $self->current_shell_is_bashish) { }
2121 25 3 if (defined $v and $v ne '') { }
2129 3 0 if ($self->env('SHELL') =~ m[(ba|k|z|/)sh\d?$]) { }
2132 3 25 if ($o eq 'unset') { }
2142 0 0 if ($o eq 'unset') { }
2155 0 2 unless (@perls)
2156 0 0 if -d $_
2162 0 0 unless $version
2165 0 0 if $name eq "cperl"
2197 0 0 unless (-w $FindBin::Bin)
2209 0 0 if ($new_version =~ m[App::perlbrew/(\d+\.\d+)$]) { }
2216 0 0 if ($new_version <= $VERSION)
2217 0 0 unless $self->{'quiet'}
2222 0 0 unless $self->{'quiet'}
2231 0 0 unless ($target)
2240 0 0 unless $to_delete
2248 0 0 $self->{'yes'} ? :
2249 0 0 unless (defined $ans)
2254 0 0 if ($ans =~ /^Y/i) { }
2256 0 0 unless $self->{'quiet'}
2258 0 0 unless $self->{'quiet'}
2280 14 3 if ($opts{'with'}) { }
2283 6 8 $opts{'with'} =~ / / ? :
2286 0 21 if $l
2297 1 16 if ($opts{'min'})
2303 1 16 if ($opts{'max'})
2307 0 17 if (0 == @exec_with)
2308 0 0 unless $self->{'quiet'}
2312 9 8 if (1 == @exec_with)
2319 0 28 unless $env{'PERLBREW_PERL'}
2322 196 28 defined $env{$_} ? :
2327 19 0 unless $no_header or $self->{'quiet'}
2329 8 20 if (my $err = $self->do_system_with_exit_code(@ARGV))
2332 1 7 if $exit_code > 255
2335 7 1 unless ($self->{'quiet'})
2339 7 14 /\s/ ? :
2344 3 5 if $opts{'halt-on-error'}
2346 18 7 unless $self->{'quiet'} or $no_header
2348 5 9 unless $overall_success
2373 0 1 unless ($cmd)
2378 0 1 if $name
2379 0 1 if $alias
2381 0 0 if ($alias and -e $path_alias and not -l $path_alias)
2385 0 1 if ($cmd eq 'create') { }
0 1 elsif ($cmd eq 'delete') { }
0 1 elsif ($cmd eq 'rename') { }
0 1 elsif ($cmd eq 'help') { }
2388 0 0 if ($self->is_installed($alias) and not $self->{'force'})
2397 0 0 unless (-l $path_name)
2405 0 0 unless (-l $path_name)
2409 0 0 if (-l $path_alias and not $self->{'force'})
2436 0 12 unless ($subcommand)
2442 11 1 if ($self->can($sub)) { }
2452 1 7 unless $name
2458 1 6 unless ($perl_name)
2466 0 6 if (-d $dir)
2472 6 0 unless $self->{'quiet'}
2480 1 2 unless $name
2492 1 1 if (-d $dir) { }
2494 0 1 if ($fullname eq $current)
2501 1 0 unless $self->{'quiet'}
2512 0 0 unless -d $dir
2514 0 0 unless opendir my $dh, $dir
2515 0 0 if not /^\./
2519 0 0 $current eq $_ ? :
2531 0 0 unless (defined $current)
2538 0 0 if ($current->{'version'} =~ /^$PERL_VERSION_RE$/) { }
2552 0 0 if ($perl =~ /^perl-$PERL_VERSION_RE$/)
2554 0 0 if ($this_release > $latest_available_perl)
2560 0 0 if ($latest_available_perl == $release)
2568 0 0 unless $self->{'quiet'}
2577 0 0 if grep {/$value/;} @d_options
2596 0 1 unless ($success)
2597 0 0 unless ($self->{'quiet'})
2599 0 0 if ($self->{'verbose'})
2625 1 78 unless $name
2628 65 13 unless $lib_name
2631 6 72 unless ($self->is_installed($perl_name))
2632 3 3 if ($self->is_installed("perl-$perl_name")) { }
2640 61 14 wantarray ? :
2680 0 4 unless $self->resolve_installation_name($src_perl)
2681 0 4 unless $self->resolve_installation_name($dst_perl)
2683 0 4 if (not $src_perl && $dst_perl or $src_perl eq $dst_perl)
2694 0 4 unless (@modules_to_install)
2695 0 0 unless $self->{'quiet'}
2700 4 0 unless $self->{'quiet'}
2710 2 2 if $self->{'notest'}
2723 3 1 if ($self->current_perl) { }
2728 3 297 / Compiled at (.+)\n/ ? :
2743 2 2 if ($module)
2758 8 2 exists $ENV{'PERLBREW_ROOT'} ? :
3208 0 4 unless open $log_handler, ">>", $self->{'log_file'}