[comp.lang.perl] double ended pipes

lars@yukon.berkeley.edu (Lars E. Thon) (06/13/91)

One feature that I have been missing from perl is having a double-ended
pipe. This could be useful f.ex. if you want to feed a lot of commands
to a csh (or some other program) and then analyze output and/or status
from the commands. Just as an example, consider the following:

#! /usr/local/gnu/bin/perl

doublepipe_open(CSH_IN, "| /bin/csh -f |", CSH_OUT); 

print CSH_IN "echo ~blah";
$pathname= <CSH_OUT>;
print CSH_IN "echo \$status";
$errcode= <CSH_OUT>;

if ($errcode) {
     print "User blah does not exist ...\n";
}
# END

I haven't seen a way to do this in perl, except for the obvious (but
unsatisfactory) method of using a temp file to store the csh output.

Any ideas about this?
(Sorry if this is a repost. I don't think it got out on first attempt.)
--
----
Lars E. Thon <lars@yukon.berkeley.edu> T. 415-642-9350
211-134 Cory Hall, UC Berkeley, CA 94720