|go ahead... be a heretic|
What makes IO::Select::can_read return?by beemshake (Novice)
|on Feb 01, 2005 at 21:21 UTC||Need Help??|
beemshake has asked for the wisdom of the Perl Monks concerning the following question:
Okay, I know there are 3 obvious reasons IO::Select::can_read returns:
1) a filehandle has data to be read
The problem is, I'm running into cases where can_read returns, but none of the above is true. Unfortunately, it's a big, bloated bunch of libraries and scripts to make it run, and I haven't been able to condense it into a simple testcase that others can use to reproduce it. But I can show you the code:
In most cases this works fine, with a $timeout value of say 300. Occasionally, however, I'll instantly fall through to the else clause, clearly not having waited for $timeout seconds. If I set $timeout to undef it works. I am certain that the message I'm attempting to read is being sent in all cases, why is it that if I have a $timeout value I get this odd behavior? Are there known reasons that can_read would return undef before the $timeout seconds have elapsed?
20050203 Edit by castaway: Changed title from 'What makes can_read return?'