about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2003-05-21 18:59:50 +0000
committerGraham Barr <gbarr@pobox.com>2003-05-21 18:59:50 +0000
commitf6288274d3a41805a18bcac12db5ba81da5c4892 (patch)
treed908a93f91816ca6009a4a418bfc3180ac419f71
parentd23c2e4ca98e7d03a0e6227d441a73c9df958a00 (diff)
downloadperl-libnet-f6288274d3a41805a18bcac12db5ba81da5c4892.tar.gz
Use read/print instead of sysread/syswrite for local files
so CRLF translation happens if it needs to

-rw-r--r--Net/FTP.pm10
1 files changed, 5 insertions, 5 deletions
diff --git a/Net/FTP.pm b/Net/FTP.pm
index b7f4caa..e966d1c 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.68"; # $Id: //depot/libnet/Net/FTP.pm#73 $
+$VERSION = "2.68"; # $Id: //depot/libnet/Net/FTP.pm#74 $
 @ISA     = qw(Exporter Net::Cmd IO::Socket::INET);
 
 # Someday I will "use constant", when I am not bothered to much about
@@ -466,6 +466,7 @@ sub get
    if($ref = ${*$ftp}{'net_ftp_hash'});
 
  my $blksize = ${*$ftp}{'net_ftp_blksize'};
+ local $\; # Just in case
 
  while(1)
   {
@@ -482,8 +483,7 @@ sub get
     print $hashh "#" x (int($count / $hashb));
     $count %= $hashb;
    }
-   my $written = syswrite($loc,$buf,$len);
-   unless(defined($written) && $written == $len)
+   unless(print $loc $buf)
     {
      carp "Cannot write to Local file $local: $!\n";
      $data->abort;
@@ -730,7 +730,7 @@ sub _store_cmd
 
  while(1)
   {
-   last unless $len = sysread($loc,$buf="",$blksize);
+   last unless $len = read($loc,$buf="",$blksize);
 
    if (trEBCDIC && $ftp->type ne 'I')
     {
@@ -1729,6 +1729,6 @@ under the same terms as Perl itself.
 
 =for html <hr>
 
-I<$Id: //depot/libnet/Net/FTP.pm#73 $>
+I<$Id: //depot/libnet/Net/FTP.pm#74 $>
 
 =cut