in reply to Re: Testing for read() failures on different platforms
in thread Testing for read() failures on different platforms

I can think of two ways a read from a successfully opened file could fail:

Opening a file for write access and then trying to read from it. Perl catches this.

Opening a file on removeable media, and then the media is removed before the read attempt.

Under win32 (native), this results in an "Abort, retry, continue" popup. Retry is loop unless it is reinserted. The other two result in the read completing as if the file where empty. Ie. a successful read of zero bytes. I'm not sure what *nix would do under these circumstances.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon
  • Comment on Re^2: Testing for read() failures on different platforms

Replies are listed 'Best First'.
Re^3: Testing for read() failures on different platforms
by PodMaster (Abbot) on Jul 27, 2004 at 07:40 UTC
    You forgot about corrupted media. The cheapest media to corrupt is CD-Roms. Take 1, burn a giant file to take up all the space, then scratch it, then try reading from it.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Re^3: Testing for read() failures on different platforms
by leriksen (Curate) on Jul 27, 2004 at 05:07 UTC
    I'm thinking more along the lines of an NFS or Samba mount that goes bye-bye

    +++++++++++++++++
    #!/usr/bin/perl
    use warnings;use strict;use brain;