Hello, I have noticed that the description of select perl function in perlfunc manual (the one that calls the select(2) syscall) doesn't mention anything about the possibility of having -1 as a return value when an error occurs.
I think this might have been the reason why some popular perl modules (it's the case of, at least IO::Select and Net::SNMP(*)) don't handle this case in their code. In the case of IO::Select, I have had to clear $! before calling its select method to figure out if there has been an error. In the case of Net::SNMP, when select returns, it goes unconditionally to a blocking recv (this isn't always correct since select could have finished because a signal has arrived, not because data is available for reading). Another issue with select that I consider should be mentioned in perlfunc manual, is that in some systems (i.e., Linux) it could return a socket file descriptor as ready for reading, when actually no data is available, which can be solved using always nonblocking sockets (the manual page for select(2) shipped in debian woody is an example). Net::SNMP has this problem (i.e.: does not use nonblocking sockets). (*) I have contacted the author of this module, and the issue was corrected in release 5.0.0. Regards, Hernan A. Perez Masci.