Branch Coverage

blib/lib/Net/FTP.pm
Criterion Covered Total %
branch 2 414 0.4


line true false branch
57 2 0 $ssl_class ? :
2 0 ($ssl_class ? $ssl_class->can_ipv6 : $inet6_class || '') eq 'IO::Socket::IP' ? :
74 0 0 if (@_ % 2) { }
87 0 0 if (exists $arg{'Firewall'} or 'Net::Config'->requires_firewall($peer))
93 0 0 if (defined $fire)
104 0 0 if (can_ssl()) { }
0 0 elsif ($arg{'SSL'}) { }
107 0 0 $pkg->can_client_sni ? :
118 0 0 unless $tlsargs{'SSL_reuse_ctx'} = 'IO::Socket::SSL::SSL_Context'->new(%tlsargs)
133 0 0 defined $arg{'Timeout'} ? :
0 0 $arg{'SSL'} ? :
0 0 unless my $ftp = $pkg->SUPER::new('PeerAddr', $peer, 'PeerPort', $arg{'Port'} || ($arg{'SSL'} ? 'ftps(990)' : 'ftp(21)'), 'LocalAddr', $arg{'LocalAddr'}, $family_key, $arg{'Domain'} || $arg{'Family'}, 'Proto', 'tcp', 'Timeout', defined $arg{'Timeout'} ? $arg{'Timeout'} : 120, %tlsargs, $arg{'SSL'} ? () : ('SSL_startHandshake', 0))
143 0 0 if defined $fire
145 0 0 if defined $fire_type
152 0 0 defined $fire ? :
0 0 exists $ENV{'FTP_PASSIVE'} ? :
0 0 int exists $arg{'Passive'} ? :
154 0 0 if %tlsargs
155 0 0 if ($arg{'SSL'})
160 0 0 exists $arg{'Hash'} ? :
164 0 0 exists $arg{'Debug'} ? :
166 0 0 unless ($ftp->response == 2)
188 0 0 unless @_
197 0 0 unless ($h)
201 0 0 ref $h ? :
203 0 0 if $b < 512
266 0 0 $2 eq '19' ? :
0 0 $ftp->_MDTM($file) && $ftp->message =~ /((\d\d)(\d\d\d?))(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/ ? :
277 0 0 if ($ftp->supported('SIZE')) { }
0 0 elsif ($ftp->supported('STAT')) { }
278 0 0 $ftp->_SIZE($file) ? :
285 0 0 unless $ftp->_STAT($file) and (@msg = $ftp->message) == 3
287 0 0 if $line =~ /^[-rwxSsTt]{10}/
293 0 0 if (@files)
294 0 0 if $files[0] =~ /^([-rwxSsTt]{10}.*)$/
304 0 0 unless can_ssl()
305 0 0 if $ftp->is_SSL
306 0 0 unless $ftp->_AUTH('TLS') == 2
308 0 0 unless $ftp->connect_SSL
315 0 0 unless $prot eq 'C' or $prot eq 'P'
316 0 0 unless $ftp->_PBSZ(0)
317 0 0 unless $ftp->_PROT($prot)
324 0 0 unless $ftp->is_SSL
325 0 0 if do { *$ftp }->{'net_ftp_tlsdirect'}
326 0 0 unless $ftp->_CCC
335 0 0 unless (defined $user)
340 0 0 if $rc
351 0 0 if ($fwtype and defined do { *$ftp }->{'net_ftp_firewall'})
352 0 0 if ($fwtype == 1 or $fwtype == 7) { }
360 0 0 $rc ? :
362 0 0 if ($fwtype == 5) { }
367 0 0 if ($fwtype == 2) { }
0 0 elsif ($fwtype == 6) { }
376 0 0 unless $ok == 2 or $ok == 3
380 0 0 unless $ok == 2 or $ok == 3
382 0 0 if defined $fwacct
385 0 0 if ($fwtype == 3) { }
0 0 elsif ($fwtype == 4) { }
392 0 0 unless $ok == 2 or $ok == 3
400 0 0 if $ok == 2 and $ftp->code == 220 and $user =~ /\@/
403 0 0 if ($ok == 3)
404 0 0 unless (defined $pass)
409 0 0 if $rc
412 0 0 if not defined $pass and !defined($ruser) || $ruser =~ /^anonymous/o
419 0 0 if defined $acct and $ok == 3 || $ok == 2
422 0 0 if ($fwtype == 7 and $ok == 2 and defined do { *$ftp }->{'net_ftp_firewall'})
424 0 0 if defined $resp
432 0 0 unless @_ == 2
442 0 0 unless (defined $resp)
450 0 0 if $rc
458 0 0 unless @_ >= 1 or @_ <= 3
464 0 0 if $ok == 3
472 0 0 unless @_ == 3
476 0 0 if $ftp->_RNFR($oldname)
486 0 0 unless defined $type
490 0 0 unless $ftp->_TYPE($type, @_)
503 0 0 unless defined $size
507 0 0 unless $ftp->supported('ALLO') and $ftp->_ALLO($size, @_)
523 0 0 if defined do { *$ftp }->{'net_ftp_dataconn'}
539 0 0 unless defined $local
542 0 0 if $remote =~ /[\r\n]/s
545 0 0 if defined $where
551 0 0 unless $data = $ftp->retr($remote)
554 0 0 if ($localfd) { }
560 0 0 $rest ? :
0 0 unless (sysopen $loc, $local, 65 | ($rest ? 1024 : 512))
567 0 0 if ($ftp->type eq 'I' and not binmode($loc))
570 0 0 unless $localfd
578 0 0 if $ref = do { *$ftp }->{'net_ftp_hash'}
584 0 0 unless $len = $data->read($buf, $blksize)
591 0 0 if ($hashh)
596 0 0 unless (print $loc $buf)
599 0 0 unless $localfd
605 0 0 if $hashh
607 0 0 unless ($localfd)
608 0 0 unless (close $loc)
614 0 0 unless ($data->close)
625 0 0 unless @_ == 1 or @_ == 2
629 0 0 unless defined $dir and $dir =~ /\S/
631 0 0 $dir eq '..' ? :
638 0 0 unless @_ == 1
644 0 0 unless @_ == 1
662 0 0 unless @_ == 2 or @_ == 3
668 0 0 if $ok = $ftp->_RMD($dir) or not $recurse
674 0 0 /^(?:\S+;)+ (.+)$/ ? :
677 0 0 unless @filelist
681 0 0 unless @filelist
683 0 0 if @filelist == 1 and $dir eq $filelist[0]
687 0 0 m[/] ? :
689 0 0 if $ftp->delete($file)
694 0 0 unless $ok = $ftp->rmdir($file, 1)
708 0 0 unless @_ == 2
719 0 0 unless @_ == 2 or @_ == 3
723 0 0 unless $ftp->_MKD($dir) or $recurse
728 0 0 unless ($ftp->ok)
744 0 0 unless ($ftp->ok)
748 0 0 if ($pwd and $ftp->cwd($dir)) { }
764 0 0 unless @_ == 2
790 0 0 if (not defined $remote and 'STOU' ne uc $cmd)
791 0 0 if $localfd
797 0 0 if (defined do { *$ftp }->{'net_ftp_allo'}) { }
806 0 0 if -f $local
807 0 0 if $size
809 0 0 if defined $remote and $remote =~ /[\r\n]/s
812 0 0 if ($localfd) { }
818 0 0 unless (sysopen $loc, $local, 0)
824 0 0 if ($ftp->type eq 'I' and not binmode($loc))
832 0 0 unless $sock = $ftp->_data_cmd($cmd, grep({defined $_;} $remote))
835 0 0 if 'STOU' eq uc $cmd
843 0 0 if $ref = do { *$ftp }->{'net_ftp_hash'}
846 0 0 unless $len = read($loc, $buf = '', $blksize)
853 0 0 if ($hashh)
860 0 0 unless (defined($wlen = $sock->write($buf, $len)) and $wlen == $len)
862 0 0 unless $localfd
864 0 0 if $hashh
869 0 0 if $hashh
871 0 0 unless $localfd
874 0 0 unless $sock->close
877 0 0 if ('STOU' eq uc $cmd and $ftp->message =~ /unique\s+file\s*name\s*:\s*(.*)\)|"(.*)"/)
887 0 0 unless @_ == 1 or @_ == 2
892 0 0 unless @_ == 1 or @_ == 2
899 0 0 $port ? :
906 0 0 can_ssl() ? :
911 0 0 $listen->sockdomain == 2 ? :
912 0 0 if ($cmd eq 'EPRT' or $fam == 2) { }
922 0 0 $cmd eq 'EPRT' ? :
923 0 0 if $ok
934 0 0 if @_
935 0 0 if $ftp->sockdomain != 2
938 0 0 if ($ftp->_PASV and $ftp->message =~ /(\d+,\d+,\d+,\d+),(\d+),(\d+)/)
949 0 0 if @_
953 0 0 $ftp->_EPSV && $ftp->message =~ /\(([\x33-\x7e])\1\1(\d+)\1\)/ ? :
960 0 0 unless do { *$ftp }->{'net_ftp_unique'}
965 0 0 unless @_ == 2
971 0 0 if exists $hash->{$cmd}
973 0 0 if $ftp->feature($cmd)
976 0 0 unless $ftp->_HELP($cmd)
980 0 0 if ($text =~ /following.+commands/i) { }
999 0 0 if $^W
1006 0 0 if $^W
1024 0 0 if $ftp->ok and $ftp->message =~ /(?:^|\s)\"(.*)\"(?:$|\s)/
1039 0 0 unless eval 'require ' . $pkg
1046 0 0 if ($pasv) { }
0 0 elsif (my $listen = delete do { *$ftp }->{'net_ftp_listen'}) { }
1062 0 0 $ftp->can_client_sni ? :
0 0 $ftp->is_SSL ? :
0 0 can_ssl() ? :
0 0 unless $conn = $pkg->new('PeerAddr', $pasv->[0], 'PeerPort', $pasv->[1], 'LocalAddr', do { *$ftp }->{'net_ftp_localaddr'}, $family_key, do { *$ftp }->{'net_ftp_domain'}, 'Timeout', $ftp->timeout, can_ssl() ? ('SSL_startHandshake', 0, $ftp->is_SSL ? ('SSL_reuse_ctx', $ftp, 'SSL_verifycn_name', do { *$ftp }->{'net_ftp_tlsargs'}{'SSL_verifycn_name'}, $ftp->can_client_sni ? ('SSL_hostname', do { *$ftp }->{'net_ftp_tlsargs'}{'SSL_hostname'}) : ()) : %{${*$ftp;}{'net_ftp_tlsargs'};}) : ())
1066 0 0 unless $conn = $listen->accept($pkg)
1073 0 0 if ((do { *$ftp }->{'net_ftp_tlsprot'} || '') eq 'P')
1074 0 0 if ($conn->connect_SSL) { }
1100 0 0 unless defined $data
1122 0 0 wantarray ? :
1135 0 0 if $arg =~ /[\r\n]/s
1139 0 0 if (do { *$ftp }->{'net_ftp_passive'} and not defined do { *$ftp }->{'net_ftp_pasv'} and not defined do { *$ftp }->{'net_ftp_port'})
1143 0 0 unless defined $ftp->pasv
1145 0 0 if ($where and not $ftp->_REST($where))
1157 0 0 if (1 == $ftp->response)
1158 0 0 if $data and $cmd =~ /RETR|LIST|NLST|MLSD/
1162 0 0 if $data
1169 0 0 unless defined do { *$ftp }->{'net_ftp_port'} or defined do { *$ftp }->{'net_ftp_pasv'}
1171 0 0 if $ok and $where
1175 0 0 unless $ok
1177 0 0 if ($cmd =~ /(STOR|APPE|STOU)/ and exists do { *$ftp }->{'net_ftp_allo'} and $ftp->supported('ALLO'))
1181 0 0 unless $ftp->_ALLO(delete do { *$ftp }->{'net_ftp_allo'})
1187 0 0 if defined do { *$ftp }->{'net_ftp_pasv'}
1192 0 0 unless exists do { *$ftp }->{'net_ftp_intern_port'}
1194 0 0 if ($ok)
1197 0 0 if $data and $cmd =~ /RETR|LIST|NLST|MLSD/
1214 0 0 $_[2] =~ /^(pass|resp|acct)/i ? :
1229 0 0 if $code != 3 and $code != 1
1237 0 0 if $_[1] =~ s/^(\d\d\d)([- ]?)//o
1245 0 0 unless 0 + (do { *$ftp }->{'net_cmd_code'} || 0)
1264 0 0 unless defined $dfile
1267 0 0 unless my $port = $sftp->pasv
1270 0 0 unless $dftp->port($port)
1274 0 0 $unique ? :
0 0 unless $unique ? $dftp->stou($dfile) : $dftp->stor($dfile)
1276 0 0 unless ($sftp->retr($sfile) and $sftp->response == 1)
1288 0 0 unless @_ == 2
1300 0 0 unless $dres == 2 and $sres == 2
1303 0 0 unless $ftp->ok and $non_pasv_server->ok
1305 0 0 if $ftp->message =~ /unique file name:\s*(\S*)\s*\)/
1308 0 0 if $non_pasv_server->message =~ /unique file name:\s*(\S*)\s*\)/
1316 0 0 unless @_ == 2
1329 0 0 if $ftp->_FEAT
1390 0 0 unless $ok == 3 or $ok == 2