$!{EINPROGRESS} ????

K

KKramsch

In IO/Socket.pm is find things like $!{EINPROGRESS}, suggesting that
$! is a hash. But in perlvar there's no indication of this:

$OS_ERROR
$ERRNO
$! 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 indi­
cating a system error.) If used an a string,
yields the corresponding system error string. You
can assign a number to $! to set errno if, for
instance, you want "$!" to return the string for
error n, or you want to set the exit value for the
die() operator. (Mnemonic: What just went bang?)

Also see "Error Indicators".

What gives?

Thanks!

Karl
 
P

Paul Lalli

C

Chris Mattern

KKramsch said:
In IO/Socket.pm is find things like $!{EINPROGRESS}, suggesting that
$! is a hash.

It's not. Of course it's not. It can't be. $whatever can only be a
scalar. But %! is a hash, and it'll be accessed by saying
$!{$someindex}.
But in perlvar there's no indication of this:

$OS_ERROR
$ERRNO
$! 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 indi­
cating a system error.) If used an a string,
yields the corresponding system error string. You
can assign a number to $! to set errno if, for
instance, you want "$!" to return the string for
error n, or you want to set the exit value for the
die() operator. (Mnemonic: What just went bang?)

Also see "Error Indicators".

What gives?

Perhaps looking up the variable you're actually dealing with
would've helped. It was right under $!...

%! Each element of "%!" has a true value only if $! is
set to that value. For example, $!{ENOENT} is true
if and only if the current value of $! is "ENOENT";
that is, if the most recent error was "No such file
or directory" (or its moral equivalent: not all
operating systems give that exact error, and
certainly not all languages). To check if a
particular key is meaningful on your system, use
"exists $!{the_key}"; for a list of legal keys, use
"keys %!". See Errno for more information, and also
see above for the validity of $!.
Thanks!

Karl

--
Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,161
Messages
2,570,892
Members
47,427
Latest member
HildredDic

Latest Threads

Top