Branch Coverage

lib/File/Fetch.pm
Criterion Covered Total %
branch 73 244 29.9


line true false branch
181 0 422 if @_
190 0 44 unless my $args = check($Tmpl, \%hash)
194 0 44 if (lc $args->scheme ne "file" and not $args->host)
200 0 44 unless ($args->$_)
293 0 44 unless check($tmpl, \%hash)
296 0 44 unless my $href = $class->_parse_uri($uri)
298 0 44 if $file_default
299 0 44 if $tempdir_root
300 44 0 unless $href->{'tempdir_root'}
303 0 44 unless my $ff = $class->_create(%$href)
353 0 51 unless my $uri = shift()
365 9 42 if ($href->{'scheme'} eq 'file') { }
418 2 49 if $href->{'host'} eq "localhost" and $href->{'scheme'} eq "file"
443 0 70 unless my $self = shift()
451 0 70 unless check($tmpl, \%hash)
455 35 35 if (ref $target and UNIVERSAL::isa($target, 'SCALAR')) { }
466 1 34 unless (-d $to)
469 0 1 if $@
484 0 70 unless ("File::Fetch"->can($sub))
491 0 70 if grep {lc $_ eq $method;} @$File::Fetch::BLACKLIST
494 40 30 if $File::Fetch::METHOD_FAIL->{$method}
504 24 6 if (my $file = $self->$sub("to", $out_to))
508 24 0 if (-e $file and -s _) { }
520 12 12 if (ref $target and UNIVERSAL::isa($target, "SCALAR"))
523 0 12 unless (open my $fh, "<$file")
560 0 1 unless check($tmpl, \%hash)
572 0 1 if ($self->scheme eq "https")
578 1 0 unless (can_load("modules", $use_list))
590 0 0 $self->scheme eq 'file' ? :
592 0 0 if ($self->userinfo) { }
0 0 elsif ($self->scheme ne 'file') { }
600 0 0 if $File::Fetch::TIMEOUT
605 0 0 unless my $res = $ua->mirror($uri, $to)
608 0 0 if ($res->code == 304 or $res->code == 200) { }
628 0 6 unless check($tmpl, \%hash)
637 0 6 unless (can_load("modules", $use_list))
644 0 6 $File::Fetch::TIMEOUT ? :
648 0 6 unless ($rc->{'success'})
668 0 1 unless check($tmpl, \%hash)
678 1 0 unless (can_load("modules", $use_list))
690 0 0 if $File::Fetch::TIMEOUT
693 0 0 if ($self->userinfo)
700 0 0 unless ($fh->open($to, ">"))
713 0 0 if ($rc == 301 or $rc == 302) { }
0 0 elsif ($rc == 200) { }
716 0 0 if /Location: (\S+)/
719 0 0 if ($loc =~ m[^/]) { }
751 0 6 unless check($tmpl, \%hash)
760 0 6 unless (can_load("modules", $use_list))
765 0 6 $self->host =~ /:/ ? :
770 0 6 unless ($sock)
778 0 6 unless ($fh->open($to, ">"))
796 6 6 if (not defined $ret or $ret == 0)
803 0 6 unless ($normal)
811 0 6 unless ($resp =~ m[^HTTP/(\d+)\.(\d+)]i)
817 0 6 unless ($code eq 200)
838 0 0 unless check($tmpl, \%hash)
845 0 0 unless (can_load("modules", $use_list))
853 0 0 if $File::Fetch::TIMEOUT
854 0 0 unless ($ftp = "Net::FTP"->new(@options))
859 0 0 unless ($ftp->login("anonymous", $File::Fetch::FROM_EMAIL))
872 0 0 unless ($target = $ftp->get($remote, $to))
893 0 8 unless check($tmpl, \%hash)
897 0 8 unless ($wget = can_run("wget"))
906 0 8 if $File::Fetch::TIMEOUT
909 2 0 if $self->scheme eq "ftp" and $File::Fetch::FTP_PASSIVE
923 0 8 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
946 0 1 unless check($tmpl, \%hash)
950 1 0 unless ($lftp = can_run("lftp"))
963 0 0 if $File::Fetch::TIMEOUT
966 0 0 if $File::Fetch::FTP_PASSIVE
974 0 0 if ($File::Fetch::DEBUG)
996 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1021 0 0 unless check($tmpl, \%hash)
1025 0 0 unless ($ftp = can_run("ftp"))
1034 0 0 unless ($fh->open("$ftp -n", "|-"))
1050 0 0 unless $fh->close
1065 0 1 unless check($tmpl, \%hash)
1069 1 0 unless ($lynx = can_run("lynx"))
1074 0 0 unless ("IPC::Cmd"->can_capture_buffer)
1083 0 0 if ($self->uri =~ m[^https?://]i)
1091 0 0 if $File::Fetch::TIMEOUT
1097 0 0 unless (run("command", $cmd, "buffer", \$head, "verbose", $File::Fetch::DEBUG))
1104 0 0 unless ($head =~ m[^HTTP/\d+\.\d+ 200\b])
1110 0 0 unless my $local = "FileHandle"->new($to, "w")
1121 0 0 if $File::Fetch::TIMEOUT
1136 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1152 0 0 unless $local->close
1166 0 0 unless check($tmpl, \%hash)
1170 0 0 if $File::Fetch::FTP_PASSIVE
1174 0 0 unless ($ncftp = can_run("ncftp"))
1179 0 0 $IPC::Cmd::USE_IPC_RUN ? :
1196 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1216 0 1 unless check($tmpl, \%hash)
1218 1 0 unless ($curl = can_run("curl"))
1226 0 0 if $^O eq "netbsd" and $File::Fetch::FORCEIPV4
1228 0 0 if $File::Fetch::TIMEOUT
1230 0 0 unless $File::Fetch::DEBUG
1233 0 0 if ($self->scheme eq "ftp")
1250 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1271 0 1 unless check($tmpl, \%hash)
1275 1 0 unless (&HAS_FETCH() and $fetch = can_run("fetch"))
1284 0 0 if $File::Fetch::TIMEOUT
1288 0 0 if $File::Fetch::FTP_PASSIVE
1302 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1330 0 2 unless check($tmpl, \%hash)
1352 0 2 if (not $share and $self->host)
1359 0 2 if ($vol) { }
0 2 elsif ($share) { }
1381 0 2 if (not $rv or $@)
1398 0 0 unless check($tmpl, \%hash)
1400 0 0 unless ($rsync = can_run("rsync"))
1408 0 0 if $File::Fetch::TIMEOUT
1410 0 0 unless $File::Fetch::DEBUG
1423 0 0 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1445 0 2 unless check($tmpl, \%hash)
1447 0 2 unless ($git = can_run("git"))
1456 2 0 unless $File::Fetch::DEBUG
1469 0 2 unless (run("command", $cmd, "buffer", \$captured, "verbose", $File::Fetch::DEBUG))
1505 0 0 if ($File::Fetch::WARN)
1506 0 0 $File::Fetch::DEBUG ? :
1514 0 0 shift() ? :