my ( $addr, $usr, $pwd, $ascii, $active, $timeout ) = @_;
my $ftp;
# Set up new FTP with active mode and user-specified timeout...
if ( $active and $timeout )
{
$ftp = Net::FTP -> new ( $addr, Passive => 0, Timeout => $timeout )
or die "Failed to connect to FTP (w/ active, timeout): $addr";
}
# Login to new FTP
$ftp -> login ( $usr, $pwd )
or die "Failed to login to FTP: " . $ftp->message;
# Set ASCII or binary transfer modes
if ( $ascii ) { $ftp -> ascii(); }
else { $ftp -> binary(); }
print "LOGIN: $addr\n";
return $ftp;
}
有人可以解释上面在做什么吗?它登录到ftp,然后返回它?它实际上返回了什么?这是上传还是下载?