From ce943d01330cade0b20aa9c3565b0d64dfb276d4 Mon Sep 17 00:00:00 2001 From: Graham Barr Date: Sat, 18 Sep 1999 16:34:49 +0000 Subject: Net::FTP - get and put now accept *FD as well as \*FD for the local filehandle --- Net/Cmd.pm | 4 ++-- Net/FTP.pm | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Net/Cmd.pm b/Net/Cmd.pm index ba71d75..1dae8e8 100644 --- a/Net/Cmd.pm +++ b/Net/Cmd.pm @@ -13,7 +13,7 @@ use strict; use vars qw(@ISA @EXPORT $VERSION); use Carp; -$VERSION = "2.15"; +$VERSION = "2.16"; @ISA = qw(Exporter); @EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING); @@ -168,7 +168,7 @@ sub command { local $SIG{PIPE} = 'IGNORE'; - my $str = join(" ", map { tr/\n/ /; $_; } @_) . "\015\012"; + my $str = join(" ", map { /\n/ ? do { my $n = $_; $n =~ tr/\n/ /; $n } : $_; } @_) . "\015\012"; my $len = length $str; my $swlen; diff --git a/Net/FTP.pm b/Net/FTP.pm index d2b9aa1..bc7ed20 100644 --- a/Net/FTP.pm +++ b/Net/FTP.pm @@ -21,7 +21,7 @@ use Net::Cmd; use Net::Config; # use AutoLoader qw(AUTOLOAD); -$VERSION = "2.52"; # $Id: //depot/libnet/Net/FTP.pm#39 $ +$VERSION = "2.53"; # $Id: //depot/libnet/Net/FTP.pm#40 $ @ISA = qw(Exporter Net::Cmd IO::Socket::INET); # Someday I will "use constant", when I am not bothered to much about @@ -368,8 +368,9 @@ sub get my($loc,$len,$buf,$resp,$localfd,$data); local *FD; - $localfd = ref($local) ? fileno($local) - : undef; + $localfd = ref($local) || ref(\$local) eq "GLOB" + ? fileno($local) + : undef; ($local = $remote) =~ s#^.*/## unless(defined $local); @@ -597,8 +598,9 @@ sub _store_cmd my($loc,$sock,$len,$buf,$localfd); local *FD; - $localfd = ref($local) ? fileno($local) - : undef; + $localfd = ref($local) || ref(\$local) eq "GLOB" + ? fileno($local) + : undef; unless(defined $remote) { -- cgit v1.2.3-24-ge0c7