>Tom Christiansen wrote:
>> 
>> The straightforward way to do that is quite simply:
>> 
>>     open(FH, "|foocmd thisfoo thatfoo|")
>> 
>> or for shell avoidance:
>> 
>>     open(FH, "|-|", "foocmd", "thisfoo", "thatfoo"))

>Does this work now???? 

Not quite.  Nearly, though.

>Or are you just suggesting this be added to Perl 6?

Yes.  If not way before.

>Quoth Camel-3, p. 752:

>When starting a command with open, you must choose either input or
>output: "cmd|" for reading or "|cmd" for writing. You many not use open
>to start a command that pipes both in and out, as (currently) illegal
>notation, "|cmd|", might appear to indicate.

But see the tie chapter for the implementation of:

    use Tie::Open2;

    tie *CALC, 'Tie::Open2', "bc -l";
    $sum = 2;
    for (1 .. 7) {
        print CALC "$sum * $sum\n";
        $sum = <CALC>;
        print "$_: $sum";
        chomp $sum;
    }
    close CALC;

It doesn't even need to be so fancy.  We already have two different
underlying FDs for their separte FILE*s so we can do sockets.  Perl has
very close to support for this.

The multiarg pipe open is still TBD.

--tom

Reply via email to