in reply to Re^2: How do I get my IO::Socket::UNIX sockets to be non-blocking?
in thread How do I get my IO::Socket::UNIX sockets to be non-blocking?

Are you sure? You may be right, but that's not what the documents say. The blocking() method is inherited from IO::Handle, from what I can tell, and the documentation for IO::Handle says the following:

$io->blocking ( [ BOOL ] )
If called with an argument blocking will turn on non-blocking IO if BOOL is false, and turn it off if BOOL is true.

blocking will return the value of the previous setting, or the current setting if BOOL is not given.

If an error occurs blocking will return undef and $! will be set.

...which should make it a good candidate for "or die $!;" syntax.


Dave

Replies are listed 'Best First'.
Re^4: How do I get my IO::Socket::UNIX sockets to be non-blocking?
by BrowserUk (Patriarch) on Feb 02, 2006 at 04:03 UTC

    That's really confused. How do you determine the difference between success and failure with

    $rv = $io->block(); ## Find out the current setting if( !$rv ) { ## Is non-blocking enabled or did the call fail? } $rv = $io->blocking( 1 ); ## Turn on blocking (turn off non-blocking) if( !$rv ) { ## Was non-blocking previously enabled or did the call fail? } $rv = $io->blocking( 0 ); ## Turn off blocking if( !$rv ) { ## Did we succeed or did the call fail? }

    What would or die $! be telling you?

    A candidate for "Bad Interface Award of 1995, 1996, 1997, ... " :)


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.