|
|
| Syntactic Confectionery Delight | |
| PerlMonks |
Re: blocking, non-blocking, and semi-blockingby matija (Priest) |
| on Aug 29, 2004 at 09:16 UTC ( #386712=note: print w/ replies, xml ) | Need Help?? |
|
(I do know about File::Tail, in case anyone was going to suggest that, but I couldn't see how to implement it non-blocking and integrate that with the socket listener.) Actually, File::Tail has a select for that very purpose. The way to use it is to pass all the socket filehandles to File::Tail's select exactly the way you'd pass them to the regular select. Then you take all the File::Tail objects, and you put them behind all the other parameters in the select. Select will return when any of the filehandles are ready for reading, and File::Tail's select will do exactly the same, except it will also return if any of the File::Tail objects have stuff to read.
So, to use File::Tail for this, just replace the undefs in the select call with the appropriate bit vectors for your socket filehandles.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||