in reply to IPC::Open3, wperl issue
And then:#!/usr/bin/perl -w use strict; use IPC::Open3; open(STDIN, "<", "NUL") || die "open NUL: $!"; local (*IN,*OUT,*ERR); my $pid = open3(\*IN, \*OUT, \*ERR, "wperl", q(-le), q(my $in = <STDIN +>; print $in+3; print STDERR $in+5)); print IN "5\n"; close IN; my $line = <OUT>; print "Out=$line"; $line = <ERR>; print "Err=$line";
giveswperl program > out 2>&1 type out
Setting a global STDIN in the outer wperl is no great loss since it is not typically connected to anything anyways. If you want to be able to maybe use the STDIN of the outer wperl in case it is available I suppose you can replace the initial open by something likeOut=8 Err=10
{ open(my $dummy, "<&STDIN") || open(STDIN, "<", "NUL") || die "open + NUL: $!"; }
|
---|