While I think that suggestions by pc88mxer and betterworld are the way to go, I can't help but wonder about the philosophical aspects of the issue :)

All scripts make certain base assumptions in order to function. A stable filesystem to act on is a good base assumption. If NFS is erratic, there's not much the script can do in terms of handling that kind of catastrophic failure. The partial damage would have already occurred in previous while (<>) iterations, anyway.

So, would it be useful to put out a warning that an unexpected critical error has just happened? Yes, that would be nice. But how far do we go?

Will this succeed as a new Perl idiom:
while (<>) { unless ($!) { # do actual stuff here } }
How far do we go down the path of paranoia just to make the script bullet-proof?

Update: Thanks for pointing my mistake out, ikegami. Still, I'd like to know how much is too much when it comes to error checking of this nature.

In reply to Re: When <> fails by repellent
in thread When <> fails by Dinosaur

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.