diff options
author | Graham Barr <gbarr@pobox.com> | 2008-02-09 13:32:32 +0000 |
---|---|---|
committer | Graham Barr <gbarr@pobox.com> | 2009-02-24 10:40:48 -0600 |
commit | 38626190f26a01e8fd311a2ade1a7a1e802c3271 (patch) | |
tree | c498fbfe8bb94bf48ba1df027c03d15413ac1ef4 | |
parent | 68269e2c17a5976368c506a78d741d487a3a411b (diff) | |
download | perl-libnet-38626190f26a01e8fd311a2ade1a7a1e802c3271.tar.gz |
Do not create/pass a remote name if one is not given to put_unique
-rw-r--r-- | Net/FTP.pm | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -21,7 +21,7 @@ use Net::Cmd; use Net::Config; use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC); -$VERSION = '2.77'; +$VERSION = '2.77_1'; @ISA = qw(Exporter Net::Cmd IO::Socket::INET); # Someday I will "use constant", when I am not bothered to much about @@ -688,7 +688,7 @@ sub _store_cmd { my $localfd = ref($local) || ref(\$local) eq "GLOB"; - unless (defined $remote) { + if (!defined($remote) and 'STOU' ne uc($cmd)) { croak 'Must specify remote filename with stream input' if $localfd; @@ -708,7 +708,7 @@ sub _store_cmd { $ftp->_ALLO($size) if $size; } croak("Bad remote filename '$remote'\n") - if $remote =~ /[\r\n]/s; + if defined($remote) and $remote =~ /[\r\n]/s; if ($localfd) { $loc = $local; @@ -730,7 +730,7 @@ sub _store_cmd { delete ${*$ftp}{'net_ftp_port'}; delete ${*$ftp}{'net_ftp_pasv'}; - $sock = $ftp->_data_cmd($cmd, $remote) + $sock = $ftp->_data_cmd($cmd, grep { defined } $remote) or return undef; $remote = ($ftp->message =~ /FILE:\s*(.*)/)[0] |