about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2002-02-25 13:58:03 +0000
committerGraham Barr <gbarr@pobox.com>2002-02-25 13:58:03 +0000
commit4b76c1cd2234bdd8ff3e69e7a288038d723d18b5 (patch)
tree7be64c2c7f95d0a4745b2699caabab2c80d7db90
parent093e29c003b73e7a756d878b7601e9067c799a64 (diff)
downloadperl-libnet-4b76c1cd2234bdd8ff3e69e7a288038d723d18b5.tar.gz
Net::FTP
- Allow tied handles to be passed to get/put

-rw-r--r--Net/FTP.pm30
1 files changed, 13 insertions, 17 deletions
diff --git a/Net/FTP.pm b/Net/FTP.pm
index 5c94319..28ea97d 100644
--- a/Net/FTP.pm
+++ b/Net/FTP.pm
@@ -22,7 +22,7 @@ use Net::Config;
 use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC);
 # use AutoLoader qw(AUTOLOAD);
 
-$VERSION = "2.63"; # $Id: //depot/libnet/Net/FTP.pm#66 $
+$VERSION = "2.64"; # $Id: //depot/libnet/Net/FTP.pm#67 $
 @ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
 
 # Someday I will "use constant", when I am not bothered to much about
@@ -411,12 +411,10 @@ sub get
 {
  my($ftp,$remote,$local,$where) = @_;
 
- my($loc,$len,$buf,$resp,$localfd,$data);
+ my($loc,$len,$buf,$resp,$data);
  local *FD;
 
- $localfd = ref($local) || ref(\$local) eq "GLOB"
-             ? fileno($local)
-             : undef;
+ my $localfd = ref($local) || ref(\$local) eq "GLOB";
 
  ($local = $remote) =~ s#^.*/##
         unless(defined $local);
@@ -433,7 +431,7 @@ sub get
  $data = $ftp->retr($remote) or
         return undef;
 
- if(defined $localfd)
+ if($localfd)
   {
    $loc = $local;
   }
@@ -486,14 +484,14 @@ sub get
      carp "Cannot write to Local file $local: $!\n";
      $data->abort;
      close($loc)
-        unless defined $localfd;
+        unless $localfd;
      return undef;
     }
   }
 
  print $hashh "\n" if $hashh;
 
- unless (defined $localfd)
+ unless ($localfd)
   {
    unless (close($loc))
     {
@@ -672,17 +670,15 @@ sub appe { shift->_data_cmd("APPE",@_) }
 sub _store_cmd
 {
  my($ftp,$cmd,$local,$remote) = @_;
- my($loc,$sock,$len,$buf,$localfd);
+ my($loc,$sock,$len,$buf);
  local *FD;
 
- $localfd = ref($local) || ref(\$local) eq "GLOB"
-             ? fileno($local)
-             : undef;
+ my $localfd = ref($local) || ref(\$local) eq "GLOB";
 
  unless(defined $remote)
   {
    croak 'Must specify remote filename with stream input'
-        if defined $localfd;
+        if $localfd;
 
    require File::Basename;
    $remote = File::Basename::basename($local);
@@ -691,7 +687,7 @@ sub _store_cmd
  croak("Bad remote filename '$remote'\n")
         if $remote =~ /[\r\n]/s;
 
- if(defined $localfd)
+ if($localfd)
   {
    $loc = $local;
   }
@@ -746,7 +742,7 @@ sub _store_cmd
     {
      $sock->abort;
      close($loc)
-        unless defined $localfd;
+        unless $localfd;
      print $hashh "\n" if $hashh;
      return undef;
     }
@@ -755,7 +751,7 @@ sub _store_cmd
  print $hashh "\n" if $hashh;
 
  close($loc)
-        unless defined $localfd;
+        unless $localfd;
 
  $sock->close() or
         return undef;
@@ -1714,6 +1710,6 @@ under the same terms as Perl itself.
 
 =for html <hr>
 
-I<$Id: //depot/libnet/Net/FTP.pm#66 $>
+I<$Id: //depot/libnet/Net/FTP.pm#67 $>
 
 =cut