|Perl: the Markov chain saw|
poorly documented behaviour of readline() and IO::Selectby vsespb (Chaplain)
|on Apr 28, 2010 at 10:43 UTC||Need Help??|
vsespb has asked for the
wisdom of the Perl Monks concerning the following question:
Hi. I worked with a perl blocking sockets and found a weird thing.
Looks like IO::Select works bad when you read from sockets with <$fh> in case someone on the other end wrote to the socket _two_ or more lines. I.e. <$fh> will return one line. Second line will be read too by perl process but kept in perlio layer buffers. So IO::Select will return no sockets too read.
In practice this can produce hardly-to catch errors on application. I.e application can work _fine_ for a long time until it receive two lines at once cause of a big delay when handling previous lines.
I think this is lack in perl documentation. There is no word about this. Nothing about possible _read_ buffering problem. And lots of perl code all over the internet with io::select and <$fh>.
What do you think ?