Branch Coverage

lib/CPAN.pm
Criterion Covered Total %
branch 787 2106 37.4


line true false branch
33 6 0 if ('File::Spec'->can('rel2abs'))
98 1 0 unless $Config_loaded++
99 0 1 if (exists $EXPORT{$l}) { }
110 1 0 unless defined $Suppress_readline
111 1 0 unless $Config_loaded++
119 1 0 unless ($Suppress_readline)
121 1 0 if (not $term or $term->ReadLine eq 'Term::ReadLine::Stub')
127 0 1 if ($term->ReadLine eq 'Term::ReadLine::Gnu') { }
136 1 0 if (my $histfile = $$Config{'histfile'})
137 0 1 unless ($term->can('AddHistory'))
142 1 0 unless open $fh, "<$histfile"
152 1 0 if defined $_
164 1 0 'File::Spec'->can('tmpdir') ? :
170 1 0 if $term
171 1 0 $term->ReadLine ne 'Term::ReadLine::Stub' ? :
0 1 $Suppress_readline ? :
175 1 0 unless ($$Config{'inhibit_startup_message'})
189 0 125 if ($Suppress_readline) { }
191 0 0 unless defined($_ = <ARGV>)
195 0 125 unless defined($_ = $term->readline($prompt, $commandline))
197 0 125 if $continuation
199 1 124 if /^$/
200 0 124 if /^\s*\?/
201 1 123 if (/^(?:q(?:uit)?|bye|exit)$/i) { }
0 123 elsif (s/\\$//s) { }
5 118 elsif (/^!/) { }
118 0 elsif (/./) { }
213 1 4 unless $import_done++
214 0 5 if $CPAN::DEBUG
216 0 5 if $@
221 0 118 if ($] < 5.00322) { }
225 0 118 if $@
226 0 118 unless @line
229 0 118 if $DEBUG
232 2 116 if $@
233 17 101 if ($command =~ /^(make|test|install|force|notest|clean|upgrade)$/)
248 0 124 if ($try_detect_readline)
249 0 0 if ($META->has_inst('Term::ReadLine::Gnu') or $META->has_inst('Term::ReadLine::Perl'))
263 124 0 if ($term and $term->can('ornaments'))
265 124 0 if (defined $_) { }
266 3 121 if (not defined $last_term_ornaments or $_ != $last_term_ornaments)
285 0 0 if (@$cwd > 1) { }
300 0 0 if $DEBUG
301 0 0 if ($META->has_inst($yaml_module)) { }
305 0 0 if $DEBUG
306 0 0 if ($@)
401 1 3 if $seen{$dep}++
421 18624 337 if ($$CPAN::Config{'commandnumber_in_prompt'}) { }
443 0 52 if (defined $set)
464 0 41 if (defined $set)
486 0 2 if ($autoload =~ /^w/) { }
487 0 0 if ($CPAN::META->has_inst('CPAN::WAIT')) { }
573 13 0 if ($All[$i]{'qmod'} eq $what)
585 0 0 if $CPAN::DEBUG
591 0 0 if $CPAN::DEBUG
592 0 0 if ($All[$i]{'qmod'} eq $what)
594 0 0 if ($jumped > 100)
608 0 0 if $CPAN::DEBUG
644 0 0 if (not $INC{'CPAN/MyConfig.pm'})
650 0 0 if ($new =~ /^y/i) { }
662 0 34 unless $Config_loaded++
663 0 34 if $DEBUG
677 0 1 if (-f $lockfile and -M _ > 0)
678 0 0 unless my $fh = 'FileHandle'->new($lockfile)
683 0 0 if (defined $otherpid and $otherpid)
686 0 0 if (defined $otherhost and $otherhost)
690 0 0 if (defined $otherhost and defined $thishost and $otherhost ne '' and $thishost ne '' and $otherhost ne $thishost) { }
0 0 elsif (defined $otherpid and $otherpid) { }
699 0 0 if $$ == $otherpid
704 0 0 if (kill 0, $otherpid) { }
0 0 elsif (-w $lockfile) { }
715 0 0 unless $ans =~ /^y/i
734 0 1 if ($@)
739 0 0 if (-l $dotcpan)
741 0 0 unless defined $symlinkcpan
743 0 0 if ($@) { }
751 0 0 unless (-d $dotcpan)
756 0 0 if $seconderror
768 0 1 unless ($fh = 'FileHandle'->new(">$lockfile"))
769 0 0 if ($! =~ /Permission/)
798 0 0 if $Signal
799 0 0 if $Signal
826 0 1 if $DEBUG
855 6 0 'File::Spec'->file_name_is_absolute($^X) ? :
858 0 6 if 'MM'->maybe_command($candidate)
860 0 6 unless ($perl)
865 0 0 unless defined $component and $component
867 0 0 if ('MM'->maybe_command($abs))
882 0 636 unless $Config_loaded++
886 312 324 if $class eq 'CPAN::Module'
887 137 499 unless exists $$META{'readonly'}{$class}{$id}
903 37 4 if $$HAS_USABLE{$mod}
905 0 4 unless $has_inst
922 0 0 unless ('File::HomeDir'->VERSION >= 0.52)
931 0 4 if ($$usable{$mod})
935 0 0 unless defined $ret
936 0 0 if ($@)
948 0 129 unless defined $mod
950 122 7 unless $$META{'dontload_hash'}
129 0 unless $$Config{'dontload_hash'}
951 129 0 unless $$Config{'dontload_list'}
953 9 120 if (defined $message and $message eq 'no' or $dont{$mod})
964 107 13 if ($INC{$file}) { }
13 0 elsif (eval {
0 0 elsif ($mod eq 'Net::FTP') { }
0 0 elsif ($mod eq 'Digest::SHA') { }
0 0 elsif ($mod eq 'Module::Signature') { }
978 0 13 if ($mod eq 'CPAN::WAIT')
983 0 0 unless $$Have_warned{'Net::FTP'}++
991 0 0 if ($$Have_warned{'Digest::SHA'}++) { }
1003 0 0 if (not $$Config{'check_sigs'}) { }
0 0 elsif (not $$Have_warned{'Module::Signature'}++) { }
1008 0 0 if (eval {
1037 1014 53 if exists $$META{'readwrite'}{$class}{$id}
1055 8 16 if $subroutine eq '(eval)'
1058 1 7 if $ineval and not $End
1059 6 1 unless defined $$META{'LOCK'}
1060 0 1 unless -f $$META{'LOCK'}
1072 0 1 unless ($histfile = $$Config{'histfile'})
1077 1 0 if ($term) { }
1078 0 1 unless ($term->can('GetHistory'))
1086 0 1 if @h > $histsize
1088 0 1 unless open $fh, ">$histfile"
1109 1 8 unless %{$$self{'is_tested'};}
1111 0 8 unless defined $env
1113 8 0 if defined $env and length $env
1125 0 0 if ($@) { }
1140 0 1 unless -d $$self{'ID'}
1148 0 0 if $CPAN::Signal
1150 0 0 if $CPAN::Signal
1162 0 1 unless defined $dir
1163 0 1 if $CPAN::DEBUG
1166 0 1 unless chdir $dir
1167 0 1 unless my $dh = 'DirHandle'->new('File::Spec'->curdir)
1171 2 0 if $_ eq '.' or $_ eq '..'
1172 0 0 if (-f $_) { }
0 0 elsif (-d _) { }
1180 0 1 unless chdir $cwd
1187 0 0 if exists $$self{'SIZE'}{$dir}
1188 0 0 if $CPAN::Signal
1190 0 0 if (-e $dir) { }
1191 0 0 unless (-x $dir)
1192 0 0 unless (chmod 0755, $dir)
1207 0 0 if $CPAN::Signal
1208 0 0 if -l $_
1209 0 0 if ($^O eq 'MacOS') { }
1212 0 0 if $cat
1214 0 0 if (-d _) { }
1215 0 0 unless (-x _)
1216 0 0 unless (chmod 0755, $_)
1232 0 0 if $CPAN::Signal
1235 0 0 if $CPAN::DEBUG
1243 0 0 unless -e $dir
1244 0 0 if $CPAN::DEBUG
1270 0 1 if $CPAN::DEBUG
1277 0 1 if $$self{'SCAN'} eq 'never'
1278 0 1 unless $$self{'SCAN'} eq 'atstart'
1285 0 0 if $e eq '..' or $e eq '.'
1287 0 0 if $CPAN::Signal
1298 0 1 if (defined $about) { }
1337 3 0 unless /=/
1349 2 1 if ($s =~ m[[\*\?/]]) { }
1350 2 0 if ($CPAN::META->has_inst('Text::Glob')) { }
1351 2 0 if (my($au, $pathglob) = $s =~ m[(.*?)/(.*)]) { }
1353 0 2 if $CPAN::DEBUG
1371 0 3 unless (m[^[A-Z0-9\-]+(/|$)]i)
1382 2 1 if ($a =~ m[(.*?)/(.*)]) { }
1385 0 2 unless $author = 'CPAN::Shell'->expand_by_method('CPAN::Author', ['id'], $a2)
1389 0 1 unless $author = 'CPAN::Shell'->expand_by_method('CPAN::Author', ['id'], $a)
1393 0 3 if ($silent)
1396 0 0 if ($alpha eq $last_alpha) { }
1405 1 0 if ($author->can($pragma))
1414 1 0 if ($author->can($meth))
1430 0 540 if $CPAN::DEBUG
1431 300 240 if ($dh = 'DirHandle'->new($bdir))
1434 600 705 if $entry =~ /^\./
1435 0 705 unless $entry =~ /^\w+(\.pm)?(?!\n)\Z/
1436 180 525 if (-d 'File::Spec'->catdir($bdir, $entry)) { }
1439 0 525 unless $entry =~ s/\.pm(?!\n)\Z//
1451 0 3 if $CPAN::DEBUG
1469 0 1 unless @args
1482 0 1 @result == 0 ? :
0 1 @result == 1 ? :
1499 67 0 if ($o_type eq 'conf') { }
0 0 elsif ($o_type eq 'debug') { }
1500 1 66 if (not @o_what) { }
2 64 elsif (not 'CPAN::HandleConfig'->edit(@o_what)) { }
1504 0 1 if (exists $INC{'CPAN/Config.pm'})
1507 1 0 if (exists $INC{'CPAN/MyConfig.pm'})
1527 0 0 if defined $o_what[0] and $o_what[0] =~ /help/i
1528 0 0 if (@o_what) { }
1531 0 0 if ($what =~ s/^-// and exists $CPAN::DEBUG{$what})
1535 0 0 if (exists $CPAN::DEBUG{$what}) { }
0 0 elsif ($what =~ /^\d/) { }
0 0 elsif (lc $what eq 'all') { }
1548 0 0 unless lc $_ eq lc $what
1552 0 0 unless $known
1565 0 0 if ($CPAN::DEBUG) { }
1570 0 0 if $v & $CPAN::DEBUG
1589 0 0 if ($_[0] =~ /[Ss]ubroutine ([\w:]+) redefined/)
1605 0 1 if $CPAN::DEBUG
1606 0 1 if ($command =~ /^cpan$/i) { }
1 0 elsif ($command =~ /^index$/i) { }
1608 0 0 if $CPAN::iCwd
1618 0 0 if ($$CPAN::Config{'test_report'})
1623 0 0 unless $self->reload_this($f)
1626 0 0 unless $redef
1627 0 0 if ($failed)
1643 0 3 unless $INC{$f}
1646 0 3 if $CPAN::DEBUG
1651 3 12 if -f $read
1653 0 3 unless (-f $read)
1656 0 3 unless (-f $read)
1660 0 3 unless my $fh = 'FileHandle'->new($read)
1665 0 3 if $CPAN::DEBUG
1668 0 3 if ($@)
1682 0 0 unless -e $cpanpm
1701 0 0 if $file eq 'N/A'
1702 0 0 if $file =~ /^Contact Author/
1704 0 0 if $dist->isa_perl
1705 0 0 unless $module->xs_file
1743 0 0 unless ($CPAN::META->has_inst($req))
1749 0 0 unless (-f $indexfile)
1755 0 0 if ($arg =~ s[^/(.+)/$][$1])
1760 0 0 unless $tag eq 'a'
1763 0 0 unless $href =~ s[^\.\./authors/id/./../][]
1764 0 0 if ($arg) { }
1765 0 0 if ($qrarg) { }
1766 0 0 if ($href =~ /$qrarg/)
1770 0 0 if ($href =~ /\Q$arg\E/)
1789 0 0 if (@{$stems{$_};} > 1) { }
1791 0 0 Sort::Versions::versioncmp($a, $b) > 0 ? :
1810 0 3 if $CPAN::DEBUG
1811 0 3 unless $what and $what =~ /^[aru]$/
1814 2 1 unless @args
1827 0 19 unless defined $file
1832 0 19 if $CPAN::Signal
1833 3 16 if ($inst_file) { }
1834 1 2 if ($what eq 'a') { }
2 0 elsif ($what eq 'r') { }
0 0 elsif ($what eq 'u') { }
1839 0 2 if ($have eq 'undef') { }
0 2 elsif ($have == 0) { }
1844 2 0 unless 'CPAN::Version'->vgt($latest, $have)
1852 8 8 if ($what eq 'a') { }
8 0 elsif ($what eq 'r') { }
0 0 elsif ($what eq 'u') { }
1860 0 1 if $CPAN::Signal
1862 1 0 if ($what eq 'a') { }
0 0 elsif ($what eq 'r') { }
0 0 elsif ($what eq 'u') { }
1866 0 0 if $seen{$file}++
1869 0 0 if $seen{$file}++
1870 0 0 if $file =~ /^Contact/
1872 1 0 unless ($headerdone++)
1886 0 1 if ($COLOR_REGISTERED and $CPAN::META->has_inst('Term::ANSIColor') and $module->description)
1905 2 1 unless (%need)
1906 1 1 if ($what eq 'u') { }
1 0 elsif ($what eq 'r') { }
1912 1 2 if ($what eq 'r')
1913 0 1 if ($version_zeroes)
1914 0 0 $version_zeroes > 1 ? :
1918 0 1 if ($version_undefs)
1919 0 0 $version_undefs > 1 ? :
1951 834 175 unless exists $$d{$nosayer}
1953 175 0 $$d{$nosayer}->can('failed') ? :
148 27 unless $$d{$nosayer}->can('failed') ? $$d{$nosayer}->failed : $$d{$nosayer} =~ /^NO/
1957 23 0 $$d{$nosayer}->can('commandid') ? :
18 9 if $only_id and $only_id != ($$d{$nosayer}->can('commandid') ? $$d{$nosayer}->commandid : $CPAN::CurrentCommandId)
1967 163 9 unless $failed
1972 9 0 $$d{$failed}->can('failed') ? :
1989 17 3 $only_id ? :
1990 7 13 if (@failed) { }
1 12 elsif (not $only_id or not $silent) { }
2011 0 0 unless /VmSize:\s+(\d+)/
2023 0 0 unless substr($k, 0, 4) eq 'read'
2037 0 1 unless $CPAN::Config_loaded++
2041 0 1 unless (-d $todir)
2055 0 1 unless my($fh) = 'FileHandle'->new(">$to")
2084 0 157 if $CPAN::DEBUG
2085 12 145 if ($s =~ m[/]) { }
12 133 elsif ($s =~ /^Bundle::/) { }
2096 132 1 if $CPAN::META->exists('CPAN::Module', $s)
2106 0 428 if $CPAN::DEBUG
2110 0 428 if $] < 5.00303
2111 417 11 unless $class->can($meth)
2123 13 421 if ($arg =~ m[^/(.*)/$]) { }
0 421 elsif ($arg =~ /=/) { }
2129 0 0 defined $regex ? :
0 0 defined $command ? :
0 434 if $CPAN::DEBUG
2134 13 421 if (defined $regex) { }
0 421 elsif ($command) { }
2138 0 110 unless ($obj->id)
2141 0 0 if $CPAN::DEBUG
2149 82 30 if ($obj->$method =~ /$regex/i)
2156 0 0 unless $ADVANCED_QUERY
2169 0 0 unless my $lhs = $self->$method
2170 0 0 if ($matchcrit) { }
2171 0 0 if $lhs =~ /$matchcrit/
2173 0 0 if $lhs eq $criterion
2178 13 408 if ($class eq 'CPAN::Bundle') { }
223 185 elsif ($class eq 'CPAN::Distribution') { }
2185 379 42 if ($CPAN::META->exists($class, $xarg)) { }
0 42 elsif ($CPAN::META->exists($class, $arg)) { }
2196 0 433 if ($CPAN::DEBUG)
2201 20 413 wantarray ? :
2208 2 9 unless @args
2215 0 5 @result == 0 ? :
6 5 @result == 1 ? :
2227 0 0 if $installation_report_fh
2228 0 0 if ($CPAN::META->has_inst('File::Temp'))
2236 0 0 unless ($installation_report_fh)
2237 0 0 unless $previously_noticed++
2257 0 863 if ($colorize_output and not $CPAN::META->has_inst('Term::ANSIColor'))
2258 0 0 unless ($print_ornamented_have_warned++)
2272 0 735 unless defined $what
2275 0 735 if ($CPAN::Be_Silent)
2280 0 735 if ($$CPAN::Config{'term_is_latin'})
2285 0 735 if ($self->colorize_output) { }
2287 0 0 if ($@)
2298 0 0 if ($colorstyle == 1) { }
2302 0 0 if length $line > $longest
2304 0 0 if $longest > 78
2305 0 0 chomp $swhat ? :
2365 0 64 if ('CPAN::Shell'->colorize_output)
2371 0 64 if ('CPAN::Shell'->colorize_output)
2383 0 0 if length $l > $longest
2385 0 0 if $longest > 62
2387 0 0 if ($l =~ /^\s*$/)
2392 0 0 if (length $l < 66)
2407 28 0 if -t STDOUT
2423 1 3 unless $meth = shift @some
2428 0 28 if $CPAN::DEBUG
2448 0 28 if (ref $s) { }
0 28 elsif ($s =~ m[^/]) { }
3 25 elsif ($meth eq 'ls') { }
2449 0 0 if $CPAN::DEBUG
2460 0 25 if $CPAN::DEBUG
2463 24 1 if (ref $obj) { }
0 1 elsif ($CPAN::META->exists('CPAN::Author', uc $s)) { }
2469 0 0 if ($meth =~ /^(dump|ls)$/) { }
2499 0 24 if (ref $s) { }
2505 2 0 if ($pragma and $] < 5.00303 || $obj->can($pragma))
2514 6 18 if ($] >= 5.00303 and $obj->can('called_for'))
2518 0 24 if $CPAN::DEBUG
2521 10 13 if ($obj->$meth) { }
2570 0 2 if $SETUPDONE
2571 2 0 if ($CPAN::META->has_usable('LWP::UserAgent')) { }
2582 0 2 if ($USER and $PASSWD)
2585 1 1 if ($proxy) { }
2596 1 0 if (defined $$CPAN::Config{'proxy_user'} and defined $$CPAN::Config{'proxy_pass'})
2615 1 0 if (defined $$CPAN::Config{'username'} and defined $$CPAN::Config{'password'})
2639 0 0 if ($CPAN::META->has_inst('Term::ReadKey')) { }
2649 0 0 if ($CPAN::META->has_inst('Term::ReadKey'))
2689 0 0 if ($result->code == 407)
2703 0 0 if $CPAN::DEBUG
2708 0 0 unless ($ftp)
2712 0 0 unless defined $ftp
2713 0 0 if $CPAN::DEBUG{'FTP'} & $CPAN::DEBUG
2715 0 0 unless ($ftp->login('anonymous', $Config::Config{'cf_email'}))
2720 0 0 unless ($ftp->cwd($dir))
2726 0 0 if $CPAN::DEBUG
2727 0 0 unless ($ftp->get($file, $target))
2768 0 34 unless defined $aslocal
2770 0 34 if $CPAN::DEBUG
2773 0 34 if ($^O eq 'MacOS')
2777 0 0 if (length $name > 31)
2797 0 34 if (-f $aslocal and -r _ and not $force & 1)
2799 0 0 if ($size = -s $aslocal) { }
2800 0 0 if $CPAN::DEBUG
2804 0 0 unless unlink $aslocal
2810 1 33 if (-f $aslocal)
2817 0 34 unless -w $aslocal_dir
2823 34 0 if ($CPAN::META->has_usable('LWP::UserAgent'))
2824 2 32 unless ($Ua)
2827 0 2 if ($@) { }
2828 0 0 if $CPAN::DEBUG
2832 0 2 if $var = $$CPAN::Config{'ftp_proxy'} || $ENV{'ftp_proxy'}
2834 0 2 if $var = $$CPAN::Config{'http_proxy'} || $ENV