Skip Menu |
 

This queue is for tickets about the libnet CPAN distribution.

Report information
The Basics
Id: 88492
Status: new
Priority: 0/
Queue: libnet

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc: jkeenan [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: jkeenan [...] cpan.org
Subject: [RT #113390] Net::FTP notice read() error on local file
The following bug report was filed in the Perl 5 bug queue at https://rt.perl.org/rt3/Ticket/Display.html?id=113390 in May 2012. Net::FTP is part of the libnet distribution, which is now marked in Perl 5's Porting/Maintainers.pl as being maintained on CPAN. Accordingly, I am transferring the bug report to this queue.--jkeenan ########## In Net::FTP version 2.77, when doing a put() if there's an error from read() it seems to be silently treated as normal eof, where I hoped it would gives some sort of error. I see the code notices an error from binmode(), or socket write() and close(), and gives an undef return, but apparently not for read() trouble. The foo.pl below simulates a read error with a tied file handle. I wonder if the $ftp->put() could return undef in this case. Dunno if it should also carp() or $ftp->message() or whatever for such local errors. Carp might be alright for interactive use, but from a program you'd prefer to get a message or something and display it in your own way. I suppose for compatibility any change to carp vs message or $! etc might have to be just an option.
Subject: foo.pl
Download foo.pl
text/x-perl 766b
use strict; use Net::FTP; use Tie::StdHandle; use POSIX; { package MyTie; use base 'Tie::StdHandle'; my $reads = 0; sub READ { if ($reads++ == 0) { $_[1] = 'abc'; return 3; } else { print "Pretend read error\n"; $! = POSIX::EIO(); return undef; } } } tie *FH, 'MyTie', '</etc/motd'; my $ftp = Net::FTP->new("localhost") or die "Cannot connect: $@"; $ftp->login("anonymous",'') or die "Cannot login: ", $ftp->message; $ftp->cwd("/pub") or die "Cannot cwd: ", $ftp->message; $ftp->delete("dummy.txt") or die "Cannot delete: ", $ftp->message; my $ret = $ftp->put (\*FH, 'dummy.txt'); if (defined $ret) { print "remote filename: $ret\n"; } else { print "Cannot put: ", $ftp->message; } $ftp->quit;


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.