in reply to Re: Testing for readdir failure
in thread Testing for readdir failure

???

I did NOT test the value of $! after the readdir because readdir does not set its value, as shown by this small piece of code executed under the debugger:

Here is a better one

opendir D, q/./; closedir D; readdir D or die int $!, q/ /, $!; __END__ 9 Bad file descriptor at - line 3.

perlvar#%!

readdir STDOUT or die Fudge(); sub Fudge { join "\n", join(' ', int $!, $! ), join(' ', int $^E, $^E ), ( grep { $!{$_} } keys %! ), ' '; } __END__ 9 Bad file descriptor 6 The handle is invalid EVENT_SYSTEM_CAPTUREEND ERROR_INVALID_BLOCK EBADF EMR_SETWINDOWEXTEX EDGE_BUMP EMARCH_ENC_I17_IMM9D_SIZE_X at - line 1.