in reply to Re: Could not create socket: Bad file number
in thread Could not create socket: Bad file number

AFAIK, IO::Socket::INET->new() does not set $!,

Quite the opposite. It's the only module I know that does set $! even for errors not originating from system calls. That could account for the error message mismatch.

Replies are listed 'Best First'.
Re^3: Could not create socket: Bad file number
by Joost (Canon) on Aug 30, 2007 at 21:24 UTC
    Well, if it does, I can't find any mention of that behaviour in the documentation. The only thing that I can find that even mentions $! is IO::Handle's blocking() method.

    update: however, reading the source code shows that you're right. But I can't really say if it will always produce a useful error in $! though. Sometimes it sets $! to $EINVAL, other times it just passes on $! from functions that may or may not set $! on failure. (And some build in functions that do set $! are not documented as such in the perldocs, but that's another story)