FTP.pm

filter: Statementstmt 8.5% 64 / 746 Branchbran 0.4% 2 / 418 Conditioncond 2.3% 6 / 260 MC/DCmcdc 0.0% 0 / 152 Subroutinesub 13.9% 18 / 129 Podpod 91.8% 56 / 61 totaltotal 8.2% 146 / 1766 CC 308 SCAR 60.3
CC
308
Cov
5%
login
1722.0
new
1260.0
_store_cmd
812.0
CRAP 417.2
↑ Summary Domain.pm »
1 # Net::FTP.pm
2 #
3 # Copyright (C) 1995-2004 Graham Barr. All rights reserved.
4 # Copyright (C) 2013-2017, 2020, 2022 Steve Hay. All rights reserved.
5 # This module is free software; you can redistribute it and/or modify it under
6 # the same terms as Perl itself, i.e. under the terms of either the GNU General
7 # Public License or the Artistic License, as specified in the F<LICENCE> file.
8 #
9 # Documentation (at end) improved 1996 by Nathan Torkington <gnat@frii.com>.
10  
11 package Net::FTP;
12  
13 2 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC);
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use Net::Cmd;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Net::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use Time::Local;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 2 our $VERSION = '3.16';
27  
28 2 our $IOCLASS;
29 2 my $family_key;
30 2 ▶BEGIN {
Subroutine BEGIN: called CC=11 SCAR=29.6
31 # Code for detecting if we can use SSL
32 2 ▶ my $ssl_class = eval {
Condition50%1/2
eval { do { require IO::Socket::SSL; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::SSL'->VERSION(2.007) } } && 'IO::Socket::SSL'
!ll
02
MC/DC0%0/1
eval { do { require IO::Socket::SSL; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::SSL'->VERSION(2.007) } } && 'IO::Socket::SSL'
eval { do { require IO::Socket::SSL; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::SSL'->VERSION(2.007) } }
Truth table50%1/2
A
A= eval { do { require IO::Socket::SSL; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::SSL'->VERSION(2.007) } }
Aresult
00
11
33 2 require IO::Socket::SSL;
34 # first version with default CA on most platforms
35 2 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
36 2 IO::Socket::SSL->VERSION(2.007);
37 } && 'IO::Socket::SSL';
38  
39 2 ▶ my $nossl_warn = !$ssl_class &&
Condition50%1/2
!$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'
!ll
20
MC/DC0%0/1
!$ssl_class && 'To use SSL please install IO::Socket::SSL with version>=2.007'
!$ssl_class
Truth table50%1/2
not(A)
A= !$ssl_class
Aresult
00
11
40 'To use SSL please install IO::Socket::SSL with version>=2.007';
41  
42 # Code for detecting if we can use IPv6
43 my $inet6_class = eval {
44 2 require IO::Socket::IP;
45 2 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
46 2 ▶ IO::Socket::IP->VERSION(0.25);
Condition0%0/2
eval { do { use warnings; require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::INET6"->VERSION("2.62") } } and "IO::Socket::INET6"
!ll
00
MC/DC0%0/1
eval { do { use warnings; require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::INET6"->VERSION("2.62") } } and "IO::Socket::INET6"
eval { do { use warnings; require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::INET6"->VERSION("2.62") } }
Truth table0%0/2
A
A= eval { do { use warnings; require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::INET6"->VERSION("2.62") } }
Aresult
00
11
47 2 ▶ } && 'IO::Socket::IP' || eval {
Condition40%2/5
eval { do { require IO::Socket::IP; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::IP'->VERSION(0.25) } } && 'IO::Socket::IP' || eval { do { require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::INET6'->VERSION(2.62) } } && 'IO::Socket::INET6'
l!l&&r!l&&!r
200
eval { do { require IO::Socket::IP; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::IP"->VERSION("0.25") } } and "IO::Socket::IP"
!ll
02
MC/DC0%0/2
eval { do { require IO::Socket::IP; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::IP'->VERSION(0.25) } } && 'IO::Socket::IP' || eval { do { require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::INET6'->VERSION(2.62) } } && 'IO::Socket::INET6'
eval { do { require IO::Socket::IP; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::IP"->VERSION("0.25") } } eval { do { require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::INET6'->VERSION(2.62) } } && 'IO::Socket::INET6'
Truth table33%1/3
A || B
A= eval { do { require IO::Socket::IP; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} "IO::Socket::IP"->VERSION("0.25") } }B= eval { do { require IO::Socket::INET6; BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} 'IO::Socket::INET6'->VERSION(2.62) } } && 'IO::Socket::INET6'
ABresult
1X1
011
000
48 0 require IO::Socket::INET6;
49 2 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
50 0 IO::Socket::INET6->VERSION(2.62);
51 } && 'IO::Socket::INET6';
52  
53 0 ▶ sub can_ssl { $ssl_class };
Subroutine can_ssl: not called CC=1 SCAR=6.9
Pod documented
54 0 ▶ sub can_inet6 { $inet6_class };
Subroutine can_inet6: not called CC=1 SCAR=6.9
Pod documented
55  
56 2 ▶ $IOCLASS = $ssl_class || $inet6_class || 'IO::Socket::INET';
Condition40%2/5
$ssl_class || $inet6_class || 'IO::Socket::INET'
l!l
20
$ssl_class or $inet6_class
l!l&&r!l&&!r
200
MC/DC0%0/2
$ssl_class || $inet6_class || 'IO::Socket::INET'
$ssl_class $inet6_class
Truth table33%1/3
A or B
A= $ssl_classB= $inet6_class
ABresult
1X1
011
000
57 2 ▶ $family_key =
Branch: 2 branches
BranchTrueFalseTotal
($ssl_class ? $ssl_class->can_ipv6 : $inet6_class || '') eq 'IO::Socket::IP' ? : 2 0 2
$ssl_class ? : 2 0 2
Condition0%0/2
$inet6_class or ""
l!l
00
MC/DC0%0/1
$inet6_class or ""
$inet6_class
Truth table0%0/2
A
A= $inet6_class
Aresult
11
00
58 ( $ssl_class ? $ssl_class->can_ipv6 : $inet6_class || '' )
59 eq 'IO::Socket::IP'
60 ? 'Family' : 'Domain';
61 }
62  
63 2 our @ISA = ('Exporter','Net::Cmd',$IOCLASS);
64  
65 2 ▶use constant TELNET_IAC => 255;
Subroutine BEGIN: called CC=1 SCAR=0.0
66 2 ▶use constant TELNET_IP => 244;
Subroutine BEGIN: called CC=1 SCAR=0.0
67 2 ▶use constant TELNET_DM => 242;
Subroutine BEGIN: called CC=1 SCAR=0.0
68  
69 2 ▶use constant EBCDIC => ord 'A' == 193;
Subroutine BEGIN: called CC=1 SCAR=0.0
70  
71 0 ▶sub new {
Subroutine new: not called CC=35 SCAR=71.4
Pod documented
72 0 my $pkg = shift;
73 0 my ($peer, %arg);
74 0 ▶ if (@_ % 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ % 2) { } 0 0 0
75 0 $peer = shift;
76 0 %arg = @_;
77 }
78 else {
79 0 %arg = @_;
80 0 $peer = delete $arg{Host};
81 }
82  
83 0 my $host = $peer;
84 0 my $fire = undef;
85 0 my $fire_type = undef;
86  
87 0 ▶ if (exists($arg{Firewall}) || Net::Config->requires_firewall($peer)) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $arg{"Firewall"} or "Net::Config"->requires_firewall($peer)) 0 0 0
Condition0%0/3
exists $arg{"Firewall"} or "Net::Config"->requires_firewall($peer)
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $arg{"Firewall"} or "Net::Config"->requires_firewall($peer)
exists $arg{"Firewall"} "Net::Config"->requires_firewall($peer)
Truth table0%0/3
A or B
A= exists $arg{"Firewall"}B= "Net::Config"->requires_firewall($peer)
ABresult
1X1
011
000
88 $fire = $arg{Firewall}
89 || $ENV{FTP_FIREWALL}
90 || $NetConfig{ftp_firewall}
91 0 ▶ || undef;
Condition0%0/8
$arg{'Firewall'} || $ENV{'FTP_FIREWALL'} || $Net::FTP::NetConfig{'ftp_firewall'} || undef
l!l
00
$arg{"Firewall"} or $ENV{"FTP_FIREWALL"} or $Net::FTP::NetConfig{"ftp_firewall"}
l!l&&r!l&&!r
000
$arg{"Firewall"} or $ENV{"FTP_FIREWALL"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$arg{'Firewall'} || $ENV{'FTP_FIREWALL'} || $Net::FTP::NetConfig{'ftp_firewall'} || undef
$arg{"Firewall"} $ENV{"FTP_FIREWALL"} $Net::FTP::NetConfig{"ftp_firewall"}
Truth table0%0/4
A or B or C
A= $arg{"Firewall"}B= $ENV{"FTP_FIREWALL"}C= $Net::FTP::NetConfig{"ftp_firewall"}
ABCresult
1XX1
01X1
0011
0000
92  
93 0 ▶ if (defined $fire) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $fire) 0 0 0
94 0 $peer = $fire;
95 0 delete $arg{Port};
96 $fire_type = $arg{FirewallType}
97 || $ENV{FTP_FIREWALL_TYPE}
98 || $NetConfig{firewall_type}
99 0 ▶ || undef;
Condition0%0/8
$arg{'FirewallType'} || $ENV{'FTP_FIREWALL_TYPE'} || $Net::FTP::NetConfig{'firewall_type'} || undef
l!l
00
$arg{"FirewallType"} or $ENV{"FTP_FIREWALL_TYPE"} or $Net::FTP::NetConfig{"firewall_type"}
l!l&&r!l&&!r
000
$arg{"FirewallType"} or $ENV{"FTP_FIREWALL_TYPE"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$arg{'FirewallType'} || $ENV{'FTP_FIREWALL_TYPE'} || $Net::FTP::NetConfig{'firewall_type'} || undef
$arg{"FirewallType"} $ENV{"FTP_FIREWALL_TYPE"} $Net::FTP::NetConfig{"firewall_type"}
Truth table0%0/4
A or B or C
A= $arg{"FirewallType"}B= $ENV{"FTP_FIREWALL_TYPE"}C= $Net::FTP::NetConfig{"firewall_type"}
ABCresult
1XX1
01X1
0011
0000
100 }
101 }
102  
103 0 my %tlsargs;
104 0 ▶ if (can_ssl()) {
Branch: 2 branches
BranchTrueFalseTotal
if (can_ssl()) { } 0 0 0
elsif ($arg{'SSL'}) { } 0 0 0
105 # for name verification strip port from domain:port, ipv4:port, [ipv6]:port
106 0 (my $hostname = $host) =~s{(?<!:):\d+$}{};
107 0 ▶ %tlsargs = (
Branch: 1 branch
BranchTrueFalseTotal
$pkg->can_client_sni ? : 0 0 0
108 SSL_verifycn_scheme => 'ftp',
109 SSL_verifycn_name => $hostname,
110 # use SNI if supported by IO::Socket::SSL
111 $pkg->can_client_sni ? (SSL_hostname => $hostname):(),
112 # reuse SSL session of control connection in data connections
113 SSL_session_cache_size => 10,
114 SSL_session_key => $hostname,
115 );
116 # user defined SSL arg
117 0 $tlsargs{$_} = $arg{$_} for(grep { m{^SSL_} } keys %arg);
118 0 ▶ $tlsargs{SSL_reuse_ctx} = IO::Socket::SSL::SSL_Context->new(%tlsargs)
Branch: 1 branch
BranchTrueFalseTotal
$tlsargs{"SSL_reuse_ctx"} = "IO::Socket::SSL::SSL_Context"->new(%tlsargs) or return 0 0 0
119 or return;
120  
121 } elsif ($arg{SSL}) {
122 0 croak("IO::Socket::SSL >= 2.007 needed for SSL support");
123 }
124  
125 my $ftp = $pkg->SUPER::new(
126 PeerAddr => $peer,
127 PeerPort => $arg{Port} || ($arg{SSL} ? 'ftps(990)' : 'ftp(21)'),
128 LocalAddr => $arg{'LocalAddr'},
129 $family_key => $arg{Domain} || $arg{Family},
130 Proto => 'tcp',
131 Timeout => defined $arg{Timeout} ? $arg{Timeout} : 120,
132 %tlsargs,
133 0 ▶ $arg{SSL} ? ():( SSL_startHandshake => 0 ),
Branch: 4 branches
BranchTrueFalseTotal
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)) or return 0 0 0
$arg{'SSL'} ? : 0 0 0
defined $arg{'Timeout'} ? : 0 0 0
$arg{'SSL'} ? : 0 0 0
Condition0%0/6
$arg{'Port'} || ($arg{'SSL'} ? 'ftps(990)' : 'ftp(21)')
l!l&&r!l&&!r
000
$arg{'Domain'} || $arg{'Family'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$arg{'Port'} || ($arg{'SSL'} ? 'ftps(990)' : 'ftp(21)')
$arg{'Port'} ($arg{'SSL'} ? 'ftps(990)' : 'ftp(21)')
MC/DC0%0/2
$arg{'Domain'} || $arg{'Family'}
$arg{'Domain'} $arg{'Family'}
Truth table0%0/3
A || B
A= $arg{'Port'}B= ($arg{'SSL'} ? 'ftps(990)' : 'ftp(21)')
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= $arg{'Domain'}B= $arg{'Family'}
ABresult
1X1
011
000
134 ) or return;
135  
136 0 ${*$ftp}{'net_ftp_host'} = $host; # Remote hostname
137 0 ${*$ftp}{'net_ftp_type'} = 'A'; # ASCII/binary/etc mode
138 0 ▶ ${*$ftp}{'net_ftp_blksize'} = abs($arg{'BlockSize'} || 10240);
Condition0%0/2
$arg{'BlockSize'} || 10240
l!l
00
MC/DC0%0/1
$arg{'BlockSize'} || 10240
$arg{'BlockSize'}
Truth table0%0/2
A
A= $arg{'BlockSize'}
Aresult
11
00
139  
140 0 ${*$ftp}{'net_ftp_localaddr'} = $arg{'LocalAddr'};
141 0 ▶ ${*$ftp}{'net_ftp_domain'} = $arg{Domain} || $arg{Family};
Condition0%0/3
$arg{'Domain'} || $arg{'Family'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$arg{'Domain'} || $arg{'Family'}
$arg{'Domain'} $arg{'Family'}
Truth table0%0/3
A || B
A= $arg{'Domain'}B= $arg{'Family'}
ABresult
1X1
011
000
142  
143 0 ▶ ${*$ftp}{'net_ftp_firewall'} = $fire
Branch: 1 branch
BranchTrueFalseTotal
if defined $fire 0 0 0
144 if (defined $fire);
145 0 ▶ ${*$ftp}{'net_ftp_firewall_type'} = $fire_type
Branch: 1 branch
BranchTrueFalseTotal
if defined $fire_type 0 0 0
146 if (defined $fire_type);
147  
148 0 ${*$ftp}{'net_ftp_passive'} =
149 int exists $arg{Passive} ? $arg{Passive}
150 : exists $ENV{FTP_PASSIVE} ? $ENV{FTP_PASSIVE}
151 : defined $fire ? $NetConfig{ftp_ext_passive}
152 0 ▶ : $NetConfig{ftp_int_passive}; # Whew! :-)
Branch: 3 branches
BranchTrueFalseTotal
int exists $arg{'Passive'} ? : 0 0 0
exists $ENV{'FTP_PASSIVE'} ? : 0 0 0
defined $fire ? : 0 0 0
153  
154 0 ▶ ${*$ftp}{net_ftp_tlsargs} = \%tlsargs if %tlsargs;
Branch: 1 branch
BranchTrueFalseTotal
if %tlsargs 0 0 0
155 0 ▶ if ($arg{SSL}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($arg{"SSL"}) 0 0 0
156 0 ${*$ftp}{net_ftp_tlsprot} = 'P';
157 0 ${*$ftp}{net_ftp_tlsdirect} = 1;
158 }
159  
160 0 ▶ $ftp->hash(exists $arg{Hash} ? $arg{Hash} : 0, 1024);
Branch: 1 branch
BranchTrueFalseTotal
exists $arg{'Hash'} ? : 0 0 0
161  
162 0 $ftp->autoflush(1);
163  
164 0 ▶ $ftp->debug(exists $arg{Debug} ? $arg{Debug} : undef);
Branch: 1 branch
BranchTrueFalseTotal
exists $arg{'Debug'} ? : 0 0 0
165  
166 0 ▶ unless ($ftp->response() == CMD_OK) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ftp->response == 2) 0 0 0
167 0 $ftp->close();
168 # keep @$ if no message. Happens, when response did not start with a code.
169 0 ▶ $@ = $ftp->message || $@;
Condition0%0/3
$ftp->message || $@
l!l&&r!l&&!r
000
MC/DC0%0/2
$ftp->message || $@
$ftp->message $@
Truth table0%0/3
A || B
A= $ftp->messageB= $@
ABresult
1X1
011
000
170 0 undef $ftp;
171 }
172  
173 0 $ftp;
174 }
175  
176 ##
177 ## User interface methods
178 ##
179  
180  
181 0 ▶sub host {
Subroutine host: not called CC=1 SCAR=6.9
Pod documented
182 0 my $me = shift;
183 0 ${*$me}{'net_ftp_host'};
184 }
185  
186 0 ▶sub passive {
Subroutine passive: not called CC=2 SCAR=17.9
Pod documented
187 0 my $ftp = shift;
188 0 ▶ return ${*$ftp}{'net_ftp_passive'} unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
189 0 ${*$ftp}{'net_ftp_passive'} = shift;
190 }
191  
192  
193 0 ▶sub hash {
Subroutine hash: not called CC=5 SCAR=34.0
Pod documented
194 0 my $ftp = shift; # self
195  
196 0 my ($h, $b) = @_;
197 0 ▶ unless ($h) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($h) 0 0 0
198 0 delete ${*$ftp}{'net_ftp_hash'};
199 0 return [\*STDERR, 0];
200 }
201 0 ▶ ($h, $b) = (ref($h) ? $h : \*STDERR, $b || 1024);
Branch: 1 branch
BranchTrueFalseTotal
ref $h ? : 0 0 0
Condition0%0/2
$b || 1024
l!l
00
MC/DC0%0/1
$b || 1024
$b
Truth table0%0/2
A
A= $b
Aresult
11
00
202 0 select((select($h), $| = 1)[0]);
203 0 ▶ $b = 512 if $b < 512;
Branch: 1 branch
BranchTrueFalseTotal
if $b < 512 0 0 0
204 0 ${*$ftp}{'net_ftp_hash'} = [$h, $b];
205 }
206  
207  
208 0 ▶sub quit {
Subroutine quit: not called CC=1 SCAR=6.9
Pod documented
209 0 my $ftp = shift;
210  
211 0 $ftp->_QUIT;
212 0 $ftp->close;
213 }
214  
215  
216 0 ▶sub DESTROY { }
Subroutine DESTROY: not called CC=1 SCAR=0.0
217  
218  
219 0 ▶sub ascii { shift->type('A', @_); }
Subroutine ascii: not called CC=1 SCAR=6.9
Pod documented
220 0 ▶sub binary { shift->type('I', @_); }
Subroutine binary: not called CC=1 SCAR=6.9
Pod documented
221  
222  
223 0 ▶sub ebcdic {
Subroutine ebcdic: not called CC=1 SCAR=6.9
Pod undocumented
224 0 carp "TYPE E is unsupported, shall default to I";
225 0 shift->type('E', @_);
226 }
227  
228  
229 0 ▶sub byte {
Subroutine byte: not called CC=1 SCAR=6.9
Pod undocumented
230 0 carp "TYPE L is unsupported, shall default to I";
231 0 shift->type('L', @_);
232 }
233  
234 # Allow the user to send a command directly, BE CAREFUL !!
235  
236  
237 0 ▶sub quot {
Subroutine quot: not called CC=1 SCAR=6.9
Pod documented
238 0 my $ftp = shift;
239 0 my $cmd = shift;
240  
241 0 $ftp->command(uc $cmd, @_);
242 0 $ftp->response();
243 }
244  
245  
246 0 ▶sub site {
Subroutine site: not called CC=1 SCAR=6.9
Pod documented
247 0 my $ftp = shift;
248  
249 0 $ftp->command("SITE", @_);
250 0 $ftp->response();
251 }
252  
253  
254 0 ▶sub mdtm {
Subroutine mdtm: not called CC=4 SCAR=30.0
Pod documented
255 0 my $ftp = shift;
256 0 my $file = shift;
257  
258 # Server Y2K bug workaround
259 #
260 # sigh; some idiotic FTP servers use ("19%d",tm.tm_year) instead of
261 # ("%d",tm.tm_year+1900). This results in an extra digit in the
262 # string returned. To account for this we allow an optional extra
263 # digit in the year. Then if the first two digits are 19 we use the
264 # remainder, otherwise we subtract 1900 from the whole year.
265  
266 0 ▶ $ftp->_MDTM($file)
Branch: 2 branches
BranchTrueFalseTotal
$ftp->_MDTM($file) && $ftp->message =~ /((\d\d)(\d\d\d?))(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/ ? : 0 0 0
$2 eq '19' ? : 0 0 0
Condition0%0/3
$ftp->_MDTM($file) and $ftp->message =~ /((\d\d)(\d\d\d?))(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/
!ll&&!rl&&r
000
MC/DC0%0/2
$ftp->_MDTM($file) and $ftp->message =~ /((\d\d)(\d\d\d?))(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/
$ftp->_MDTM($file) $ftp->message =~ /((\d\d)(\d\d\d?))(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/
Truth table0%0/3
A and B
A= $ftp->_MDTM($file)B= $ftp->message =~ /((\d\d)(\d\d\d?))(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/
ABresult
0X0
100
111
267 && $ftp->message =~ /((\d\d)(\d\d\d?))(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/
268 ? timegm($8, $7, $6, $5, $4 - 1, $2 eq '19' ? ($3 + 1900) : $1)
269 : undef;
270 }
271  
272  
273 0 ▶sub size {
Subroutine size: not called CC=10 SCAR=47.0
Pod documented
274 0 my $ftp = shift;
275 0 my $file = shift;
276 0 my $io;
277 0 ▶ if ($ftp->supported("SIZE")) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ftp->supported('SIZE')) { } 0 0 0
elsif ($ftp->supported('STAT')) { } 0 0 0
278 0 ▶ return $ftp->_SIZE($file)
Branch: 1 branch
BranchTrueFalseTotal
$ftp->_SIZE($file) ? : 0 0 0
279 ? ($ftp->message =~ /(\d+)\s*(bytes?\s*)?$/)[0]
280 : undef;
281 }
282 elsif ($ftp->supported("STAT")) {
283 0 my @msg;
284 return
285 0 ▶ unless $ftp->_STAT($file) && (@msg = $ftp->message) == 3;
Branch: 1 branch
BranchTrueFalseTotal
unless $ftp->_STAT($file) and (@msg = $ftp->message) == 3 0 0 0
Condition0%0/3
$ftp->_STAT($file) and (@msg = $ftp->message) == 3
!ll&&!rl&&r
000
MC/DC0%0/2
$ftp->_STAT($file) and (@msg = $ftp->message) == 3
$ftp->_STAT($file) (@msg = $ftp->message) == 3
Truth table0%0/3
A and B
A= $ftp->_STAT($file)B= (@msg = $ftp->message) == 3
ABresult
0X0
100
111
286 0 foreach my $line (@msg) {
287 0 ▶ return (split(/\s+/, $line))[4]
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /^[-rwxSsTt]{10}/ 0 0 0
288 if $line =~ /^[-rwxSsTt]{10}/;
289 }
290 }
291 else {
292 0 my @files = $ftp->dir($file);
293 0 ▶ if (@files) {
Branch: 1 branch
BranchTrueFalseTotal
if (@files) 0 0 0
294 0 ▶ return (split(/\s+/, $1))[4]
Branch: 1 branch
BranchTrueFalseTotal
if $files[0] =~ /^([-rwxSsTt]{10}.*)$/ 0 0 0
295 if $files[0] =~ /^([-rwxSsTt]{10}.*)$/;
296 }
297 }
298 0 undef;
299 }
300  
301  
302 0 ▶sub starttls {
Subroutine starttls: not called CC=5 SCAR=34.0
Pod documented
303 0 my $ftp = shift;
304 0 ▶ can_ssl() or croak("IO::Socket::SSL >= 2.007 needed for SSL support");
Branch: 1 branch
BranchTrueFalseTotal
can_ssl() or croak("IO::Socket::SSL >= 2.007 needed for SSL support") 0 0 0
305 0 ▶ $ftp->is_SSL and croak("called starttls within SSL session");
Branch: 1 branch
BranchTrueFalseTotal
$ftp->is_SSL and croak("called starttls within SSL session") 0 0 0
306 0 ▶ $ftp->_AUTH('TLS') == CMD_OK or return;
Branch: 1 branch
BranchTrueFalseTotal
$ftp->_AUTH("TLS") == 2 or return 0 0 0
307  
308 0 ▶ $ftp->connect_SSL or return;
Branch: 1 branch
BranchTrueFalseTotal
$ftp->connect_SSL or return 0 0 0
309 0 $ftp->prot('P');
310 0 return 1;
311 }
312  
313 0 ▶sub prot {
Subroutine prot: not called CC=5 SCAR=34.0
Pod documented
314 0 my ($ftp,$prot) = @_;
315 0 ▶ $prot eq 'C' or $prot eq 'P' or croak("prot must by C or P");
Branch: 1 branch
BranchTrueFalseTotal
$prot eq "C" or $prot eq "P" or croak("prot must by C or P") 0 0 0
Condition0%0/3
$prot eq "C" or $prot eq "P"
l!l&&r!l&&!r
000
MC/DC0%0/2
$prot eq "C" or $prot eq "P"
$prot eq "C" $prot eq "P"
Truth table0%0/3
A or B
A= $prot eq "C"B= $prot eq "P"
ABresult
1X1
011
000
316 0 ▶ $ftp->_PBSZ(0) or return;
Branch: 1 branch
BranchTrueFalseTotal
$ftp->_PBSZ(0) or return 0 0 0
317 0 ▶ $ftp->_PROT($prot) or return;
Branch: 1 branch
BranchTrueFalseTotal
$ftp->_PROT($prot) or return 0 0 0
318 0 ${*$ftp}{net_ftp_tlsprot} = $prot;
319 0 return 1;
320 }
321  
322 0 ▶sub stoptls {
Subroutine stoptls: not called CC=4 SCAR=30.0
Pod documented
323 0 my $ftp = shift;
324 0 ▶ $ftp->is_SSL or croak("called stoptls outside SSL session");
Branch: 1 branch
BranchTrueFalseTotal
$ftp->is_SSL or croak("called stoptls outside SSL session") 0 0 0
325 0 ▶ ${*$ftp}{net_ftp_tlsdirect} and croak("cannot stoptls direct SSL session");
Branch: 1 branch
BranchTrueFalseTotal
do { *$ftp }->{"net_ftp_tlsdirect"} and croak("cannot stoptls direct SSL session") 0 0 0
326 0 ▶ $ftp->_CCC() or return;
Branch: 1 branch
BranchTrueFalseTotal
$ftp->_CCC or return 0 0 0
327 0 $ftp->stop_SSL();
328 0 return 1;
329 }
330  
331 0 ▶sub login {
Subroutine login: not called CC=41 SCAR=74.5
Pod documented
332 0 my ($ftp, $user, $pass, $acct) = @_;
333 0 my ($ok, $ruser, $fwtype);
334  
335 0 ▶ unless (defined $user) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $user) 0 0 0
336 0 require Net::Netrc;
337  
338 0 my $rc = Net::Netrc->lookup(${*$ftp}{'net_ftp_host'});
339  
340 0 ▶ ($user, $pass, $acct) = $rc->lpa()
Branch: 1 branch
BranchTrueFalseTotal
if $rc 0 0 0
341 if ($rc);
342 }
343  
344 0 ▶ $user ||= "anonymous";
Condition0%0/2
$user ||= "anonymous"
l!l
00
MC/DC0%0/1
$user ||= "anonymous"
$user
Truth table0%0/2
A
A= $user
Aresult
11
00
345 0 $ruser = $user;
346  
347 0 $fwtype = ${*$ftp}{'net_ftp_firewall_type'}
348 0 ▶ || $NetConfig{'ftp_firewall_type'}
Condition0%0/5
do { *$ftp }->{'net_ftp_firewall_type'} || $Net::FTP::NetConfig{'ftp_firewall_type'} || 0
l!l
00
do { *$ftp }->{"net_ftp_firewall_type"} or $Net::FTP::NetConfig{"ftp_firewall_type"}
l!l&&r!l&&!r
000
MC/DC0%0/2
do { *$ftp }->{'net_ftp_firewall_type'} || $Net::FTP::NetConfig{'ftp_firewall_type'} || 0
do { *$ftp }->{"net_ftp_firewall_type"} $Net::FTP::NetConfig{"ftp_firewall_type"}
Truth table0%0/3
A or B
A= do { *$ftp }->{"net_ftp_firewall_type"}B= $Net::FTP::NetConfig{"ftp_firewall_type"}
ABresult
1X1
011
000
349 || 0;
350  
351 0 ▶ if ($fwtype && defined ${*$ftp}{'net_ftp_firewall'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fwtype and defined do { *$ftp }->{"net_ftp_firewall"}) 0 0 0
Condition0%0/3
$fwtype and defined do { *$ftp }->{"net_ftp_firewall"}
!ll&&!rl&&r
000
MC/DC0%0/2
$fwtype and defined do { *$ftp }->{"net_ftp_firewall"}
$fwtype defined do { *$ftp }->{"net_ftp_firewall"}
Truth table0%0/3
A and B
A= $fwtypeB= defined do { *$ftp }->{"net_ftp_firewall"}
ABresult
0X0
100
111
352 0 ▶ if ($fwtype == 1 || $fwtype == 7) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fwtype == 1 or $fwtype == 7) { } 0 0 0
Condition0%0/3
$fwtype == 1 or $fwtype == 7
l!l&&r!l&&!r
000
MC/DC0%0/2
$fwtype == 1 or $fwtype == 7
$fwtype == 1 $fwtype == 7
Truth table0%0/3
A or B
A= $fwtype == 1B= $fwtype == 7
ABresult
1X1
011
000
353 0 $user .= '@' . ${*$ftp}{'net_ftp_host'};
354 }
355 else {
356 0 require Net::Netrc;
357  
358 0 my $rc = Net::Netrc->lookup(${*$ftp}{'net_ftp_firewall'});
359  
360 0 ▶ my ($fwuser, $fwpass, $fwacct) = $rc ? $rc->lpa() : ();
Branch: 1 branch
BranchTrueFalseTotal
$rc ? : 0 0 0
361  
362 0 ▶ if ($fwtype == 5) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fwtype == 5) { } 0 0 0
363 0 $user = join('@', $user, $fwuser, ${*$ftp}{'net_ftp_host'});
364 0 $pass = $pass . '@' . $fwpass;
365 }
366 else {
367 0 ▶ if ($fwtype == 2) {
Branch: 2 branches
BranchTrueFalseTotal
if ($fwtype == 2) { } 0 0 0
elsif ($fwtype == 6) { } 0 0 0
368 0 $user .= '@' . ${*$ftp}{'net_ftp_host'};
369 }
370 elsif ($fwtype == 6) {
371 0 $fwuser .= '@' . ${*$ftp}{'net_ftp_host'};
372 }
373  
374 0 $ok = $ftp->_USER($fwuser);
375  
376 0 ▶ return 0 unless $ok == CMD_OK || $ok == CMD_MORE;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok == 2 or $ok == 3 0 0 0
Condition0%0/3
$ok == 2 or $ok == 3
l!l&&r!l&&!r
000
MC/DC0%0/2
$ok == 2 or $ok == 3
$ok == 2 $ok == 3
Truth table0%0/3
A or B
A= $ok == 2B= $ok == 3
ABresult
1X1
011
000
377  
378 0 ▶ $ok = $ftp->_PASS($fwpass || "");
Condition0%0/2
$fwpass || ''
l!l
00
MC/DC0%0/1
$fwpass || ''
$fwpass
Truth table0%0/2
A
A= $fwpass
Aresult
11
00
379  
380 0 ▶ return 0 unless $ok == CMD_OK || $ok == CMD_MORE;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok == 2 or $ok == 3 0 0 0
Condition0%0/3
$ok == 2 or $ok == 3
l!l&&r!l&&!r
000
MC/DC0%0/2
$ok == 2 or $ok == 3
$ok == 2 $ok == 3
Truth table0%0/3
A or B
A= $ok == 2B= $ok == 3
ABresult
1X1
011
000
381  
382 0 ▶ $ok = $ftp->_ACCT($fwacct)
Branch: 1 branch
BranchTrueFalseTotal
if defined $fwacct 0 0 0
383 if defined($fwacct);
384  
385 0 ▶ if ($fwtype == 3) {
Branch: 2 branches
BranchTrueFalseTotal
if ($fwtype == 3) { } 0 0 0
elsif ($fwtype == 4) { } 0 0 0
386 0 $ok = $ftp->command("SITE", ${*$ftp}{'net_ftp_host'})->response;
387 }
388 elsif ($fwtype == 4) {
389 0 $ok = $ftp->command("OPEN", ${*$ftp}{'net_ftp_host'})->response;
390 }
391  
392 0 ▶ return 0 unless $ok == CMD_OK || $ok == CMD_MORE;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok == 2 or $ok == 3 0 0 0
Condition0%0/3
$ok == 2 or $ok == 3
l!l&&r!l&&!r
000
MC/DC0%0/2
$ok == 2 or $ok == 3
$ok == 2 $ok == 3
Truth table0%0/3
A or B
A= $ok == 2B= $ok == 3
ABresult
1X1
011
000
393 }
394 }
395 }
396  
397 0 $ok = $ftp->_USER($user);
398  
399 # Some dumb firewalls don't prefix the connection messages
400 0 ▶ $ok = $ftp->response()
Branch: 1 branch
BranchTrueFalseTotal
if $ok == 2 and $ftp->code == 220 and $user =~ /\@/ 0 0 0
Condition0%0/6
$ok == 2 and $ftp->code == 220 and $user =~ /\@/
!ll&&!rl&&r
000
$ok == 2 and $ftp->code == 220
!ll&&!rl&&r
000
MC/DC0%0/3
$ok == 2 and $ftp->code == 220 and $user =~ /\@/
$ok == 2 $ftp->code == 220 $user =~ /\@/
Truth table0%0/4
A and B and C
A= $ok == 2B= $ftp->code == 220C= $user =~ /\@/
ABCresult
0XX0
10X0
1100
1111
401 if ($ok == CMD_OK && $ftp->code == 220 && $user =~ /\@/);
402  
403 0 ▶ if ($ok == CMD_MORE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ok == 3) 0 0 0
404 0 ▶ unless (defined $pass) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $pass) 0 0 0
405 0 require Net::Netrc;
406  
407 0 my $rc = Net::Netrc->lookup(${*$ftp}{'net_ftp_host'}, $ruser);
408  
409 0 ▶ ($ruser, $pass, $acct) = $rc->lpa()
Branch: 1 branch
BranchTrueFalseTotal
if $rc 0 0 0
410 if ($rc);
411  
412 0 ▶ $pass = '-anonymous@'
Branch: 1 branch
BranchTrueFalseTotal
if not defined $pass and !defined($ruser) || $ruser =~ /^anonymous/o 0 0 0
Condition0%0/6
not defined $pass and !defined($ruser) || $ruser =~ /^anonymous/o
!ll&&!rl&&r
000
not defined $ruser or $ruser =~ /^anonymous/o
l!l&&r!l&&!r
000
MC/DC0%0/3
not defined $pass and !defined($ruser) || $ruser =~ /^anonymous/o
not defined $pass not defined $ruser $ruser =~ /^anonymous/o
Truth table0%0/4
not(A) and not(B) or C
A= not defined $passB= not defined $ruserC= $ruser =~ /^anonymous/o
ABCresult
0XX0
1000
11X1
1011
413 if (!defined $pass && (!defined($ruser) || $ruser =~ /^anonymous/o));
414 }
415  
416 0 ▶ $ok = $ftp->_PASS($pass || "");
Condition0%0/2
$pass || ''
l!l
00
MC/DC0%0/1
$pass || ''
$pass
Truth table0%0/2
A
A= $pass
Aresult
11
00
417 }
418  
419 0 ▶ $ok = $ftp->_ACCT($acct)
Branch: 1 branch
BranchTrueFalseTotal
if defined $acct and $ok == 3 || $ok == 2 0 0 0
Condition0%0/6
defined $acct and $ok == 3 || $ok == 2
!ll&&!rl&&r
000
$ok == 3 or $ok == 2
l!l&&r!l&&!r
000
MC/DC0%0/3
defined $acct and $ok == 3 || $ok == 2
defined $acct $ok == 3 $ok == 2
Truth table0%0/4
A and B or C
A= defined $acctB= $ok == 3C= $ok == 2
ABCresult
0XX0
1000
11X1
1011
420 if (defined($acct) && ($ok == CMD_MORE || $ok == CMD_OK));
421  
422 0 ▶ if ($fwtype == 7 && $ok == CMD_OK && defined ${*$ftp}{'net_ftp_firewall'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fwtype == 7 and $ok == 2 and defined do { *$ftp }->{"net_ftp_firewall"}) 0 0 0
Condition0%0/6
$fwtype == 7 and $ok == 2 and defined do { *$ftp }->{"net_ftp_firewall"}
!ll&&!rl&&r
000
$fwtype == 7 and $ok == 2
!ll&&!rl&&r
000
MC/DC0%0/3
$fwtype == 7 and $ok == 2 and defined do { *$ftp }->{"net_ftp_firewall"}
$fwtype == 7 $ok == 2 defined do { *$ftp }->{"net_ftp_firewall"}
Truth table0%0/4
A and B and C
A= $fwtype == 7B= $ok == 2C= defined do { *$ftp }->{"net_ftp_firewall"}
ABCresult
0XX0
10X0
1100
1111
423 0 my ($f, $auth, $resp) = _auth_id($ftp);
424 0 ▶ $ftp->authorize($auth, $resp) if defined($resp);
Branch: 1 branch
BranchTrueFalseTotal
if defined $resp 0 0 0
425 }
426  
427 0 $ok == CMD_OK;
428 }
429  
430  
431 0 ▶sub account {
Subroutine account: not called CC=2 SCAR=17.9
Pod documented
432 0 ▶ @_ == 2 or croak 'usage: $ftp->account($acct)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$ftp->account(\$acct)") 0 0 0
433 0 my $ftp = shift;
434 0 my $acct = shift;
435 0 $ftp->_ACCT($acct) == CMD_OK;
436 }
437  
438  
439 0 ▶sub _auth_id {
Subroutine _auth_id: not called CC=6 SCAR=37.4
440 0 my ($ftp, $auth, $resp) = @_;
441  
442 0 ▶ unless (defined $resp) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $resp) 0 0 0
443 0 require Net::Netrc;
444  
445 0 ▶ $auth ||= eval { (getpwuid($>))[0] } || $ENV{NAME};
Condition0%0/6
$auth ||= eval { do { (getpwuid $>)[0] } } || $ENV{"NAME"}
l!l&&r!l&&!r
000
eval { do { (getpwuid $>)[0] } } || $ENV{'NAME'}
l!l&&r!l&&!r
000
MC/DC0%0/3
$auth ||= eval { do { (getpwuid $>)[0] } } || $ENV{"NAME"}
$auth eval { do { (getpwuid $>)[0] } } $ENV{'NAME'}
Truth table0%0/4
A ||= B || C
A= $authB= eval { do { (getpwuid $>)[0] } }C= $ENV{'NAME'}
ABCresult
1XX1
01X1
0011
0000
446  
447 0 my $rc = Net::Netrc->lookup(${*$ftp}{'net_ftp_firewall'}, $auth)
448 0 ▶ || Net::Netrc->lookup(${*$ftp}{'net_ftp_firewall'});
Condition0%0/3
'Net::Netrc'->lookup(do { *$ftp }->{'net_ftp_firewall'}, $auth) || 'Net::Netrc'->lookup(do { *$ftp }->{'net_ftp_firewall'})
l!l&&r!l&&!r
000
MC/DC0%0/2
'Net::Netrc'->lookup(do { *$ftp }->{'net_ftp_firewall'}, $auth) || 'Net::Netrc'->lookup(do { *$ftp }->{'net_ftp_firewall'})
'Net::Netrc'->lookup(do { *$ftp }->{'net_ftp_firewall'}, $auth) 'Net::Netrc'->lookup(do { *$ftp }->{'net_ftp_firewall'})
Truth table0%0/3
A || B
A= 'Net::Netrc'->lookup(do { *$ftp }->{'net_ftp_firewall'}, $auth)B= 'Net::Netrc'->lookup(do { *$ftp }->{'net_ftp_firewall'})
ABresult
1X1
011
000
449  
450 0 ▶ ($auth, $resp) = $rc->lpa()
Branch: 1 branch
BranchTrueFalseTotal
if $rc 0 0 0
451 if ($rc);
452 }
453 0 ($ftp, $auth, $resp);
454 }
455  
456  
457 0 ▶sub authorize {
Subroutine authorize: not called CC=6 SCAR=37.4
Pod documented
458 0 ▶ @_ >= 1 || @_ <= 3 or croak 'usage: $ftp->authorize([$auth[, $resp]])';
Branch: 1 branch
BranchTrueFalseTotal
@_ >= 1 or @_ <= 3 or croak("usage: \$ftp->authorize([\$auth[, \$resp]])") 0 0 0
Condition0%0/3
@_ >= 1 or @_ <= 3
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ >= 1 or @_ <= 3
@_ >= 1 @_ <= 3
Truth table0%0/3
A or B
A= @_ >= 1B= @_ <= 3
ABresult
1X1
011
000
459  
460 0 my ($ftp, $auth, $resp) = &_auth_id;
461  
462 0 ▶ my $ok = $ftp->_AUTH($auth || "");
Condition0%0/2
$auth || ''
l!l
00
MC/DC0%0/1
$auth || ''
$auth
Truth table0%0/2
A
A= $auth
Aresult
11
00
463  
464 0 ▶ return $ftp->_RESP($resp || "")
Branch: 1 branch
BranchTrueFalseTotal
if $ok == 3 0 0 0
Condition0%0/2
$resp || ''
l!l
00
MC/DC0%0/1
$resp || ''
$resp
Truth table0%0/2
A
A= $resp
Aresult
11
00
465 if ($ok == CMD_MORE);
466  
467 0 $ok == CMD_OK;
468 }
469  
470  
471 0 ▶sub rename {
Subroutine rename: not called CC=3 SCAR=24.8
Pod documented
472 0 ▶ @_ == 3 or croak 'usage: $ftp->rename($oldname, $newname)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 3 or croak("usage: \$ftp->rename(\$oldname, \$newname)") 0 0 0
473  
474 0 my ($ftp, $oldname, $newname) = @_;
475  
476 0 ▶ $ftp->_RNFR($oldname)
Branch: 1 branch
BranchTrueFalseTotal
$ftp->_RNFR($oldname) and $ftp->_RNTO($newname) 0 0 0
477 && $ftp->_RNTO($newname);
478 }
479  
480  
481 0 ▶sub type {
Subroutine type: not called CC=3 SCAR=24.8
Pod documented
482 0 my $ftp = shift;
483 0 my $type = shift;
484 0 my $oldval = ${*$ftp}{'net_ftp_type'};
485  
486 0 ▶ return $oldval
Branch: 1 branch
BranchTrueFalseTotal
unless defined $type 0 0 0
487 unless (defined $type);
488  
489 return
490 0 ▶ unless ($ftp->_TYPE($type, @_));
Branch: 1 branch
BranchTrueFalseTotal
unless $ftp->_TYPE($type, @_) 0 0 0
491  
492 0 ${*$ftp}{'net_ftp_type'} = join(" ", $type, @_);
493  
494 0 $oldval;
495 }
496  
497  
498 0 ▶sub alloc {
Subroutine alloc: not called CC=4 SCAR=30.0
Pod documented
499 0 my $ftp = shift;
500 0 my $size = shift;
501 0 my $oldval = ${*$ftp}{'net_ftp_allo'};
502  
503 0 ▶ return $oldval
Branch: 1 branch
BranchTrueFalseTotal
unless defined $size 0 0 0
504 unless (defined $size);
505  
506 return
507 0 ▶ unless ($ftp->supported("ALLO") and $ftp->_ALLO($size, @_));
Branch: 1 branch
BranchTrueFalseTotal
unless $ftp->supported("ALLO") and $ftp->_ALLO($size, @_) 0 0 0
Condition0%0/3
$ftp->supported("ALLO") and $ftp->_ALLO($size, @_)
!ll&&!rl&&r
000
MC/DC0%0/2
$ftp->supported("ALLO") and $ftp->_ALLO($size, @_)
$ftp->supported("ALLO") $ftp->_ALLO($size, @_)
Truth table0%0/3
A and B
A= $ftp->supported("ALLO")B= $ftp->_ALLO($size, @_)
ABresult
0X0
100
111
508  
509 0 ${*$ftp}{'net_ftp_allo'} = join(" ", $size, @_);
510  
511 0 $oldval;
512 }
513  
514  
515 0 ▶sub abort {
Subroutine abort: not called CC=2 SCAR=17.9
Pod documented
516 0 my $ftp = shift;
517  
518 0 send($ftp, pack("CCC", TELNET_IAC, TELNET_IP, TELNET_IAC), MSG_OOB);
519  
520 0 $ftp->command(pack("C", TELNET_DM) . "ABOR");
521  
522 0 ${*$ftp}{'net_ftp_dataconn'}->close()
523 0 ▶ if defined ${*$ftp}{'net_ftp_dataconn'};
Branch: 1 branch
BranchTrueFalseTotal
if defined do { *$ftp }->{"net_ftp_dataconn"} 0 0 0
524  
525 0 $ftp->response();
526  
527 0 $ftp->status == CMD_OK;
528 }
529  
530  
531 0 ▶sub get {
Subroutine get: not called CC=21 SCAR=61.4
Pod documented
532 0 my ($ftp, $remote, $local, $where) = @_;
533  
534 0 my ($loc, $len, $buf, $resp, $data);
535 0 local *FD;
536  
537 0 ▶ my $localfd = ref($local) || ref(\$local) eq "GLOB";
Condition0%0/3
ref $local || ref \$local eq 'GLOB'
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $local || ref \$local eq 'GLOB'
ref $local ref \$local eq 'GLOB'
Truth table0%0/3
A || B
A= ref $localB= ref \$local eq 'GLOB'
ABresult
1X1
011
000
538  
539 0 ▶ ($local = $remote) =~ s#^.*/##
Branch: 1 branch
BranchTrueFalseTotal
unless defined $local 0 0 0
540 unless (defined $local);
541  
542 0 ▶ croak("Bad remote filename '$remote'\n")
Branch: 1 branch
BranchTrueFalseTotal
if $remote =~ /[\r\n]/s 0 0 0
543 if $remote =~ /[\r\n]/s;
544  
545 0 ▶ ${*$ftp}{'net_ftp_rest'} = $where if defined $where;
Branch: 1 branch
BranchTrueFalseTotal
if defined $where 0 0 0
546 0 my $rest = ${*$ftp}{'net_ftp_rest'};
547  
548 0 delete ${*$ftp}{'net_ftp_port'};
549 0 delete ${*$ftp}{'net_ftp_pasv'};
550  
551 0 ▶ $data = $ftp->retr($remote)
Branch: 1 branch
BranchTrueFalseTotal
$data = $ftp->retr($remote) or return 0 0 0
552 or return;
553  
554 0 ▶ if ($localfd) {
Branch: 1 branch
BranchTrueFalseTotal
if ($localfd) { } 0 0 0
555 0 $loc = $local;
556 }
557 else {
558 0 $loc = \*FD;
559  
560 0 ▶ unless (sysopen($loc, $local, O_CREAT | O_WRONLY | ($rest ? O_APPEND: O_TRUNC))) {
Branch: 2 branches
BranchTrueFalseTotal
unless (sysopen $loc, $local, 65 | ($rest ? 1024 : 512)) 0 0 0
$rest ? : 0 0 0
561 0 carp "Cannot open Local file $local: $!\n";
562 0 $data->abort;
563 0 return;
564 }
565 }
566  
567 0 ▶ if ($ftp->type eq 'I' && !binmode($loc)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ftp->type eq "I" and not binmode($loc)) 0 0 0
Condition0%0/3
$ftp->type eq "I" and not binmode($loc)
!ll&&!rl&&r
000
MC/DC0%0/2
$ftp->type eq "I" and not binmode($loc)
$ftp->type eq "I" not binmode($loc)
Truth table0%0/3
A and not(B)
A= $ftp->type eq "I"B= not binmode($loc)
ABresult
0X0
100
111
568 0 carp "Cannot binmode Local file $local: $!\n";
569 0 $data->abort;
570 0 ▶ close($loc) unless $localfd;
Branch: 1 branch
BranchTrueFalseTotal
unless $localfd 0 0 0
571 0 return;
572 }
573  
574 0 $buf = '';
575 0 my ($count, $hashh, $hashb, $ref) = (0);
576  
577 ($hashh, $hashb) = @$ref
578 0 ▶ if ($ref = ${*$ftp}{'net_ftp_hash'});
Branch: 1 branch
BranchTrueFalseTotal
if $ref = do { *$ftp }->{"net_ftp_hash"} 0 0 0
579  
580 0 my $blksize = ${*$ftp}{'net_ftp_blksize'};
581 0 local $\; # Just in case
582  
583 0 while (1) {
584 0 ▶ last unless $len = $data->read($buf, $blksize);
Branch: 1 branch
BranchTrueFalseTotal
unless $len = $data->read($buf, $blksize) 0 0 0
585  
586 0 if (EBCDIC && $ftp->type ne 'I') {
587 $buf = $ftp->toebcdic($buf);
588 $len = length($buf);
589 }
590  
591 0 ▶ if ($hashh) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hashh) 0 0 0
592 0 $count += $len;
593 0 print $hashh "#" x (int($count / $hashb));
594 0 $count %= $hashb;
595 }
596 0 ▶ unless (print $loc $buf) {
Branch: 1 branch
BranchTrueFalseTotal
unless (print $loc $buf) 0 0 0
597 0 carp "Cannot write to Local file $local: $!\n";
598 0 $data->abort;
599 0 ▶ close($loc)
Branch: 1 branch
BranchTrueFalseTotal
unless $localfd 0 0 0
600 unless $localfd;
601 0 return;
602 }
603 }
604  
605 0 ▶ print $hashh "\n" if $hashh;
Branch: 1 branch
BranchTrueFalseTotal
if $hashh 0 0 0
606  
607 0 ▶ unless ($localfd) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($localfd) 0 0 0
608 0 ▶ unless (close($loc)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (close $loc) 0 0 0
609 0 carp "Cannot close file $local (perhaps disk space) $!\n";
610 0 return;
611 }
612 }
613  
614 0 ▶ unless ($data->close()) # implied $ftp->response
Branch: 1 branch
BranchTrueFalseTotal
unless ($data->close) 0 0 0
615 {
616 0 carp "Unable to close datastream";
617 0 return;
618 }
619  
620 0 return $local;
621 }
622  
623  
624 0 ▶sub cwd {
Subroutine cwd: not called CC=6 SCAR=37.4
Pod documented
625 0 ▶ @_ == 1 || @_ == 2 or croak 'usage: $ftp->cwd([$dir])';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or @_ == 2 or croak("usage: \$ftp->cwd([\$dir])") 0 0 0
Condition0%0/3
@_ == 1 or @_ == 2
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 1 or @_ == 2
@_ == 1 @_ == 2
Truth table0%0/3
A or B
A= @_ == 1B= @_ == 2
ABresult
1X1
011
000
626  
627 0 my ($ftp, $dir) = @_;
628  
629 0 ▶ $dir = "/" unless defined($dir) && $dir =~ /\S/;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dir and $dir =~ /\S/ 0 0 0
Condition0%0/3
defined $dir and $dir =~ /\S/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $dir and $dir =~ /\S/
defined $dir $dir =~ /\S/
Truth table0%0/3
A and B
A= defined $dirB= $dir =~ /\S/
ABresult
0X0
100
111
630  
631 0 ▶ $dir eq ".."
Branch: 1 branch
BranchTrueFalseTotal
$dir eq '..' ? : 0 0 0
632 ? $ftp->_CDUP()
633 : $ftp->_CWD($dir);
634 }
635  
636  
637 0 ▶sub cdup {
Subroutine cdup: not called CC=2 SCAR=17.9
Pod documented
638 0 ▶ @_ == 1 or croak 'usage: $ftp->cdup()';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("usage: \$ftp->cdup()") 0 0 0
639 0 $_[0]->_CDUP;
640 }
641  
642  
643 0 ▶sub pwd {
Subroutine pwd: not called CC=2 SCAR=17.9
Pod documented
644 0 ▶ @_ == 1 || croak 'usage: $ftp->pwd()';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("usage: \$ftp->pwd()") 0 0 0
645 0 my $ftp = shift;
646  
647 0 $ftp->_PWD();
648 0 $ftp->_extract_path;
649 }
650  
651 # rmdir( $ftp, $dir, [ $recurse ] )
652 #
653 # Removes $dir on remote host via FTP.
654 # $ftp is handle for remote host
655 #
656 # If $recurse is TRUE, the directory and deleted recursively.
657 # This means all of its contents and subdirectories.
658 #
659 # Initial version contributed by Dinkum Software
660 #
661 0 ▶sub rmdir {
Subroutine rmdir: not called CC=14 SCAR=53.5
Pod documented
662 0 ▶ @_ == 2 || @_ == 3 or croak('usage: $ftp->rmdir($dir[, $recurse])');
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or @_ == 3 or croak("usage: \$ftp->rmdir(\$dir[, \$recurse])") 0 0 0
Condition0%0/3
@_ == 2 or @_ == 3
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 2 or @_ == 3
@_ == 2 @_ == 3
Truth table0%0/3
A or B
A= @_ == 2B= @_ == 3
ABresult
1X1
011
000
663  
664 # Pick off the args
665 0 my ($ftp, $dir, $recurse) = @_;
666 0 my $ok;
667  
668 0 ▶ return $ok
Branch: 1 branch
BranchTrueFalseTotal
if $ok = $ftp->_RMD($dir) or not $recurse 0 0 0
Condition0%0/3
$ok = $ftp->_RMD($dir) or not $recurse
l!l&&r!l&&!r
000
MC/DC0%0/2
$ok = $ftp->_RMD($dir) or not $recurse
$ok = $ftp->_RMD($dir) not $recurse
Truth table0%0/3
A or not(B)
A= $ok = $ftp->_RMD($dir)B= not $recurse
ABresult
1X1
011
000
669 if $ok = $ftp->_RMD($dir)
670 or !$recurse;
671  
672 # Try to delete the contents
673 # Get a list of all the files in the directory, excluding the current and parent directories
674 0 ▶ my @filelist = map { /^(?:\S+;)+ (.+)$/ ? ($1) : () } grep { !/^(?:\S+;)*type=[cp]dir;/i } $ftp->_list_cmd("MLSD", $dir);
Branch: 1 branch
BranchTrueFalseTotal
/^(?:\S+;)+ (.+)$/ ? : 0 0 0
675  
676 # Fallback to using the less well-defined NLST command if MLSD fails
677 0 ▶ @filelist = grep { !/^\.{1,2}$/ } $ftp->ls($dir)
Branch: 1 branch
BranchTrueFalseTotal
unless @filelist 0 0 0
678 unless @filelist;
679  
680 return
681 0 ▶ unless @filelist; # failed, it is probably not a directory
Branch: 1 branch
BranchTrueFalseTotal
unless @filelist 0 0 0
682  
683 0 ▶ return $ftp->delete($dir)
Branch: 1 branch
BranchTrueFalseTotal
if @filelist == 1 and $dir eq $filelist[0] 0 0 0
Condition0%0/3
@filelist == 1 and $dir eq $filelist[0]
!ll&&!rl&&r
000
MC/DC0%0/2
@filelist == 1 and $dir eq $filelist[0]
@filelist == 1 $dir eq $filelist[0]
Truth table0%0/3
A and B
A= @filelist == 1B= $dir eq $filelist[0]
ABresult
0X0
100
111
684 if @filelist == 1 and $dir eq $filelist[0];
685  
686 # Go thru and delete each file or the directory
687 0 ▶ foreach my $file (map { m,/, ? $_ : "$dir/$_" } @filelist) {
Branch: 1 branch
BranchTrueFalseTotal
m[/] ? : 0 0 0
688 next # successfully deleted the file
689 0 ▶ if $ftp->delete($file);
Branch: 1 branch
BranchTrueFalseTotal
if $ftp->delete($file) 0 0 0
690  
691 # Failed to delete it, assume its a directory
692 # Recurse and ignore errors, the final rmdir() will
693 # fail on any errors here
694 0 ▶ return $ok
Branch: 1 branch
BranchTrueFalseTotal
unless $ok = $ftp->rmdir($file, 1) 0 0 0
695 unless $ok = $ftp->rmdir($file, 1);
696 }
697  
698 # Directory should be empty
699 # Try to remove the directory again
700 # Pass results directly to caller
701 # If any of the prior deletes failed, this
702 # rmdir() will fail because directory is not empty
703 0 return $ftp->_RMD($dir);
704 }
705  
706  
707 0 ▶sub restart {
Subroutine restart: not called CC=2 SCAR=17.9
Pod documented
708 0 ▶ @_ == 2 || croak 'usage: $ftp->restart($where)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$ftp->restart(\$where)") 0 0 0
709  
710 0 my ($ftp, $where) = @_;
711  
712 0 ${*$ftp}{'net_ftp_rest'} = $where;
713  
714 0 return;
715 }
716  
717  
718 0 ▶sub mkdir {
Subroutine mkdir: not called CC=10 SCAR=47.0
Pod documented
719 0 ▶ @_ == 2 || @_ == 3 or croak 'usage: $ftp->mkdir($dir[, $recurse])';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or @_ == 3 or croak("usage: \$ftp->mkdir(\$dir[, \$recurse])") 0 0 0
Condition0%0/3
@_ == 2 or @_ == 3
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 2 or @_ == 3
@_ == 2 @_ == 3
Truth table0%0/3
A or B
A= @_ == 2B= @_ == 3
ABresult
1X1
011
000
720  
721 0 my ($ftp, $dir, $recurse) = @_;
722  
723 0 ▶ $ftp->_MKD($dir) || $recurse
Branch: 1 branch
BranchTrueFalseTotal
$ftp->_MKD($dir) or $recurse or return 0 0 0
Condition0%0/3
$ftp->_MKD($dir) or $recurse
l!l&&r!l&&!r
000
MC/DC0%0/2
$ftp->_MKD($dir) or $recurse
$ftp->_MKD($dir) $recurse
Truth table0%0/3
A or B
A= $ftp->_MKD($dir)B= $recurse
ABresult
1X1
011
000
724 or return;
725  
726 0 my $path = $dir;
727  
728 0 ▶ unless ($ftp->ok) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ftp->ok) 0 0 0
729 0 my @path = split(m#(?=/+)#, $dir);
730  
731 0 $path = "";
732  
733 0 ▶ while (@path) {
Branch: 1 branch
BranchTrueFalseTotal
if (@path) 0 0 0
734 0 $path .= shift @path;
735  
736 0 $ftp->_MKD($path);
737  
738 0 $path = $ftp->_extract_path($path);
739 }
740  
741 # If the creation of the last element was not successful, see if we
742 # can cd to it, if so then return path
743  
744 0 ▶ unless ($ftp->ok) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ftp->ok) 0 0 0
745 0 my ($status, $message) = ($ftp->status, $ftp->message);
746 0 my $pwd = $ftp->pwd;
747  
748 0 ▶ if ($pwd && $ftp->cwd($dir)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pwd and $ftp->cwd($dir)) { } 0 0 0
Condition0%0/3
$pwd and $ftp->cwd($dir)
!ll&&!rl&&r
000
MC/DC0%0/2
$pwd and $ftp->cwd($dir)
$pwd $ftp->cwd($dir)
Truth table0%0/3
A and B
A= $pwdB= $ftp->cwd($dir)
ABresult
0X0
100
111
749 0 $path = $dir;
750 0 $ftp->cwd($pwd);
751 }
752 else {
753 0 undef $path;
754 }
755 0 $ftp->set_status($status, $message);
756 }
757 }
758  
759 0 $path;
760 }
761  
762  
763 0 ▶sub delete {
Subroutine delete: not called CC=2 SCAR=17.9
Pod documented
764 0 ▶ @_ == 2 || croak 'usage: $ftp->delete($filename)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$ftp->delete(\$filename)") 0 0 0
765  
766 0 $_[0]->_DELE($_[1]);
767 }
768  
769  
770 0 ▶sub put { shift->_store_cmd("stor", @_) }
Subroutine put: not called CC=1 SCAR=6.9
Pod documented
771 0 ▶sub put_unique { shift->_store_cmd("stou", @_) }
Subroutine put_unique: not called CC=1 SCAR=6.9
Pod documented
772 0 ▶sub append { shift->_store_cmd("appe", @_) }
Subroutine append: not called CC=1 SCAR=6.9
Pod documented
773  
774  
775 0 ▶sub nlst { shift->_data_cmd("NLST", @_) }
Subroutine nlst: not called CC=1 SCAR=6.9
Pod documented
776 0 ▶sub list { shift->_data_cmd("LIST", @_) }
Subroutine list: not called CC=1 SCAR=6.9
Pod documented
777 0 ▶sub retr { shift->_data_cmd("RETR", @_) }
Subroutine retr: not called CC=1 SCAR=6.9
Pod documented
778 0 ▶sub stor { shift->_data_cmd("STOR", @_) }
Subroutine stor: not called CC=1 SCAR=6.9
Pod documented
779 0 ▶sub stou { shift->_data_cmd("STOU", @_) }
Subroutine stou: not called CC=1 SCAR=6.9
Pod documented
780 0 ▶sub appe { shift->_data_cmd("APPE", @_) }
Subroutine appe: not called CC=1 SCAR=6.9
Pod documented
781  
782  
783 0 ▶sub _store_cmd {
Subroutine _store_cmd: not called CC=28 SCAR=67.0
784 0 my ($ftp, $cmd, $local, $remote) = @_;
785 0 my ($loc, $sock, $len, $buf);
786 0 local *FD;
787  
788 0 ▶ my $localfd = ref($local) || ref(\$local) eq "GLOB";
Condition0%0/3
ref $local || ref \$local eq 'GLOB'
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $local || ref \$local eq 'GLOB'
ref $local ref \$local eq 'GLOB'
Truth table0%0/3
A || B
A= ref $localB= ref \$local eq 'GLOB'
ABresult
1X1
011
000
789  
790 0 ▶ if (!defined($remote) and 'STOU' ne uc($cmd)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $remote and "STOU" ne uc $cmd) 0 0 0
Condition0%0/3
not defined $remote and "STOU" ne uc $cmd
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $remote and "STOU" ne uc $cmd
not defined $remote "STOU" ne uc $cmd
Truth table0%0/3
not(A) and B
A= not defined $remoteB= "STOU" ne uc $cmd
ABresult
0X0
100
111
791 0 ▶ croak 'Must specify remote filename with stream input'
Branch: 1 branch
BranchTrueFalseTotal
if $localfd 0 0 0
792 if $localfd;
793  
794 0 require File::Basename;
795 0 $remote = File::Basename::basename($local);
796 }
797 0 ▶ if (defined ${*$ftp}{'net_ftp_allo'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined do { *$ftp }->{'net_ftp_allo'}) { } 0 0 0
798 0 delete ${*$ftp}{'net_ftp_allo'};
799 }
800 else {
801  
802 # if the user hasn't already invoked the alloc method since the last
803 # _store_cmd call, figure out if the local file is a regular file(not
804 # a pipe, or device) and if so get the file size from stat, and send
805 # an ALLO command before sending the STOR, STOU, or APPE command.
806 0 ▶ my $size = do { local $^W; -f $local && -s _ }; # no ALLO if sending data from a pipe
Condition0%0/3
-f $local && -s _
!ll&&!rl&&r
000
MC/DC0%0/2
-f $local && -s _
-f $local -s _
Truth table0%0/3
A && B
A= -f $localB= -s _
ABresult
0X0
100
111
807 0 ▶ ${*$ftp}{'net_ftp_allo'} = $size if $size;
Branch: 1 branch
BranchTrueFalseTotal
if $size 0 0 0
808 }
809 0 ▶ croak("Bad remote filename '$remote'\n")
Branch: 1 branch
BranchTrueFalseTotal
if defined $remote and $remote =~ /[\r\n]/s 0 0 0
Condition0%0/3
defined $remote and $remote =~ /[\r\n]/s
!ll&&!rl&&r
000
MC/DC0%0/2
defined $remote and $remote =~ /[\r\n]/s
defined $remote $remote =~ /[\r\n]/s
Truth table0%0/3
A and B
A= defined $remoteB= $remote =~ /[\r\n]/s
ABresult
0X0
100
111
810 if defined($remote) and $remote =~ /[\r\n]/s;
811  
812 0 ▶ if ($localfd) {
Branch: 1 branch
BranchTrueFalseTotal
if ($localfd) { } 0 0 0
813 0 $loc = $local;
814 }
815 else {
816 0 $loc = \*FD;
817  
818 0 ▶ unless (sysopen($loc, $local, O_RDONLY)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (sysopen $loc, $local, 0) 0 0 0
819 0 carp "Cannot open Local file $local: $!\n";
820 0 return;
821 }
822 }
823  
824 0 ▶ if ($ftp->type eq 'I' && !binmode($loc)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ftp->type eq "I" and not binmode($loc)) 0 0 0
Condition0%0/3
$ftp->type eq "I" and not binmode($loc)
!ll&&!rl&&r
000
MC/DC0%0/2
$ftp->type eq "I" and not binmode($loc)
$ftp->type eq "I" not binmode($loc)
Truth table0%0/3
A and not(B)
A= $ftp->type eq "I"B= not binmode($loc)
ABresult
0X0
100
111
825 0 carp "Cannot binmode Local file $local: $!\n";
826 0 return;
827 }
828  
829 0 delete ${*$ftp}{'net_ftp_port'};
830 0 delete ${*$ftp}{'net_ftp_pasv'};
831  
832 0 ▶ $sock = $ftp->_data_cmd($cmd, grep { defined } $remote)
Branch: 1 branch
BranchTrueFalseTotal
$sock = $ftp->_data_cmd($cmd, grep({defined $_;} $remote)) or return 0 0 0
833 or return;
834  
835 0 ▶ $remote = ($ftp->message =~ /\w+\s*:\s*(.*)/)[0]
Branch: 1 branch
BranchTrueFalseTotal
if "STOU" eq uc $cmd 0 0 0
836 if 'STOU' eq uc $cmd;
837  
838 0 my $blksize = ${*$ftp}{'net_ftp_blksize'};
839  
840 0 my ($count, $hashh, $hashb, $ref) = (0);
841  
842 ($hashh, $hashb) = @$ref
843 0 ▶ if ($ref = ${*$ftp}{'net_ftp_hash'});
Branch: 1 branch
BranchTrueFalseTotal
if $ref = do { *$ftp }->{"net_ftp_hash"} 0 0 0
844  
845 0 while (1) {
846 0 ▶ last unless $len = read($loc, $buf = "", $blksize);
Branch: 1 branch
BranchTrueFalseTotal
unless $len = read($loc, $buf = "", $blksize) 0 0 0
847  
848 0 if (EBCDIC && $ftp->type ne 'I') {
849 $buf = $ftp->toascii($buf);
850 $len = length($buf);
851 }
852  
853 0 ▶ if ($hashh) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hashh) 0 0 0
854 0 $count += $len;
855 0 print $hashh "#" x (int($count / $hashb));
856 0 $count %= $hashb;
857 }
858  
859 0 my $wlen;
860 0 ▶ unless (defined($wlen = $sock->write($buf, $len)) && $wlen == $len) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined($wlen = $sock->write($buf, $len)) and $wlen == $len) 0 0 0
Condition0%0/3
defined($wlen = $sock->write($buf, $len)) and $wlen == $len
!ll&&!rl&&r
000
MC/DC0%0/2
defined($wlen = $sock->write($buf, $len)) and $wlen == $len
defined($wlen = $sock->write($buf, $len)) $wlen == $len
Truth table0%0/3
A and B
A= defined($wlen = $sock->write($buf, $len))B= $wlen == $len
ABresult
0X0
100
111
861 0 $sock->abort;
862 0 ▶ close($loc)
Branch: 1 branch
BranchTrueFalseTotal
unless $localfd 0 0 0
863 unless $localfd;
864 0 ▶ print $hashh "\n" if $hashh;
Branch: 1 branch
BranchTrueFalseTotal
if $hashh 0 0 0
865 0 return;
866 }
867 }
868  
869 0 ▶ print $hashh "\n" if $hashh;
Branch: 1 branch
BranchTrueFalseTotal
if $hashh 0 0 0
870  
871 0 ▶ close($loc)
Branch: 1 branch
BranchTrueFalseTotal
unless $localfd 0 0 0
872 unless $localfd;
873  
874 0 ▶ $sock->close()
Branch: 1 branch
BranchTrueFalseTotal
$sock->close or return 0 0 0
875 or return;
876  
877 0 ▶ if ('STOU' eq uc $cmd and $ftp->message =~ m/unique\s+file\s*name\s*:\s*(.*)\)|"(.*)"/) {
Branch: 1 branch
BranchTrueFalseTotal
if ("STOU" eq uc $cmd and $ftp->message =~ /unique\s+file\s*name\s*:\s*(.*)\)|"(.*)"/) 0 0 0
Condition0%0/3
"STOU" eq uc $cmd and $ftp->message =~ /unique\s+file\s*name\s*:\s*(.*)\)|"(.*)"/
!ll&&!rl&&r
000
MC/DC0%0/2
"STOU" eq uc $cmd and $ftp->message =~ /unique\s+file\s*name\s*:\s*(.*)\)|"(.*)"/
"STOU" eq uc $cmd $ftp->message =~ /unique\s+file\s*name\s*:\s*(.*)\)|"(.*)"/
Truth table0%0/3
A and B
A= "STOU" eq uc $cmdB= $ftp->message =~ /unique\s+file\s*name\s*:\s*(.*)\)|"(.*)"/
ABresult
0X0
100
111
878 0 require File::Basename;
879 0 $remote = File::Basename::basename($+);
880 }
881  
882 0 return $remote;
883 }
884  
885  
886 0 ▶sub port {
Subroutine port: not called CC=3 SCAR=24.8
Pod documented
887 0 ▶ @_ == 1 || @_ == 2 or croak 'usage: $self->port([$port])';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or @_ == 2 or croak("usage: \$self->port([\$port])") 0 0 0
Condition0%0/3
@_ == 1 or @_ == 2
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 1 or @_ == 2
@_ == 1 @_ == 2
Truth table0%0/3
A or B
A= @_ == 1B= @_ == 2
ABresult
1X1
011
000
888 0 return _eprt('PORT',@_);
889 }
890  
891 0 ▶sub eprt {
Subroutine eprt: not called CC=3 SCAR=24.8
Pod documented
892 0 ▶ @_ == 1 || @_ == 2 or croak 'usage: $self->eprt([$port])';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or @_ == 2 or croak("usage: \$self->eprt([\$port])") 0 0 0
Condition0%0/3
@_ == 1 or @_ == 2
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 1 or @_ == 2
@_ == 1 @_ == 2
Truth table0%0/3
A or B
A= @_ == 1B= @_ == 2
ABresult
1X1
011
000
893 0 return _eprt('EPRT',@_);
894 }
895  
896 0 ▶sub _eprt {
Subroutine _eprt: not called CC=10 SCAR=47.0
897 0 my ($cmd,$ftp,$port) = @_;
898 0 delete ${*$ftp}{net_ftp_intern_port};
899 0 ▶ unless ($port) {
Branch: 2 branches
BranchTrueFalseTotal
if ($port) { } 0 0 0
if (do { ref $port eq "ARRAY" }) 0 0 0
900 0 ▶ my $listen = ${*$ftp}{net_ftp_listen} ||= $IOCLASS->new(
Branch: 1 branch
BranchTrueFalseTotal
can_ssl() ? : 0 0 0
901 Listen => 1,
902 Timeout => $ftp->timeout,
903 LocalAddr => $ftp->sockhost,
904 $family_key => $ftp->sockdomain,
905 can_ssl() ? (
906 0 ▶ %{ ${*$ftp}{net_ftp_tlsargs} },
Condition0%0/3
do { *$ftp }->{"net_ftp_listen"} ||= $Net::FTP::IOCLASS->new("Listen", 1, "Timeout", $ftp->timeout, "LocalAddr", $ftp->sockhost, $family_key, $ftp->sockdomain, can_ssl() ? (%{${*$ftp;}{"net_ftp_tlsargs"};}, "SSL_startHandshake", 0) : ())
l!l&&r!l&&!r
000
MC/DC0%0/2
do { *$ftp }->{"net_ftp_listen"} ||= $Net::FTP::IOCLASS->new("Listen", 1, "Timeout", $ftp->timeout, "LocalAddr", $ftp->sockhost, $family_key, $ftp->sockdomain, can_ssl() ? (%{${*$ftp;}{"net_ftp_tlsargs"};}, "SSL_startHandshake", 0) : ())
do { *$ftp }->{"net_ftp_listen"} $Net::FTP::IOCLASS->new("Listen", 1, "Timeout", $ftp->timeout, "LocalAddr", $ftp->sockhost, $family_key, $ftp->sockdomain, can_ssl() ? (%{${*$ftp;}{"net_ftp_tlsargs"};}, "SSL_startHandshake", 0) : ())
Truth table0%0/3
A ||= B
A= do { *$ftp }->{"net_ftp_listen"}B= $Net::FTP::IOCLASS->new("Listen", 1, "Timeout", $ftp->timeout, "LocalAddr", $ftp->sockhost, $family_key, $ftp->sockdomain, can_ssl() ? (%{${*$ftp;}{"net_ftp_tlsargs"};}, "SSL_startHandshake", 0) : ())
ABresult
1X1
011
000
907 SSL_startHandshake => 0,
908 ):(),
909 );
910 0 ${*$ftp}{net_ftp_intern_port} = 1;
911 0 ▶ my $fam = ($listen->sockdomain == AF_INET) ? 1:2;
Branch: 1 branch
BranchTrueFalseTotal
$listen->sockdomain == 2 ? : 0 0 0
912 0 ▶ if ( $cmd eq 'EPRT' || $fam == 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cmd eq 'EPRT' or $fam == 2) { } 0 0 0
Condition0%0/3
$cmd eq "EPRT" or $fam == 2
l!l&&r!l&&!r
000
MC/DC0%0/2
$cmd eq "EPRT" or $fam == 2
$cmd eq "EPRT" $fam == 2
Truth table0%0/3
A or B
A= $cmd eq "EPRT"B= $fam == 2
ABresult
1X1
011
000
913 0 $port = "|$fam|".$listen->sockhost."|".$listen->sockport."|";
914 0 $cmd = 'EPRT';
915 } else {
916 0 my $p = $listen->sockport;
917 0 $port = join(',',split(m{\.},$listen->sockhost),$p >> 8,$p & 0xff);
918 }
919 0 } elsif (ref($port) eq 'ARRAY') {
920 0 $port = join(',',split(m{\.},@$port[0]),@$port[1] >> 8,@$port[1] & 0xff);
921 }
922 0 ▶ my $ok = $cmd eq 'EPRT' ? $ftp->_EPRT($port) : $ftp->_PORT($port);
Branch: 1 branch
BranchTrueFalseTotal
$cmd eq 'EPRT' ? : 0 0 0
923 0 ▶ ${*$ftp}{net_ftp_port} = $port if $ok;
Branch: 1 branch
BranchTrueFalseTotal
if $ok 0 0 0
924 0 return $ok;
925 }
926  
927  
928 0 ▶sub ls { shift->_list_cmd("NLST", @_); }
Subroutine ls: not called CC=1 SCAR=6.9
Pod documented
929 0 ▶sub dir { shift->_list_cmd("LIST", @_); }
Subroutine dir: not called CC=1 SCAR=6.9
Pod documented
930  
931  
932 0 ▶sub pasv {
Subroutine pasv: not called CC=5 SCAR=34.0
Pod documented
933 0 my $ftp = shift;
934 0 ▶ @_ and croak 'usage: $ftp->port()';
Branch: 1 branch
BranchTrueFalseTotal
@_ and croak("usage: \$ftp->port()") 0 0 0
935 0 ▶ return $ftp->epsv if $ftp->sockdomain != AF_INET;
Branch: 1 branch
BranchTrueFalseTotal
if $ftp->sockdomain != 2 0 0 0
936 0 delete ${*$ftp}{net_ftp_intern_port};
937  
938 0 ▶ if ( $ftp->_PASV &&
Branch: 1 branch
BranchTrueFalseTotal
if ($ftp->_PASV and $ftp->message =~ /(\d+,\d+,\d+,\d+),(\d+),(\d+)/) 0 0 0
Condition0%0/3
$ftp->_PASV and $ftp->message =~ /(\d+,\d+,\d+,\d+),(\d+),(\d+)/
!ll&&!rl&&r
000
MC/DC0%0/2
$ftp->_PASV and $ftp->message =~ /(\d+,\d+,\d+,\d+),(\d+),(\d+)/
$ftp->_PASV $ftp->message =~ /(\d+,\d+,\d+,\d+),(\d+),(\d+)/
Truth table0%0/3
A and B
A= $ftp->_PASVB= $ftp->message =~ /(\d+,\d+,\d+,\d+),(\d+),(\d+)/
ABresult
0X0
100
111
939 $ftp->message =~ m{(\d+,\d+,\d+,\d+),(\d+),(\d+)} ) {
940 0 my $port = 256 * $2 + $3;
941 0 ( my $ip = $1 ) =~s{,}{.}g;
942 0 return ${*$ftp}{net_ftp_pasv} = [ $ip,$port ];
943 }
944 0 return;
945 }
946  
947 0 ▶sub epsv {
Subroutine epsv: not called CC=4 SCAR=30.0
Pod documented
948 0 my $ftp = shift;
949 0 ▶ @_ and croak 'usage: $ftp->epsv()';
Branch: 1 branch
BranchTrueFalseTotal
@_ and croak("usage: \$ftp->epsv()") 0 0 0
950 0 delete ${*$ftp}{net_ftp_intern_port};
951  
952 $ftp->_EPSV && $ftp->message =~ m{\(([\x33-\x7e])\1\1(\d+)\1\)}
953 0 ▶ ? ${*$ftp}{net_ftp_pasv} = [ $ftp->peerhost, $2 ]
Branch: 1 branch
BranchTrueFalseTotal
$ftp->_EPSV && $ftp->message =~ /\(([\x33-\x7e])\1\1(\d+)\1\)/ ? : 0 0 0
Condition0%0/3
$ftp->_EPSV and $ftp->message =~ /\(([\x33-\x7e])\1\1(\d+)\1\)/
!ll&&!rl&&r
000
MC/DC0%0/2
$ftp->_EPSV and $ftp->message =~ /\(([\x33-\x7e])\1\1(\d+)\1\)/
$ftp->_EPSV $ftp->message =~ /\(([\x33-\x7e])\1\1(\d+)\1\)/
Truth table0%0/3
A and B
A= $ftp->_EPSVB= $ftp->message =~ /\(([\x33-\x7e])\1\1(\d+)\1\)/
ABresult
0X0
100
111
954 : undef;
955 }
956  
957  
958 0 ▶sub unique_name {
Subroutine unique_name: not called CC=2 SCAR=17.9
Pod documented
959 0 my $ftp = shift;
960 0 ▶ ${*$ftp}{'net_ftp_unique'} || undef;
Branch: 1 branch
BranchTrueFalseTotal
do { *$ftp }->{"net_ftp_unique"} or undef 0 0 0
961 }
962  
963  
964 0 ▶sub supported {
Subroutine supported: not called CC=9 SCAR=45.0
Pod documented
965 0 ▶ @_ == 2 or croak 'usage: $ftp->supported($cmd)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$ftp->supported(\$cmd)") 0 0 0
966 0 my $ftp = shift;
967 0 my $cmd = uc shift;
968 0 ▶ my $hash = ${*$ftp}{'net_ftp_supported'} ||= {};
Condition0%0/2
do { *$ftp }->{"net_ftp_supported"} ||= {}
l!l
00
MC/DC0%0/1
do { *$ftp }->{"net_ftp_supported"} ||= {}
do { *$ftp }->{"net_ftp_supported"}
Truth table0%0/2
A
A= do { *$ftp }->{"net_ftp_supported"}
Aresult
11
00
969  
970 return $hash->{$cmd}
971 0 ▶ if exists $hash->{$cmd};
Branch: 1 branch
BranchTrueFalseTotal
if exists $hash->{$cmd} 0 0 0
972  
973 0 ▶ return $hash->{$cmd} = 1
Branch: 1 branch
BranchTrueFalseTotal
if $ftp->feature($cmd) 0 0 0
974 if $ftp->feature($cmd);
975  
976 0 ▶ return $hash->{$cmd} = 0
Branch: 1 branch
BranchTrueFalseTotal
unless $ftp->_HELP($cmd) 0 0 0
977 unless $ftp->_HELP($cmd);
978  
979 0 my $text = $ftp->message;
980 0 ▶ if ($text =~ /following.+commands/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($text =~ /following.+commands/i) { } 0 0 0
981 0 $text =~ s/^.*\n//;
982 0 ▶ while ($text =~ /(\*?)(\w+)(\*?)/sg) {
Branch: 1 branch
BranchTrueFalseTotal
if ($text =~ /(\*?)(\w+)(\*?)/gs) 0 0 0
983 0 $hash->{"\U$2"} = !length("$1$3");
984 }
985 }
986 else {
987 0 $hash->{$cmd} = $text !~ /unimplemented/i;
988 }
989  
990 0 ▶ $hash->{$cmd} ||= 0;
Condition0%0/2
$hash->{$cmd} ||= 0
l!l
00
MC/DC0%0/1
$hash->{$cmd} ||= 0
$hash->{$cmd}
Truth table0%0/2
A
A= $hash->{$cmd}
Aresult
11
00
991 }
992  
993 ##
994 ## Deprecated methods
995 ##
996  
997  
998 0 ▶sub lsl {
Subroutine lsl: not called CC=2 SCAR=17.9
Pod undocumented
999 0 ▶ carp "Use of Net::FTP::lsl deprecated, use 'dir'"
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
1000 if $^W;
1001 0 goto &dir;
1002 }
1003  
1004  
1005 0 ▶sub authorise {
Subroutine authorise: not called CC=2 SCAR=17.9
Pod undocumented
1006 0 ▶ carp "Use of Net::FTP::authorise deprecated, use 'authorize'"
Branch: 1 branch
BranchTrueFalseTotal
if $^W 0 0 0
1007 if $^W;
1008 0 goto &authorize;
1009 }
1010  
1011  
1012 ##
1013 ## Private methods
1014 ##
1015  
1016  
1017 0 ▶sub _extract_path {
Subroutine _extract_path: not called CC=3 SCAR=24.8
1018 0 my ($ftp, $path) = @_;
1019  
1020 # This tries to work both with and without the quote doubling
1021 # convention (RFC 959 requires it, but the first 3 servers I checked
1022 # didn't implement it). It will fail on a server which uses a quote in
1023 # the message which isn't a part of or surrounding the path.
1024 0 ▶ $ftp->ok
Branch: 1 branch
BranchTrueFalseTotal
$ftp->ok and $ftp->message =~ /(?:^|\s)\"(.*)\"(?:$|\s)/ and ($path = $1) =~ s/\"\"/"/g 0 0 0
Condition0%0/3
$ftp->ok and $ftp->message =~ /(?:^|\s)\"(.*)\"(?:$|\s)/
!ll&&!rl&&r
000
MC/DC0%0/2
$ftp->ok and $ftp->message =~ /(?:^|\s)\"(.*)\"(?:$|\s)/
$ftp->ok $ftp->message =~ /(?:^|\s)\"(.*)\"(?:$|\s)/
Truth table0%0/3
A and B
A= $ftp->okB= $ftp->message =~ /(?:^|\s)\"(.*)\"(?:$|\s)/
ABresult
0X0
100
111
1025 && $ftp->message =~ /(?:^|\s)\"(.*)\"(?:$|\s)/
1026 && ($path = $1) =~ s/\"\"/\"/g;
1027  
1028 0 $path;
1029 }
1030  
1031 ##
1032 ## Communication methods
1033 ##
1034  
1035  
1036 0 ▶sub _dataconn {
Subroutine _dataconn: not called CC=10 SCAR=47.0
1037 0 my $ftp = shift;
1038 0 my $pkg = "Net::FTP::" . $ftp->type;
1039 0 ▶ eval "require " . $pkg ## no critic (BuiltinFunctions::ProhibitStringyEval)
Branch: 1 branch
BranchTrueFalseTotal
eval 'require ' . $pkg or croak("cannot load $pkg required for type " . $ftp->type) 0 0 0
1040 or croak("cannot load $pkg required for type ".$ftp->type);
1041 0 $pkg =~ s/ /_/g;
1042 0 delete ${*$ftp}{net_ftp_dataconn};
1043  
1044 0 my $conn;
1045 0 my $pasv = ${*$ftp}{net_ftp_pasv};
1046 0 ▶ if ($pasv) {
Branch: 2 branches
BranchTrueFalseTotal
if ($pasv) { } 0 0 0
elsif (my $listen = delete do { *$ftp }->{'net_ftp_listen'}) { } 0 0 0
1047 $conn = $pkg->new(
1048 PeerAddr => $pasv->[0],
1049 PeerPort => $pasv->[1],
1050 0 LocalAddr => ${*$ftp}{net_ftp_localaddr},
1051 0 ▶ $family_key => ${*$ftp}{net_ftp_domain},
Branch: 1 branch
BranchTrueFalseTotal
can_ssl() ? : 0 0 0
1052 Timeout => $ftp->timeout,
1053 can_ssl() ? (
1054 SSL_startHandshake => 0,
1055 0 ▶ %{${*$ftp}{net_ftp_tlsargs}},
Branch: 1 branch
BranchTrueFalseTotal
$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;}{"net_ftp_tlsargs"};}) : ()) or return 0 0 0
1056 ):(),
1057 ) or return;
1058 0 } elsif (my $listen = delete ${*$ftp}{net_ftp_listen}) {
1059 0 ▶ $conn = $listen->accept($pkg) or return;
Branch: 1 branch
BranchTrueFalseTotal
$conn = $listen->accept($pkg) or return 0 0 0
1060 0 $conn->timeout($ftp->timeout);
1061 0 close($listen);
1062 } else {
1063 0 croak("no listener in active mode");
1064 }
1065  
1066 0 ▶ if (( ${*$ftp}{net_ftp_tlsprot} || '') eq 'P') {
Branch: 1 branch
BranchTrueFalseTotal
if ((do { *$ftp }->{"net_ftp_tlsprot"} || "") eq "P") 0 0 0
Condition0%0/2
do { *$ftp }->{'net_ftp_tlsprot'} || ''
l!l
00
MC/DC0%0/1
do { *$ftp }->{'net_ftp_tlsprot'} || ''
do { *$ftp }->{'net_ftp_tlsprot'}
Truth table0%0/2
A
A= do { *$ftp }->{'net_ftp_tlsprot'}
Aresult
11
00
1067 0 ▶ if ($conn->connect_SSL) {
Branch: 1 branch
BranchTrueFalseTotal
if ($conn->connect_SSL) { } 0 0 0
1068 # SSL handshake ok
1069 } else {
1070 0 carp("failed to ssl upgrade dataconn: $IO::Socket::SSL::SSL_ERROR");
1071 0 return;
1072 }
1073 }
1074  
1075 0 ${*$ftp}{net_ftp_dataconn} = $conn;
1076 0 ${*$conn} = "";
1077 0 ${*$conn}{net_ftp_cmd} = $ftp;
1078 0 ${*$conn}{net_ftp_blksize} = ${*$ftp}{net_ftp_blksize};
1079 0 return $conn;
1080 }
1081  
1082  
1083 0 ▶sub _list_cmd {
Subroutine _list_cmd: not called CC=4 SCAR=30.0
1084 0 my $ftp = shift;
1085 0 my $cmd = uc shift;
1086  
1087 0 delete ${*$ftp}{'net_ftp_port'};
1088 0 delete ${*$ftp}{'net_ftp_pasv'};
1089  
1090 0 my $data = $ftp->_data_cmd($cmd, @_);
1091  
1092 return
1093 0 ▶ unless (defined $data);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $data 0 0 0
1094  
1095 0 require Net::FTP::A;
1096 0 bless $data, "Net::FTP::A"; # Force ASCII mode
1097  
1098 0 my $databuf = '';
1099 0 my $buf = '';
1100 0 my $blksize = ${*$ftp}{'net_ftp_blksize'};
1101  
1102 0 ▶ while ($data->read($databuf, $blksize)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($data->read($databuf, $blksize)) 0 0 0
1103 0 $buf .= $databuf;
1104 }
1105  
1106 0 my $list = [split(/\n/, $buf)];
1107  
1108 0 $data->close();
1109  
1110 0 if (EBCDIC) {
1111 for (@$list) { $_ = $ftp->toebcdic($_) }
1112 }
1113  
1114 wantarray
1115 0 ▶ ? @{$list}
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
1116 : $list;
1117 }
1118  
1119  
1120 0 ▶sub _data_cmd {
Subroutine _data_cmd: not called CC=28 SCAR=67.0
1121 0 my $ftp = shift;
1122 0 my $cmd = uc shift;
1123 0 my $ok = 1;
1124 0 ▶ my $where = delete ${*$ftp}{'net_ftp_rest'} || 0;
Condition0%0/2
delete do { *$ftp }->{'net_ftp_rest'} || 0
l!l
00
MC/DC0%0/1
delete do { *$ftp }->{'net_ftp_rest'} || 0
delete do { *$ftp }->{'net_ftp_rest'}
Truth table0%0/2
A
A= delete do { *$ftp }->{'net_ftp_rest'}
Aresult
11
00
1125 0 my $arg;
1126  
1127 0 for my $arg (@_) {
1128 0 ▶ croak("Bad argument '$arg'\n")
Branch: 1 branch
BranchTrueFalseTotal
if $arg =~ /[\r\n]/s 0 0 0
1129 if $arg =~ /[\r\n]/s;
1130 }
1131  
1132 0 ▶ if ( ${*$ftp}{'net_ftp_passive'}
Branch: 1 branch
BranchTrueFalseTotal
if (do { *$ftp }->{"net_ftp_passive"} and not defined do { *$ftp }->{"net_ftp_pasv"} and not defined do { *$ftp }->{"net_ftp_port"}) 0 0 0
Condition0%0/6
do { *$ftp }->{"net_ftp_passive"} and not defined do { *$ftp }->{"net_ftp_pasv"} and not defined do { *$ftp }->{"net_ftp_port"}
!ll&&!rl&&r
000
do { *$ftp }->{"net_ftp_passive"} and not defined do { *$ftp }->{"net_ftp_pasv"}
!ll&&!rl&&r
000
MC/DC0%0/3
do { *$ftp }->{"net_ftp_passive"} and not defined do { *$ftp }->{"net_ftp_pasv"} and not defined do { *$ftp }->{"net_ftp_port"}
do { *$ftp }->{"net_ftp_passive"} not defined do { *$ftp }->{"net_ftp_pasv"} not defined do { *$ftp }->{"net_ftp_port"}
Truth table0%0/4
A and not(B) and not(C)
A= do { *$ftp }->{"net_ftp_passive"}B= not defined do { *$ftp }->{"net_ftp_pasv"}C= not defined do { *$ftp }->{"net_ftp_port"}
ABCresult
0XX0
10X0
1100
1111
1133 0 && !defined ${*$ftp}{'net_ftp_pasv'}
1134 0 && !defined ${*$ftp}{'net_ftp_port'})
1135 {
1136 0 ▶ return unless defined $ftp->pasv;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ftp->pasv 0 0 0
1137  
1138 0 ▶ if ($where and !$ftp->_REST($where)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($where and not $ftp->_REST($where)) 0 0 0
Condition0%0/3
$where and not $ftp->_REST($where)
!ll&&!rl&&r
000
MC/DC0%0/2
$where and not $ftp->_REST($where)
$where not $ftp->_REST($where)
Truth table0%0/3
A and not(B)
A= $whereB= not $ftp->_REST($where)
ABresult
0X0
100
111
1139 0 my ($status, $message) = ($ftp->status, $ftp->message);
1140 0 $ftp->abort;
1141 0 $ftp->set_status($status, $message);
1142 0 return;
1143 }
1144  
1145 # first send command, then open data connection
1146 # otherwise the peer might not do a full accept (with SSL
1147 # handshake if PROT P)
1148 0 $ftp->command($cmd, @_);
1149 0 my $data = $ftp->_dataconn();
1150 0 ▶ if (CMD_INFO == $ftp->response()) {
Branch: 1 branch
BranchTrueFalseTotal
if (1 == $ftp->response) 0 0 0
1151 0 ▶ $data->reading
Branch: 1 branch
BranchTrueFalseTotal
if $data and $cmd =~ /RETR|LIST|NLST|MLSD/ 0 0 0
Condition0%0/3
$data and $cmd =~ /RETR|LIST|NLST|MLSD/
!ll&&!rl&&r
000
MC/DC0%0/2
$data and $cmd =~ /RETR|LIST|NLST|MLSD/
$data $cmd =~ /RETR|LIST|NLST|MLSD/
Truth table0%0/3
A and B
A= $dataB= $cmd =~ /RETR|LIST|NLST|MLSD/
ABresult
0X0
100
111
1152 if $data && $cmd =~ /RETR|LIST|NLST|MLSD/;
1153 0 return $data;
1154 }
1155 0 ▶ $data->_close if $data;
Branch: 1 branch
BranchTrueFalseTotal
if $data 0 0 0
1156  
1157 0 return;
1158 }
1159  
1160 $ok = $ftp->port
1161 0 unless (defined ${*$ftp}{'net_ftp_port'}
1162 0 ▶ || defined ${*$ftp}{'net_ftp_pasv'});
Branch: 1 branch
BranchTrueFalseTotal
unless defined do { *$ftp }->{"net_ftp_port"} or defined do { *$ftp }->{"net_ftp_pasv"} 0 0 0
Condition0%0/3
defined do { *$ftp }->{"net_ftp_port"} or defined do { *$ftp }->{"net_ftp_pasv"}
l!l&&r!l&&!r
000
MC/DC0%0/2
defined do { *$ftp }->{"net_ftp_port"} or defined do { *$ftp }->{"net_ftp_pasv"}
defined do { *$ftp }->{"net_ftp_port"} defined do { *$ftp }->{"net_ftp_pasv"}
Truth table0%0/3
A or B
A= defined do { *$ftp }->{"net_ftp_port"}B= defined do { *$ftp }->{"net_ftp_pasv"}
ABresult
1X1
011
000
1163  
1164 0 ▶ $ok = $ftp->_REST($where)
Branch: 1 branch
BranchTrueFalseTotal
if $ok and $where 0 0 0
Condition0%0/3
$ok and $where
!ll&&!rl&&r
000
MC/DC0%0/2
$ok and $where
$ok $where
Truth table0%0/3
A and B
A= $okB= $where
ABresult
0X0
100
111
1165 if $ok && $where;
1166  
1167 return
1168 0 ▶ unless $ok;
Branch: 1 branch
BranchTrueFalseTotal
unless $ok 0 0 0
1169  
1170 0 ▶ if ($cmd =~ /(STOR|APPE|STOU)/ and exists ${*$ftp}{net_ftp_allo} and
Branch: 1 branch
BranchTrueFalseTotal
if ($cmd =~ /(STOR|APPE|STOU)/ and exists do { *$ftp }->{"net_ftp_allo"} and $ftp->supported("ALLO")) 0 0 0
Condition0%0/6
$cmd =~ /(STOR|APPE|STOU)/ and exists do { *$ftp }->{"net_ftp_allo"} and $ftp->supported("ALLO")
!ll&&!rl&&r
000
$cmd =~ /(STOR|APPE|STOU)/ and exists do { *$ftp }->{"net_ftp_allo"}
!ll&&!rl&&r
000
MC/DC0%0/3
$cmd =~ /(STOR|APPE|STOU)/ and exists do { *$ftp }->{"net_ftp_allo"} and $ftp->supported("ALLO")
$cmd =~ /(STOR|APPE|STOU)/ exists do { *$ftp }->{"net_ftp_allo"} $ftp->supported("ALLO")
Truth table0%0/4
A and B and C
A= $cmd =~ /(STOR|APPE|STOU)/B= exists do { *$ftp }->{"net_ftp_allo"}C= $ftp->supported("ALLO")
ABCresult
0XX0
10X0
1100
1111
1171 $ftp->supported("ALLO"))
1172 {
1173 0 $ftp->_ALLO(delete ${*$ftp}{net_ftp_allo})
1174 0 ▶ or return;
Branch: 1 branch
BranchTrueFalseTotal
$ftp->_ALLO(delete do { *$ftp }->{"net_ftp_allo"}) or return 0 0 0
1175 }
1176  
1177 0 $ftp->command($cmd, @_);
1178  
1179 return 1
1180 0 ▶ if (defined ${*$ftp}{'net_ftp_pasv'});
Branch: 1 branch
BranchTrueFalseTotal
if defined do { *$ftp }->{"net_ftp_pasv"} 0 0 0
1181  
1182 0 $ok = CMD_INFO == $ftp->response();
1183  
1184 return $ok
1185 0 ▶ unless exists ${*$ftp}{'net_ftp_intern_port'};
Branch: 1 branch
BranchTrueFalseTotal
unless exists do { *$ftp }->{"net_ftp_intern_port"} 0 0 0
1186  
1187 0 ▶ if ($ok) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ok) 0 0 0
1188 0 my $data = $ftp->_dataconn();
1189  
1190 0 ▶ $data->reading
Branch: 1 branch
BranchTrueFalseTotal
if $data and $cmd =~ /RETR|LIST|NLST|MLSD/ 0 0 0
Condition0%0/3
$data and $cmd =~ /RETR|LIST|NLST|MLSD/
!ll&&!rl&&r
000
MC/DC0%0/2
$data and $cmd =~ /RETR|LIST|NLST|MLSD/
$data $cmd =~ /RETR|LIST|NLST|MLSD/
Truth table0%0/3
A and B
A= $dataB= $cmd =~ /RETR|LIST|NLST|MLSD/
ABresult
0X0
100
111
1191 if $data && $cmd =~ /RETR|LIST|NLST|MLSD/;
1192  
1193 0 return $data;
1194 }
1195  
1196  
1197 0 close(delete ${*$ftp}{'net_ftp_listen'});
1198  
1199 0 return;
1200 }
1201  
1202 ##
1203 ## Over-ride methods (Net::Cmd)
1204 ##
1205  
1206  
1207 0 ▶sub debug_text { $_[2] =~ /^(pass|resp|acct)/i ? "$1 ....\n" : $_[2]; }
Subroutine debug_text: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
$_[2] =~ /^(pass|resp|acct)/i ? : 0 0 0
1208  
1209  
1210 0 ▶sub command {
Subroutine command: not called CC=1 SCAR=6.9
Pod documented
1211 0 my $ftp = shift;
1212  
1213 0 delete ${*$ftp}{'net_ftp_port'};
1214 0 $ftp->SUPER::command(@_);
1215 }
1216  
1217  
1218 0 ▶sub response {
Subroutine response: not called CC=4 SCAR=30.0
Pod documented
1219 0 my $ftp = shift;
1220 0 ▶ my $code = $ftp->SUPER::response() || 5; # assume 500 if undef
Condition0%0/2
$ftp->SUPER::response || 5
l!l
00
MC/DC0%0/1
$ftp->SUPER::response || 5
$ftp->SUPER::response
Truth table0%0/2
A
A= $ftp->SUPER::response
Aresult
11
00
1221  
1222 0 ▶ delete ${*$ftp}{'net_ftp_pasv'}
Branch: 1 branch
BranchTrueFalseTotal
if $code != 3 and $code != 1 0 0 0
Condition0%0/3
$code != 3 and $code != 1
!ll&&!rl&&r
000
MC/DC0%0/2
$code != 3 and $code != 1
$code != 3 $code != 1
Truth table0%0/3
A and B
A= $code != 3B= $code != 1
ABresult
0X0
100
111
1223 if ($code != CMD_MORE && $code != CMD_INFO);
1224  
1225 0 $code;
1226 }
1227  
1228  
1229 0 ▶sub parse_response {
Subroutine parse_response: not called CC=4 SCAR=30.0
Pod documented
1230 0 ▶ return ($1, $2 eq "-")
Branch: 1 branch
BranchTrueFalseTotal
if $_[1] =~ s/^(\d\d\d)([- ]?)//o 0 0 0
1231 if $_[1] =~ s/^(\d\d\d)([- ]?)//o;
1232  
1233 0 my $ftp = shift;
1234  
1235 # Darn MS FTP server is a load of CRAP !!!!
1236 # Expect to see undef here.
1237 return ()
1238 0 ▶ unless 0 + (${*$ftp}{'net_cmd_code'} || 0);
Branch: 1 branch
BranchTrueFalseTotal
unless 0 + (do { *$ftp }->{"net_cmd_code"} || 0) 0 0 0
Condition0%0/2
do { *$ftp }->{'net_cmd_code'} || 0
l!l
00
MC/DC0%0/1
do { *$ftp }->{'net_cmd_code'} || 0
do { *$ftp }->{'net_cmd_code'}
Truth table0%0/2
A
A= do { *$ftp }->{'net_cmd_code'}
Aresult
11
00
1239  
1240 0 (${*$ftp}{'net_cmd_code'}, 1);
1241 }
1242  
1243 ##
1244 ## Allow 2 servers to talk directly
1245 ##
1246  
1247  
1248 0 ▶sub pasv_xfer_unique {
Subroutine pasv_xfer_unique: not called CC=1 SCAR=6.9
Pod documented
1249 0 my ($sftp, $sfile, $dftp, $dfile) = @_;
1250 0 $sftp->pasv_xfer($sfile, $dftp, $dfile, 1);
1251 }
1252  
1253  
1254 0 ▶sub pasv_xfer {
Subroutine pasv_xfer: not called CC=8 SCAR=42.8
Pod documented
1255 0 my ($sftp, $sfile, $dftp, $dfile, $unique) = @_;
1256  
1257 0 ▶ ($dfile = $sfile) =~ s#.*/##
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dfile 0 0 0
1258 unless (defined $dfile);
1259  
1260 0 ▶ my $port = $sftp->pasv
Branch: 1 branch
BranchTrueFalseTotal
my $port = $sftp->pasv or return 0 0 0
1261 or return;
1262  
1263 0 ▶ $dftp->port($port)
Branch: 1 branch
BranchTrueFalseTotal
$dftp->port($port) or return 0 0 0
1264 or return;
1265  
1266 return
1267 0 ▶ unless ($unique ? $dftp->stou($dfile) : $dftp->stor($dfile));
Branch: 2 branches
BranchTrueFalseTotal
unless $unique ? $dftp->stou($dfile) : $dftp->stor($dfile) 0 0 0
$unique ? : 0 0 0
1268  
1269 0 ▶ unless ($sftp->retr($sfile) && $sftp->response == CMD_INFO) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($sftp->retr($sfile) and $sftp->response == 1) 0 0 0
Condition0%0/3
$sftp->retr($sfile) and $sftp->response == 1
!ll&&!rl&&r
000
MC/DC0%0/2
$sftp->retr($sfile) and $sftp->response == 1
$sftp->retr($sfile) $sftp->response == 1
Truth table0%0/3
A and B
A= $sftp->retr($sfile)B= $sftp->response == 1
ABresult
0X0
100
111
1270 0 $sftp->retr($sfile);
1271 0 $dftp->abort;
1272 0 $dftp->response();
1273 0 return;
1274 }
1275  
1276 0 $dftp->pasv_wait($sftp);
1277 }
1278  
1279  
1280 0 ▶sub pasv_wait {
Subroutine pasv_wait: not called CC=8 SCAR=42.8
Pod documented
1281 0 ▶ @_ == 2 or croak 'usage: $ftp->pasv_wait($non_pasv_server)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$ftp->pasv_wait(\$non_pasv_server)") 0 0 0
1282  
1283 0 my ($ftp, $non_pasv_server) = @_;
1284 0 my ($file, $rin, $rout);
1285  
1286 0 vec($rin = '', fileno($ftp), 1) = 1;
1287 0 select($rout = $rin, undef, undef, undef);
1288  
1289 0 my $dres = $ftp->response();
1290 0 my $sres = $non_pasv_server->response();
1291  
1292 return
1293 0 ▶ unless $dres == CMD_OK && $sres == CMD_OK;
Branch: 1 branch
BranchTrueFalseTotal
unless $dres == 2 and $sres == 2 0 0 0
Condition0%0/3
$dres == 2 and $sres == 2
!ll&&!rl&&r
000
MC/DC0%0/2
$dres == 2 and $sres == 2
$dres == 2 $sres == 2
Truth table0%0/3
A and B
A= $dres == 2B= $sres == 2
ABresult
0X0
100
111
1294  
1295 return
1296 0 ▶ unless $ftp->ok() && $non_pasv_server->ok();
Branch: 1 branch
BranchTrueFalseTotal
unless $ftp->ok and $non_pasv_server->ok 0 0 0
Condition0%0/3
$ftp->ok and $non_pasv_server->ok
!ll&&!rl&&r
000
MC/DC0%0/2
$ftp->ok and $non_pasv_server->ok
$ftp->ok $non_pasv_server->ok
Truth table0%0/3
A and B
A= $ftp->okB= $non_pasv_server->ok
ABresult
0X0
100
111
1297  
1298 0 ▶ return $1
Branch: 1 branch
BranchTrueFalseTotal
if $ftp->message =~ /unique file name:\s*(\S*)\s*\)/ 0 0 0
1299 if $ftp->message =~ /unique file name:\s*(\S*)\s*\)/;
1300  
1301 0 ▶ return $1
Branch: 1 branch
BranchTrueFalseTotal
if $non_pasv_server->message =~ /unique file name:\s*(\S*)\s*\)/ 0 0 0
1302 if $non_pasv_server->message =~ /unique file name:\s*(\S*)\s*\)/;
1303  
1304 0 return 1;
1305 }
1306  
1307  
1308 0 ▶sub feature {
Subroutine feature: not called CC=4 SCAR=30.0
Pod documented
1309 0 ▶ @_ == 2 or croak 'usage: $ftp->feature($name)';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 or croak("usage: \$ftp->feature(\$name)") 0 0 0
1310 0 my ($ftp, $name) = @_;
1311  
1312 0 ▶ my $feature = ${*$ftp}{net_ftp_feature} ||= do {
Condition0%0/3
do { *$ftp }->{"net_ftp_feature"} ||= do { my @feat; @feat = map({/^\s+(.*\S)/;} $ftp->message) if $ftp->_FEAT; \@feat }
l!l&&r!l&&!r
000
MC/DC0%0/2
do { *$ftp }->{"net_ftp_feature"} ||= do { my @feat; @feat = map({/^\s+(.*\S)/;} $ftp->message) if $ftp->_FEAT; \@feat }
do { *$ftp }->{"net_ftp_feature"} do { my @feat; @feat = map({/^\s+(.*\S)/;} $ftp->message) if $ftp->_FEAT; \@feat }
Truth table0%0/3
A ||= B
A= do { *$ftp }->{"net_ftp_feature"}B= do { my @feat; @feat = map({/^\s+(.*\S)/;} $ftp->message) if $ftp->_FEAT; \@feat }
ABresult
1X1
011
000
1313 0 my @feat;
1314  
1315 # Example response
1316 # 211-Features:
1317 # MDTM
1318 # REST STREAM
1319 # SIZE
1320 # 211 End
1321  
1322 0 ▶ @feat = map { /^\s+(.*\S)/ } $ftp->message
Branch: 1 branch
BranchTrueFalseTotal
if $ftp->_FEAT 0 0 0
1323 if $ftp->_FEAT;
1324  
1325 0 \@feat;
1326 };
1327  
1328 0 return grep { /^\Q$name\E\b/i } @$feature;
1329 }
1330  
1331  
1332 0 ▶sub cmd { shift->command(@_)->response() }
Subroutine cmd: not called CC=1 SCAR=6.9
Pod undocumented
1333  
1334 ########################################
1335 #
1336 # RFC959 + RFC2428 + RFC4217 commands
1337 #
1338  
1339  
1340 0 ▶sub _ABOR { shift->command("ABOR")->response() == CMD_OK }
Subroutine _ABOR: not called CC=1 SCAR=6.9
1341 0 ▶sub _ALLO { shift->command("ALLO", @_)->response() == CMD_OK }
Subroutine _ALLO: not called CC=1 SCAR=6.9
1342 0 ▶sub _CDUP { shift->command("CDUP")->response() == CMD_OK }
Subroutine _CDUP: not called CC=1 SCAR=6.9
1343 0 ▶sub _NOOP { shift->command("NOOP")->response() == CMD_OK }
Subroutine _NOOP: not called CC=1 SCAR=6.9
1344 0 ▶sub _PASV { shift->command("PASV")->response() == CMD_OK }
Subroutine _PASV: not called CC=1 SCAR=6.9
1345 0 ▶sub _QUIT { shift->command("QUIT")->response() == CMD_OK }
Subroutine _QUIT: not called CC=1 SCAR=6.9
1346 0 ▶sub _DELE { shift->command("DELE", @_)->response() == CMD_OK }
Subroutine _DELE: not called CC=1 SCAR=6.9
1347 0 ▶sub _CWD { shift->command("CWD", @_)->response() == CMD_OK }
Subroutine _CWD: not called CC=1 SCAR=6.9
1348 0 ▶sub _PORT { shift->command("PORT", @_)->response() == CMD_OK }
Subroutine _PORT: not called CC=1 SCAR=6.9
1349 0 ▶sub _RMD { shift->command("RMD", @_)->response() == CMD_OK }
Subroutine _RMD: not called CC=1 SCAR=6.9
1350 0 ▶sub _MKD { shift->command("MKD", @_)->response() == CMD_OK }
Subroutine _MKD: not called CC=1 SCAR=6.9
1351 0 ▶sub _PWD { shift->command("PWD", @_)->response() == CMD_OK }
Subroutine _PWD: not called CC=1 SCAR=6.9
1352 0 ▶sub _TYPE { shift->command("TYPE", @_)->response() == CMD_OK }
Subroutine _TYPE: not called CC=1 SCAR=6.9
1353 0 ▶sub _RNTO { shift->command("RNTO", @_)->response() == CMD_OK }
Subroutine _RNTO: not called CC=1 SCAR=6.9
1354 0 ▶sub _RESP { shift->command("RESP", @_)->response() == CMD_OK }
Subroutine _RESP: not called CC=1 SCAR=6.9
1355 0 ▶sub _MDTM { shift->command("MDTM", @_)->response() == CMD_OK }
Subroutine _MDTM: not called CC=1 SCAR=6.9
1356 0 ▶sub _SIZE { shift->command("SIZE", @_)->response() == CMD_OK }
Subroutine _SIZE: not called CC=1 SCAR=6.9
1357 0 ▶sub _HELP { shift->command("HELP", @_)->response() == CMD_OK }
Subroutine _HELP: not called CC=1 SCAR=6.9
1358 0 ▶sub _STAT { shift->command("STAT", @_)->response() == CMD_OK }
Subroutine _STAT: not called CC=1 SCAR=6.9
1359 0 ▶sub _FEAT { shift->command("FEAT", @_)->response() == CMD_OK }
Subroutine _FEAT: not called CC=1 SCAR=6.9
1360 0 ▶sub _PBSZ { shift->command("PBSZ", @_)->response() == CMD_OK }
Subroutine _PBSZ: not called CC=1 SCAR=6.9
1361 0 ▶sub _PROT { shift->command("PROT", @_)->response() == CMD_OK }
Subroutine _PROT: not called CC=1 SCAR=6.9
1362 0 ▶sub _CCC { shift->command("CCC", @_)->response() == CMD_OK }
Subroutine _CCC: not called CC=1 SCAR=6.9
1363 0 ▶sub _EPRT { shift->command("EPRT", @_)->response() == CMD_OK }
Subroutine _EPRT: not called CC=1 SCAR=6.9
1364 0 ▶sub _EPSV { shift->command("EPSV", @_)->response() == CMD_OK }
Subroutine _EPSV: not called CC=1 SCAR=6.9
1365 0 ▶sub _APPE { shift->command("APPE", @_)->response() == CMD_INFO }
Subroutine _APPE: not called CC=1 SCAR=6.9
1366 0 ▶sub _LIST { shift->command("LIST", @_)->response() == CMD_INFO }
Subroutine _LIST: not called CC=1 SCAR=6.9
1367 0 ▶sub _NLST { shift->command("NLST", @_)->response() == CMD_INFO }
Subroutine _NLST: not called CC=1 SCAR=6.9
1368 0 ▶sub _RETR { shift->command("RETR", @_)->response() == CMD_INFO }
Subroutine _RETR: not called CC=1 SCAR=6.9
1369 0 ▶sub _STOR { shift->command("STOR", @_)->response() == CMD_INFO }
Subroutine _STOR: not called CC=1 SCAR=6.9
1370 0 ▶sub _STOU { shift->command("STOU", @_)->response() == CMD_INFO }
Subroutine _STOU: not called CC=1 SCAR=6.9
1371 0 ▶sub _RNFR { shift->command("RNFR", @_)->response() == CMD_MORE }
Subroutine _RNFR: not called CC=1 SCAR=6.9
1372 0 ▶sub _REST { shift->command("REST", @_)->response() == CMD_MORE }
Subroutine _REST: not called CC=1 SCAR=6.9
1373 0 ▶sub _PASS { shift->command("PASS", @_)->response() }
Subroutine _PASS: not called CC=1 SCAR=6.9
1374 0 ▶sub _ACCT { shift->command("ACCT", @_)->response() }
Subroutine _ACCT: not called CC=1 SCAR=6.9
1375 0 ▶sub _AUTH { shift->command("AUTH", @_)->response() }
Subroutine _AUTH: not called CC=1 SCAR=6.9
1376  
1377  
1378 0 ▶sub _USER {
Subroutine _USER: not called CC=3 SCAR=24.8
1379 0 my $ftp = shift;
1380 0 my $ok = $ftp->command("USER", @_)->response();
1381  
1382 # A certain brain dead firewall :-)
1383 0 ▶ $ok = $ftp->command("user", @_)->response()
Branch: 1 branch
BranchTrueFalseTotal
unless $ok == 3 or $ok == 2 0 0 0
Condition0%0/3
$ok == 3 or $ok == 2
l!l&&r!l&&!r
000
MC/DC0%0/2
$ok == 3 or $ok == 2
$ok == 3 $ok == 2
Truth table0%0/3
A or B
A= $ok == 3B= $ok == 2
ABresult
1X1
011
000
1384 unless $ok == CMD_MORE or $ok == CMD_OK;
1385  
1386 0 $ok;
1387 }
1388  
1389  
1390 0 ▶sub _SMNT { shift->unsupported(@_) }
Subroutine _SMNT: not called CC=1 SCAR=6.9
1391 0 ▶sub _MODE { shift->unsupported(@_) }
Subroutine _MODE: not called CC=1 SCAR=6.9
1392 0 ▶sub _SYST { shift->unsupported(@_) }
Subroutine _SYST: not called CC=1 SCAR=6.9
1393 0 ▶sub _STRU { shift->unsupported(@_) }
Subroutine _STRU: not called CC=1 SCAR=6.9
1394 0 ▶sub _REIN { shift->unsupported(@_) }
Subroutine _REIN: not called CC=1 SCAR=6.9
1395  
1396  
1397 2 1;
1398  
1399 __END__
↑ Summary Domain.pm »