December 2000
Intermediate to advanced
784 pages
20h 54m
English
As explained in Chapter 12, it's dangerous to mix line-oriented reads with select() because the select call doesn't know about the contents of the stdio buffers. Another problem is a line-oriented read blocks if there isn't a complete line to read; as soon as any I/O operation blocks, a multiplexed program stalls.
What we would like to do is to change the semantics of the getline() call so that we can distinguish among three distinct conditions:
A complete line was successfully read from the filehandle.
The filehandle has an EOF or an error.
The filehandle does not yet have a complete line to read.
The standard Perl <> operator and getline() functions handle conditions 1 and 2 well, but they block ...
Read now
Unlock full access