$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? }