Branch Coverage

lib/File/Fetch.pm
Criterion Covered Total %
branch 15 236 6.4


line true false branch
177 0 56 if @_
186 0 9 unless my $args = check($Tmpl, \%hash)
190 0 9 if (lc $args->scheme ne 'file' and not $args->host)
196 0 9 unless ($args->$_)
289 0 9 unless check($tmpl, \%hash)
292 0 9 unless my $href = $class->_parse_uri($uri)
294 0 9 if $file_default
295 0 9 if $tempdir_root
296 9 0 unless $$href{'tempdir_root'}
299 0 9 unless my $ff = $class->_create(%$href)
349 0 16 unless my $uri = shift()
361 6 10 if ($$href{'scheme'} eq 'file') { }
413 2 14 if $$href{'host'} eq 'localhost' and $$href{'scheme'} eq 'file'
439 0 0 unless my $self = shift()
447 0 0 unless check($tmpl, \%hash)
451 0 0 if (ref $target and UNIVERSAL::isa($target, 'SCALAR')) { }
462 0 0 unless (-d $to)
465 0 0 if $@
480 0 0 unless ('File::Fetch'->can($sub))
487 0 0 if grep {lc $_ eq $method;} @$File::Fetch::BLACKLIST
490 0 0 if $$File::Fetch::METHOD_FAIL{$method}
500 0 0 if (my $file = $self->$sub('to', $out_to))
504 0 0 if (not -e $file && -s _) { }
516 0 0 if (ref $target and UNIVERSAL::isa($target, 'SCALAR'))
519 0 0 unless (open my $fh, "<$file")
556 0 0 unless check($tmpl, \%hash)
568 0 0 unless (can_load('modules', $use_list))
580 0 0 $self->scheme eq 'file' ? :
581 0 0 if $self->scheme ne 'file'
585 0 0 if $File::Fetch::TIMEOUT
590 0 0 unless my $res = $ua->mirror($uri, $to)
593 0 0 if ($res->code == 304 or $res->code == 200) { }
613 0 0 unless check($tmpl, \%hash)
620 0 0 unless (can_load('modules', $use_list))
627 0 0 $File::Fetch::TIMEOUT ? :
631 0 0 unless ($$rc{'success'})
651 0 0 unless check($tmpl, \%hash)
659 0 0 unless (can_load('modules', $use_list))
671 0 0 if $File::Fetch::TIMEOUT
676 0 0 unless ($fh->open($to, '>'))
689 0 0 if ($rc == 301 or $rc == 302) { }
0 0 elsif ($rc == 200) { }
692 0 0 if /Location: (\S+)/
695 0 0 if ($loc =~ m[^/]) { }
727 0 0 unless check($tmpl, \%hash)
734 0 0 unless (can_load('modules', $use_list))
739 0 0 $self->host =~ /:/ ? :
744 0 0 unless ($sock)
752 0 0 unless ($fh->open($to, '>'))
770 0 0 if (not defined $ret or $ret == 0)
777 0 0 unless ($normal)
785 0 0 unless ($resp =~ m[^HTTP/(\d+)\.(\d+)]i)
791 0 0 unless ($code eq '200')
812 0 0 unless check($tmpl, \%hash)
817 0 0 unless (can_load('modules', $use_list))
825 0 0 if $File::Fetch::TIMEOUT
826 0 0 unless ($ftp = 'Net::FTP'->new(@options))
831 0 0 unless ($ftp->login('anonymous', $File::Fetch::FROM_EMAIL))
844 0 0 unless ($target = $ftp->get($remote, $to))
865 0 0 unless check($tmpl, \%hash)
869 0 0 unless ($wget = can_run('wget'))
878 0 0 if $File::Fetch::TIMEOUT
881 0 0 if $File::Fetch::FTP_PASSIVE
895 0 0 unless (run('command', $cmd, 'buffer', \$captured, 'verbose', $File::Fetch::DEBUG))
918 0 0 unless check($tmpl, \%hash)
922 0 0 unless ($lftp = can_run('lftp'))
935 0 0 if $File::Fetch::TIMEOUT
938 0 0 if $File::Fetch::FTP_PASSIVE
946 0 0 if ($File::Fetch::DEBUG)
968 0 0 unless (run('command', $cmd, 'buffer', \$captured, 'verbose', $File::Fetch::DEBUG))
993 0 0 unless check($tmpl, \%hash)
997 0 0 unless ($ftp = can_run('ftp'))
1006 0 0 unless ($fh->open("$ftp -n", '|-'))
1022 0 0 unless $fh->close
1037 0 0 unless check($tmpl, \%hash)
1041 0 0 unless ($lynx = can_run('lynx'))
1046 0 0 unless ('IPC::Cmd'->can_capture_buffer)
1055 0 0 if ($self->uri =~ m[^https?://]i)
1063 0 0 if $File::Fetch::TIMEOUT
1069 0 0 unless (run('command', $cmd, 'buffer', \$head, 'verbose', $File::Fetch::DEBUG))
1076 0 0 unless ($head =~ m[^HTTP/\d+\.\d+ 200\b])
1082 0 0 unless my $local = 'FileHandle'->new($to, 'w')
1093 0 0 if $File::Fetch::TIMEOUT
1108 0 0 unless (run('command', $cmd, 'buffer', \$captured, 'verbose', $File::Fetch::DEBUG))
1124 0 0 unless $local->close
1138 0 0 unless check($tmpl, \%hash)
1142 0 0 if $File::Fetch::FTP_PASSIVE
1146 0 0 unless ($ncftp = can_run('ncftp'))
1151 0 0 $IPC::Cmd::USE_IPC_RUN ? :
1168 0 0 unless (run('command', $cmd, 'buffer', \$captured, 'verbose', $File::Fetch::DEBUG))
1188 0 0 unless check($tmpl, \%hash)
1190 0 0 unless ($curl = can_run('curl'))
1198 0 0 if $File::Fetch::TIMEOUT
1200 0 0 unless $File::Fetch::DEBUG
1203 0 0 if ($self->scheme eq 'ftp')
1220 0 0 unless (run('command', $cmd, 'buffer', \$captured, 'verbose', $File::Fetch::DEBUG))
1241 0 0 unless check($tmpl, \%hash)
1245 0 0 unless (HAS_FETCH and $fetch = can_run('fetch'))
1254 0 0 if $File::Fetch::TIMEOUT
1258 0 0 if $File::Fetch::FTP_PASSIVE
1272 0 0 unless (run('command', $cmd, 'buffer', \$captured, 'verbose', $File::Fetch::DEBUG))
1300 0 0 unless check($tmpl, \%hash)
1322 0 0 if (not $share and $self->host)
1329 0 0 if ($vol) { }
0 0 elsif ($share) { }
1351 0 0 if (not $rv or $@)
1368 0 0 unless check($tmpl, \%hash)
1370 0 0 unless ($rsync = can_run('rsync'))
1378 0 0 if $File::Fetch::TIMEOUT
1380 0 0 unless $File::Fetch::DEBUG
1393 0 0 unless (run('command', $cmd, 'buffer', \$captured, 'verbose', $File::Fetch::DEBUG))
1415 0 0 unless check($tmpl, \%hash)
1417 0 0 unless ($git = can_run('git'))
1426 0 0 unless $File::Fetch::DEBUG
1439 0 0 unless (run('command', $cmd, 'buffer', \$captured, 'verbose', $File::Fetch::DEBUG))
1475 0 0 if ($File::Fetch::WARN)
1476 0 0 $File::Fetch::DEBUG ? :
1484 0 0 shift() ? :