On Thu, Aug 07, 2003 at 02:43:12PM -0400, Allison, Jason (JALLISON) wrote:
> if (scalar(@ReadyHandles) > 0)
> {
> ...
> else
> {
> if (! $ERRNO)
> {
> ...
> }
> else
> {
> # Error on select() call
> unless ($ERRNO == EINTR)
> {
> ...
>
> Somehow ERRNO is getting set differently using 5.8.0. Even
> more strange, the package works great using the Tk debugger
> and 5.8.0. So here I am trying to learn a few things: How
> ERRNO works, and why our team chose to use ERRNO when checking
> the handles.
They screwed up.
You can't use $! to test for success/failure because successful
system calls *don't clear it*. This means that you have to check
the return value first and check $! once you know that the call
failed.
That's what perlvar means when it says:
$! If used numerically, yields the current value of the C
"errno" variable, with all the usual caveats. (This
means that you shouldn't depend on the value of "$!" to
be anything in particular unless you've gotten a specific
error return indicating a system error.)
And my errno(3) manpage says:
The integer errno is set by system calls (and some library
functions) to indicate what went wrong. Its value is sig-
nificant only when the call returned an error (usually -1),
and a library function that does succeed is allowed to
change errno.
--
Steve
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]