in reply to Re^8: Best way to handle readline errors?
in thread Best way to handle readline errors?

Plus, the docs for $! state "after a failure". There is no definition for "failure" given

The docs are clear. $! is either set or it's value is meanlingless. Both the docs for the read system call and your own observations show that $! doesn't get set on EOF.

You could say the docs for readline override the docs for $!, but that's obviously not true.

If you don't care about portability, and you think it's safe enough for you, it's your call. Be sure to pick a value for $! that doesn't correspond to a valid errno on your system. Zero is probably a bad pick.

Could you please post the output of "uname -a" on the version of unix where you ran my test program

I'm using various versions of Perl on various versions of Windows.

Replies are listed 'Best First'.
Re^10: Best way to handle readline errors?
by jrw (Monk) on Nov 30, 2006 at 00:59 UTC
    My belief is that, on unix, $! mirrors errno exactly. And on unix, errno behaves the way I have described. It is modified (to a non-zero value) by failing system calls and not modified by successful ones. Therefore, on unix, setting $! to zero before making a call to a perl function which (may) make a system call is a valid way of checking for an error.

    Can anyone explain why Windows perl behaves as it does, and not like unix, in this respect?

    In any case, using readline on Windows seems like a very iffy proposition if you're doing any serious programming which requires tight error checking. I wish that weren't so, because readline certainly is convenient.