Branch Coverage

lib/File/Fetch.pm
Criterion Covered Total %
branch 87 254 34.2


line true false branch
182 16 601 if @_
191 0 49 unless my $args = check($Tmpl, \%hash)
195 0 49 if (lc $args->scheme ne "file" and not $args->host)
201 0 49 unless ($args->$_)
294 0 49 unless check($tmpl, \%hash)
297 0 49 unless my $href = $class->_parse_uri($uri)
299 0 49 if $file_default
300 0 49 if $tempdir_root
301 49 0 unless $href->{'tempdir_root'}
304 0 49 unless my $ff = $class->_create(%$href)
354 0 57 unless my $uri = shift()
366 9 48 if ($href->{'scheme'} eq 'file') { }
42 6 elsif ($href->{'scheme'} eq 'http' or $href->{'scheme'} eq 'https') { }
408 11 31 unless defined $href->{'path'}
422 2 55 if $href->{'host'} eq "localhost" and $href->{'scheme'} eq "file"
447 0 78 unless my $self = shift()
455 0 78 unless check($tmpl, \%hash)
459 39 39 if (ref $target and UNIVERSAL::isa($target, 'SCALAR')) { }
470 1 38 unless (-d $to)
473 0 1 if $@
488 0 78 unless (__PACKAGE__->can($sub))
495 0 78 if grep {lc $_ eq $method;} @$File::Fetch::BLACKLIST
500 0 78 ref $File::Fetch::METHOD_FAIL->{$method} ? :
37 41 if ref $File::Fetch::METHOD_FAIL->{$method} ? $File::Fetch::METHOD_FAIL->{$method}{$self->scheme} : $File::Fetch::METHOD_FAIL->{$method}
510 28 13 if (my $file = $self->$sub("to", $out_to))
514 28 0 if (-e $file and -s _) { }
526 14 14 if (ref $target and UNIVERSAL::isa($target, "SCALAR"))
529 0 14 unless (open my $fh, "<$file")
566 0 10 unless check($tmpl, \%hash)
580 0 10 unless (can_load("modules", $use_list))
585 0 10 if ($self->scheme eq "https")
590 0 0 unless (can_load("modules", $https_use_list))
603 2 8 $self->scheme eq 'file' ? :
605 0 10 if ($self->userinfo) { }
8 2 elsif ($self->scheme ne 'file') { }
613 10 0 if $File::Fetch::TIMEOUT
618 0 10 unless my $res = $ua->mirror($uri, $to)
621 10 0 if ($res->code == 304 or $res->code == 200) { }
641 0 8 unless check($tmpl, \%hash)
650 0 8 unless (can_load("modules", $use_list))
654 0 8 if ($self->scheme eq "https" and not "HTTP::Tiny"->can_ssl)
661 8 0 $File::Fetch::TIMEOUT ? :
665 0 8 unless ($rc->{'success'})
685 0 1 unless check($tmpl, \%hash)
695 1 0 unless (can_load("modules", $use_list))
707 0 0 if $File::Fetch::TIMEOUT
710 0 0 if ($self->userinfo)
717 0 0 unless ($fh->open($to, ">"))
730 0 0 if ($rc == 301 or $rc == 302) { }
0 0 elsif ($rc == 200) { }
733 0 0 if /Location: (\S+)/
736 0 0 if ($loc =~ m[^/]) { }
768 0 8 unless check($tmpl, \%hash)
777 0 8 unless (can_load("modules", $use_list))
782 0 8 $self->host =~ /:/ ? :
787 0 8 unless ($sock)
795 0 8 unless ($fh->open($to, ">"))
813 8 8 if (not defined $ret or $ret == 0)
820 0 8 unless ($normal)
828 0 8 unless ($resp =~ m[^HTTP/(\d+)\.(\d+)]i)
834 8 0 unless ($code eq 200)
855 0 0 unless check($tmpl, \%hash)
862 0 0 unless (can_load("modules", $use_list))
870 0 0 if $File::Fetch::TIMEOUT
871 0 0 unless ($ftp = "Net::FTP"->new(@options))
876 0 0 unless ($ftp->login("anonymous", $File::Fetch::FROM_EMAIL))
889 0 0 unless ($target = $ftp->get($remote, $to))
910 0 1 unless check($tmpl, \%hash)
914 1 0 unless ($wget = can_run("wget"))
923 0 0 if $File::Fetch::TIMEOUT
926 0 0 if $self->scheme eq "ftp" and $File::Fetch::FTP_PASSIVE
940 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
963 0 1 unless check($tmpl, \%hash)
967 1 0 unless ($lftp = can_run("lftp"))
980 0 0 if $File::Fetch::TIMEOUT
986 0 0 if $File::Fetch::FTP_PASSIVE
994 0 0 if ($File::Fetch::DEBUG)
1016 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1041 0 0 unless check($tmpl, \%hash)
1045 0 0 unless ($ftp = can_run("ftp"))
1054 0 0 unless ($fh->open("$ftp -n", "|-"))
1070 0 0 unless $fh->close
1085 0 1 unless check($tmpl, \%hash)
1089 1 0 unless ($lynx = can_run("lynx"))
1094 0 0 unless ("IPC::Cmd"->can_capture_buffer)
1103 0 0 if ($self->uri =~ m[^https?://]i)
1111 0 0 if $File::Fetch::TIMEOUT
1117 0 0 unless (run("command", $cmd, "buffer", \$head, "verbose", $File::Fetch::DEBUG))
1124 0 0 unless ($head =~ m[^HTTP/\d+\.\d+ 200\b])
1130 0 0 unless my $local = "FileHandle"->new($to, "w")
1141 0 0 if $File::Fetch::TIMEOUT
1156 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1172 0 0 unless $local->close
1186 0 0 unless check($tmpl, \%hash)
1190 0 0 if $File::Fetch::FTP_PASSIVE
1194 0 0 unless ($ncftp = can_run("ncftp"))
1199 0 0 $IPC::Cmd::USE_IPC_RUN ? :
1216 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1236 0 8 unless check($tmpl, \%hash)
1238 0 8 unless ($curl = can_run("curl"))
1246 0 0 if $^O eq "netbsd" and $File::Fetch::FORCEIPV4
1248 8 0 if $File::Fetch::TIMEOUT
1250 8 0 unless $File::Fetch::DEBUG
1253 0 8 if ($self->scheme eq "ftp")
1270 0 8 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1291 0 1 unless check($tmpl, \%hash)
1295 1 0 unless (&HAS_FETCH() and $fetch = can_run("fetch"))
1304 0 0 if $File::Fetch::TIMEOUT
1308 0 0 if $File::Fetch::FTP_PASSIVE
1322 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1350 0 2 unless check($tmpl, \%hash)
1372 0 2 if (not $share and $self->host)
1379 0 2 if ($vol) { }
0 2 elsif ($share) { }
1401 0 2 if (not $rv or $@)
1418 0 0 unless check($tmpl, \%hash)
1420 0 0 unless ($rsync = can_run("rsync"))
1428 0 0 if $File::Fetch::TIMEOUT
1430 0 0 unless $File::Fetch::DEBUG
1443 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1465 0 0 unless check($tmpl, \%hash)
1467 0 0 unless ($git = can_run("git"))
1476 0 0 unless $File::Fetch::DEBUG
1489 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1525 8 0 if ($File::Fetch::WARN)
1526 0 8 $File::Fetch::DEBUG ? :
1534 0 0 shift() ? :