Subject: | Use of sysread in Net::FTP |
Hi Graham,
this is a followup to bug #33268 regarding the non-standard timeout
parameter used in the read method that Net::FTP::retr
I was testing a change to IO::Uncompress::Base that removed the use of
the offset parameter when I carried out a read. I had written a script
to check that it worked with Net::FTP::retr, but I kept getting the
wrong result.
Anyway, after much head scratching the problem turns out to be the old
chestnut -- never mix buffered & non-buffered IO. The read method
accessed by Net::FTP::retr uses sysread to read data from the socket.
Unfortunately the dataconn class also implements the eof method. In my
code I make use of eof, thus I get the wrong output when I read from a
Net::FTP::retr object in my code.
I'm not sure what your views are on using read instead of sysread when
reading from the socket in Net::FTP. If you aren't in favor of a change
a health warning in the pod might be useful.
Paul