home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


3.2.107 pipe

pipe 

READHANDLE

, 

WRITEHANDLE

Like the corresponding system call, this function opens a pair of connected pipes - see pipe (2). This call is almost always used right before a fork , after which the pipe's reader should close WRITEHANDLE , and the writer close READHANDLE . (Otherwise the pipe won't indicate EOF to the reader when the writer closes it.) Note that if you set up a loop of piped processes, deadlock can occur unless you are very careful. In addition, note that Perl's pipes use standard I/O buffering, so you may need to set $| on your WRITEHANDLE to flush after each output command, depending on the application - see select ( output filehandle ).

See also the section on "Pipes" in Chapter 6 .