about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>1999-09-18 16:34:49 +0000
committerGraham Barr <gbarr@pobox.com>1999-09-18 16:34:49 +0000
commitce943d01330cade0b20aa9c3565b0d64dfb276d4 (patch)
treee892614cd48d6062b915dcd3089cc4ec54506219
parent2cbc4327c3c77bc1366ebb3d90853c3e879bfd75 (diff)
downloadperl-libnet-ce943d01330cade0b20aa9c3565b0d64dfb276d4.tar.gz
Net::FTP
- get and put now accept *FD as well as \*FD for the local filehandle

-rw-r--r--Net/Cmd.pm4
-rw-r--r--Net/FTP.pm12
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)
   {