SPUG: bidirectional process communication

Chuck Connolly cconnoll at u.washington.edu
Tue Nov 25 12:48:00 CST 2003

     I need to run a program from a perl program, passing it arguments and
catching its STDOUT. The called program reads one of its parameters from
STDIN. I know you can't open a bi-directional pipe. Programming Perl
suggests using IPC::Open2, but then goes on to say that  "in general UNIX
buffering is really going to ruin your day. ... this seldom works unless
you wrote the program on the other end of the double-ended pipe".
Programming Perl also sugests using Comm.pl, but calls this a partial
     So I was wondering how other people deal with this problem. A likely
solution is to write the called program's STDOUT to disk as a temporary
file, open that, process it, and delete it, but this seems (relatively)
slow and won't scale well. I only have a few thousand calls, so it seems
likely to work, but I was hoping for something a little more elegant.
All suggestions welcome. Thanks.

Chuck Connolly

More information about the spug-list mailing list