Branch Coverage

lib/App/perlbrew.pm
Criterion Covered Total %
branch 352 672 52.3


line true false branch
142 158 85 if (@argv)
170 3 240 if ($opt{'root'})
174 1 242 if ($opt{'builddir'})
182 3 240 if ($self->{'verbose'})
192 0 1344 unless $flavor{$_}{'opt'}
249 240 591 unless $self->{'root'}
251 245 586 if defined $new_root
255 245 586 unless ref $self->{'root'}
258 0 831 unless $self->{'root'}->isa("App::Perlbrew::Path::Root")
270 243 603 unless $self->{'home'}
272 244 602 if defined $new_home
276 243 603 unless ref $self->{'home'}
289 6 695 if $v
295 0 511 if $v
306 10 14 if $x
317 12 455 if $l
323 0 1 unless $name
326 1 0 if -e $executable
344 0 0 if (wantarray)
354 1 10 if $v
356 5 6 unless ($self->{'cpan_mirror'})
366 1309 0 if $name
372 0 0 if $self->env("SHELL") =~ /(t?csh)/
388 0 158 if $self->{'force'} or $self->{'yes'}
396 11 0 ref $self ? :
405 466 1134 if ($sym =~ /^run_command_/)
407 462 4 if (ref $glob eq "CODE" or defined *$glob{"CODE"})
448 0 154 if ($self->{'version'}) { }
2 152 elsif (not $x) { }
4 148 elsif ($x eq 'help') { }
456 3 1 unless @args
460 26 128 unless ($s)
465 2 152 unless ($s)
466 0 2 if (my $x = resolve_command_alias($x))
471 2 152 unless ($s)
474 0 2 if (@commands > 1) { }
0 2 elsif (@commands == 1) { }
507 3 5 if ($command and not defined $verbose) { }
508 0 3 if ($self->can("run_command_help_$command")) { }
515 0 3 if (my $x = resolve_command_alias($command))
529 2 1 if ($out =~ /\A\s*\Z/)
533 2 1 if $return_text
539 5 0 defined $command ? :
556 1 6 unless defined $cur
559 0 7 if ($self->env("PERLBREW_DEBUG_COMPLETION"))
566 3 4 if (not $subcommand_completed) { }
570 4 0 if ($comp_installed{$subcommand}) { }
0 0 elsif ($subcommand eq 'help') { }
571 4 0 if ($cur <= 2)
573 2 2 if (defined($part = $args[2]))
580 0 0 if ($cur <= 2)
593 5 11 if -f "App::Perlbrew::Path"->new($self->env("HOME"), $path)
600 4 3 if (defined $part)
601 2 2 if ref $part ne ref qr//
634 629 0 if ($perl_version =~ /^(?:(c?perl)-?)?(\d)\.(\d+).(\d+).*/) { }
0 0 elsif ($perl_version =~ /^(?:(c?perl)-?)?-?(blead)$/) { }
636 0 629 $is_cperl ? :
650 0 629 $is_cperl ? :
0 629 $is_cperl ? :
666 0 109 $self->{'reverse'} ? :
695 1 27 if ($available eq $installed->{'name'})
701 0 28 $ctime ? :
0 28 $ctime ? :
28 0 $is_verbose ? :
28 0 $is_verbose ? :
734 2 1 unless my $json = http_get("https://fastapi.metacpan.org/v1/release/versions/perl")
740 0 250 unless $release->{'authorized'}
766 0 1 if ($self->{'all'})
771 204 46 unless ($ver =~ /^perl-5\.[0-9]*[02468]\.[0-9]+$/)
774 35 11 if (exists $max_release{$release_line})
775 35 0 if ($max_release{$release_line}[0] > $minor)
792 4 1 if ($x)
800 1 0 if ($index)
805 0 4 if $index =~ /href\s*=\s*"\Q$dist_tarball\E"/ms
814 0 1 unless ($json and $result = decode_json($json)->{'hits'}{'hits'}[0])
820 0 0 unless $dist_path or $dist_tarball
832 5 0 if (keys %$tarballs)
834 5 0 if (my $x = $tarballs->{$_})
855 0 0 if ($index)
860 0 0 if ($index =~ /href\s*=\s*"\Q$dist_tarball\E"/ms)
873 0 0 unless ($json and $result = decode_json($json)->{'hits'}{'hits'}[0])
879 0 0 unless $dist_path or $dist_tarball
895 1 3 if $dist_version and not $dist_type
908 0 4 unless ($self->can($m_local) and $self->can($m_remote))
913 0 4 if $error
915 0 4 if ($error)
926 0 6 if (@args and $args[0] eq "-")
927 0 0 if ($self->current_shell_is_bashish)
951 14 28 if (not -f $path) { }
952 0 14 unless open $fh, ">", $path
958 28 0 if (-w $path and open $fh, '>', $path) { }
963 0 0 unless $self->{'quiet'}
973 0 6 if ($ENV{'PERLBREW_SHELLRC_VERSION'}) { }
979 0 6 if ($shell =~ /(t?csh)/) { }
1 5 elsif ($shell =~ /zsh\d?$/) { }
1 4 elsif ($shell =~ /fish/) { }
1009 5 1 if ($self->home ne "App::Perlbrew::Path"->new($self->env("HOME"), ".perlbrew"))
1011 1 4 if ($shell =~ /fish/) { }
1047 0 6 if (files_are_the_same($executable, $target))
1059 6 0 if ($head eq '#!/') { }
1080 5 1 unless $self->{'quiet'}
1096 0 0 if (`git describe` =~ /v((5\.\d+\.\d+(?:-RC\d)?)(-\d+-\w+)?)$/)
1118 2 1 if (not $dist_version and $dist =~ /blead\.tar.gz$/)
1126 0 3 if ($dist_tarball_url =~ /^file/) { }
1134 2 1 if $error
1149 0 1 if ($self->{'as'}) { }
1164 0 1 if ($^O eq 'cygwin') { }
0 1 elsif ($^O =~ /solaris|aix/) { }
1178 0 1 if ($dist_tarball =~ /xz$/) { }
0 1 elsif ($dist_tarball =~ /bz2$/) { }
1188 0 1 if system $extract_command
1191 1 0 if (@things == 1)
1195 0 1 unless (defined $extracted_dir and -d $extracted_dir)
1208 0 2 if -f $dist_tarball_path
1218 2 9 unless my($ver, $minor) = $cand =~ /^perl-(5\.(6|8|[0-9]+[02468])\.[0-9]+)$/
1220 3 6 if not defined $latest_minor or $latest_minor < $minor
1225 0 2 unless defined $latest_ver
1237 0 1 unless $dist_type and $dist_version =~ /^\d\./
1243 0 1 if (-f $dist_tarball_path) { }
1245 0 0 if $self->{'verbose'}
1248 1 0 unless $self->{'quiet'}
1260 1 62 unless ($self->root->exists)
1264 0 62 unless ($dist)
1269 0 62 if (my $url = make_skaji_relocatable_perl_url($dist, $self->sys))
1273 0 62 if (my $detail = looks_like_url_of_skaji_relocatable_perl($dist))
1274 0 0 if (looks_like_sys_would_be_compatible_with_skaji_relocatable_perl($detail, $self->sys)) { }
1285 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)/) { }
1286 2 45 if $dist_version eq "stable"
1291 2 45 if (not $self->{'force'} and $self->is_installed($installation_name))
1295 3 42 if ($dist_type eq 'perl' and $dist_version eq 'blead') { }
1319 1 56 if ($self->{'switch'})
1320 1 0 if (defined(my $installation_name = $self->{'installation_name'})) { }
1334 0 0 if ($self->{'all-variations'}) { }
0 0 elsif ($self->{'common-variations'}) { }
1343 0 0 unless $flavor{$both}
1344 0 0 if $self->{$both}
1345 0 0 if (my $implied_by = $flavor{$both}{'implied_by'})
1346 0 0 if $self->{$implied_by}
1370 0 0 if ($Config::Config{'longsize'} >= 8)
1385 0 0 unless (@dists)
1391 0 0 if $self->{'switch'}
1393 0 0 if $self->{'as'} and @dists > 1
1396 0 0 /-(.*)/ ? :
1416 0 0 if ($@)
1430 0 1 if $dist and $dist eq "stable"
1439 0 1 if (-f $dist_tarball_path and not $self->{'force'}) { }
1443 1 0 unless $self->{'quiet'}
1445 1 0 if ($error)
1453 63 0 if index($_, $self->home) == -1
1454 0 7 wantarray ? :
1507 9 0 if ($dist_tarball_path->basename =~ /(c?perl)-?(5.+)\.tar\.(gz|bz2|xz)\Z/)
1513 0 9 unless ($dist_version and $installation_name)
1538 0 4 if $self->{'as'}
1543 2 2 if ($sitecustomize)
1544 0 2 unless -r $sitecustomize
1549 0 4 if ($self->{'noman'})
1554 0 28 if $self->{$flavor}
1560 0 4 if $dist_version =~ /5\.\d[13579]|git|blead/
1562 0 4 if $looks_like_we_are_installing_cperl
1565 0 4 if (defined $version and $version < $self->comparable_perl_version('5.6.0')) { }
1571 4 0 unless (grep {/eval:scriptdir=/;} @a_options)
1578 4 0 unless $self->{'verbose'}
1587 4 0 if (not $self->{'no-patchperl'} || $looks_like_we_are_installing_cperl and my $patchperl = maybe_patchperl($self->root))
1600 0 4 defined $version && $version < $self->comparable_perl_version('5.8.9') ? :
1608 0 4 $self->{'j'} ? :
1617 4 0 $use_harness ? :
1620 0 4 if $test_target eq "test_harness" and ($self->{'j'} || 1) > 1
1622 1 3 $destdir ? :
1623 4 0 unless $self->{'notest'}
1626 4 0 unless $self->{'force'}
1632 0 4 if ($self->{'verbose'}) { }
1634 0 0 if $self->{'verbose'}
1642 3 1 if ($self->do_system($cmd)) { }
1644 2 1 unless (-e $newperl)
1650 2 1 if ($sitecustomize)
1653 1 1 if $destdir
1657 0 2 unless open my $dst, ">", $target
1659 0 2 unless open my $src, "<", $sitecustomize
1666 0 3 if (-e $version_file)
1667 0 0 unless $version_file->unlink
1686 0 0 if $installation_path->exists
1695 0 0 if (-f $path) { }
1701 0 0 if ($error)
1722 0 0 if $workdir->exists
1730 0 0 unless system($extract_command) == 0
1743 0 0 if (-f $out and not $self->{'force'} and not $self->{'yes'})
1748 0 0 unless ($ans =~ /^Y/i)
1749 0 0 unless $self->{'quiet'}
1754 2 6 unless my $body = http_get($url)
1757 3 3 unless ($body =~ m[\A#!/]s)
1762 3 0 unless (-f $x)
1772 1 2 if ($body_filter and ref $body_filter eq "CODE")
1777 0 3 unless open my $OUT, ">", $out
1781 0 3 unless $self->{'quiet'}
1831 0 474 unless -f $executable
1837 439 35 if (-e $version_file) { }
1845 35 0 if (defined $orig_version and length $orig_version)
1846 35 0 if (open my $fh, ">", $version_file)
1871 0 416 if ($self->{'reverse'}) { }
1887 5 4 unless $name =~ /@/
1906 476 0 if ($perl_name)
1920 0 0 if $self->is_installed($name)
1929 37 1 if ($name)
1932 0 37 unless ($perl_name)
1936 0 37 unless (not $lib_name or grep {$_->{'lib_name'} eq $lib_name;} $self->local_libs($perl_name))
1953 0 38 if ($current_local_lib_root =~ /^\Q$pb_home\E/)
1957 37 1 if ($perl_name) { }
1959 37 0 if (-d $installation->child("bin"))
1965 2 35 if ($lib_name) { }
1970 2 0 if (-d $base)
1973 1 1 if ($self->env("PERLBREW_LIB_PREFIX"))
2014 2 3 if ($self->{'no-decoration'}) { }
2027 1 11 $i->{'is_current'} ? :
0 0 (index($i->{'name'}, $i->{'version'}) == -1) ? :
0 12 $is_verbose ? :
0 12 $is_verbose ? :
2035 2 4 $lib->{'is_current'} ? :
2049 0 0 if ($shell =~ m[/zsh\d?$])
2052 0 0 if ($^O eq "darwin")
2076 0 0 unless ($ENV{'PERLBREW_VERSION'})
2082 0 0 defined $ENV{'MANPATH'} ? :
2092 0 0 defined $name ? :
2101 0 0 unless ($perl)
2103 0 0 if ($current) { }
2119 0 0 unless ($dist)
2121 0 0 $current ? :
2131 0 0 if $alias and $alias =~ /^perl-/
2134 0 0 unless -d $self->root->perls($dist)
2136 0 0 if ($self->env('PERLBREW_SHELLRC_VERSION') and $self->current_shell_is_bashish) { }
2175 39 7 if (defined $v and $v ne '') { }
2186 3 4 if ($self->env('SHELL') =~ m[(ba|k|z|/)sh\d?$]) { }
2189 3 25 if ($o eq 'unset') { }
2201 4 14 if ($o eq 'unset') { }
2223 0 2 unless (@perls)
2224 0 0 if -d $_
2230 0 0 unless $version
2233 0 0 if $name eq "cperl"
2266 0 0 unless (-w $FindBin::Bin)
2278 0 0 if ($new_version =~ m[App::perlbrew/(\d+\.\d+)$]) { }
2286 0 0 if ($new_version <= $VERSION)
2287 0 0 unless $self->{'quiet'}
2292 0 0 unless $self->{'quiet'}
2301 0 0 unless ($target)
2310 0 0 unless $to_delete
2318 0 0 $self->{'yes'} ? :
2319 0 0 unless (defined $ans)
2329 0 0 if ($ans =~ /^Y/i) { }
2331 0 0 unless $self->{'quiet'}
2333 0 0 unless $self->{'quiet'}
2356 14 3 if ($opts{'with'}) { }
2359 6 8 $opts{'with'} =~ / / ? :
2362 0 21 if $l
2374 1 16 if ($opts{'min'})
2381 1 16 if ($opts{'max'})
2385 0 17 if (0 == @exec_with)
2386 0 0 unless $self->{'quiet'}
2390 9 8 if (1 == @exec_with)
2397 0 28 unless $env{'PERLBREW_PERL'}
2400 196 28 defined $env{$_} ? :
2405 19 0 unless $no_header or $self->{'quiet'}
2407 8 20 if (my $err = $self->do_system_with_exit_code(@ARGV))
2411 1 7 if $exit_code > 255
2414 7 1 unless ($self->{'quiet'})
2418 7 14 if (/\s/) { }
2424 3 5 if $opts{'halt-on-error'}
2426 18 7 unless $self->{'quiet'} or $no_header
2428 5 9 unless $overall_success
2453 0 1 unless ($cmd)
2458 0 1 if $name
2459 0 1 if $alias
2461 0 0 if ($alias and -e $path_alias and not -l $path_alias)
2465 0 1 if ($cmd eq 'create') { }
0 1 elsif ($cmd eq 'delete') { }
0 1 elsif ($cmd eq 'rename') { }
0 1 elsif ($cmd eq 'help') { }
2468 0 0 if ($self->is_installed($alias) and not $self->{'force'})
2478 0 0 unless (-l $path_name)
2487 0 0 unless (-l $path_name)
2491 0 0 if (-l $path_alias and not $self->{'force'})
2520 0 12 unless ($subcommand)
2526 11 1 if ($self->can($sub)) { }
2537 1 7 unless $name
2543 1 6 unless ($perl_name)
2551 0 6 if (-d $dir)
2557 6 0 unless $self->{'quiet'}
2565 1 2 unless $name
2577 1 1 if (-d $dir) { }
2579 0 1 if ($fullname eq $current)
2586 1 0 unless $self->{'quiet'}
2598 0 0 unless -d $dir
2600 0 0 unless opendir my $dh, $dir
2601 0 0 if not /^\./
2605 0 0 $current eq $_ ? :
2617 0 0 unless (defined $current)
2624 0 0 if ($current->{'version'} =~ /^$PERL_VERSION_RE$/) { }
2637 0 0 if ($perl =~ /^perl-$PERL_VERSION_RE$/)
2639 0 0 if ($this_release > $latest_available_perl)
2645 0 0 if ($latest_available_perl == $release)
2653 0 0 unless $self->{'quiet'}
2662 0 0 if grep {/$value/;} @d_options
2680 0 1 unless ($success)
2681 0 0 unless ($self->{'quiet'})
2683 0 0 if ($self->{'verbose'})
2698 1 0 unless $rename{$_}
2709 1 84 unless $name
2712 71 13 unless $lib_name
2715 6 78 unless ($self->is_installed($perl_name))
2716 3 3 if ($self->is_installed("perl-$perl_name")) { }
2724 67 14 wantarray ? :
2764 0 4 unless $self->resolve_installation_name($src_perl)
2765 0 4 unless $self->resolve_installation_name($dst_perl)
2767 0 4 if (not $src_perl && $dst_perl or $src_perl eq $dst_perl)
2779 0 4 unless (@modules_to_install)
2780 0 0 unless $self->{'quiet'}
2785 4 0 unless $self->{'quiet'}
2791 2 2 if $self->{'notest'}
2803 3 1 if ($self->current_perl) { }
2811 3 321 / Compiled at (.+)\n/ ? :
2829 2 2 if ($module)
2847 1 5 unless ($program)
2854 2 3 if (-f $output)
2858 1 2 unless my $current_env = $self->current_env
2875 0 2 unless open my $fh, ">", "$output"
2880 0 2 if ($self->{'verbose'})
2888 0 0 unless my $current_env = $self->current_env
2890 0 0 unless my $path_pp = $self->whereis_in_env("pp", $current_env)
2896 0 0 unless ($input and $output)
2901 0 0 unless (-f $input)
2905 0 0 if (-f $output)
2922 0 0 if ($self->current_lib)
2936 0 0 $locallib ? :
2964 9 2 exists $ENV{'PERLBREW_ROOT'} ? :
3417 0 4 unless open $log_handler, ">>", $self->{'log_file'}