The current file handle that
<> is using is stored in
ARGV, but my testing shows that perl has alrady closed
ARGV when the
while (<>) {...} loop terminates.
You might try checking $! to see if that gets set when the NFS server stops serving the file:
while (<>) {
...
}
# check $! which is probably from the last close
Update:
ikegami pointed out that testing
$! (as in
if ($!) ... doesn't make sense here.
One issue is that $! is only set when there is an error. One way around this is to force a known error at the end of the loop so that you can tell if readline generated an error.
Update 2: One can assign to $!, so this should be able to detect if readline failed:
while (<>) {
...
$! = undef;
}
if (defined($!)) {
# $! contains error from last <c>close
}
</c>
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.