On Oct 6 2003, Steve Hay wrote:

Randy Kobes wrote:
test1.pl passes a scalar to run3
test2.pl redirects STDOUT to a scalar and has run3 inherit it

Does


open STDOUT, '>', \$logout;

create a real filehandle at the OS level, or does it use I/O layers
to redirect the perl script's output to a scalar?  If it's not a real
filehandle, system(), and thus IPC::Run3::run3(), can't pass it down
to the child.

test3.pl redirects STDOUT to a scalar and passes that scalar to run3

This works on linux, will test on Win32, rewriting the crucial line to:

run3 [ $^X, "-leprint'hi'"], undef, \$logout, undef;

In short, we should be safe using IPC::Run3 as it was intended to be used. The fact that test2 & test3 didn't work is maybe a bug in IPC::Run3, but, as Barrie has pointed out in another mail, there's not much point in using IPC::Run3 at all if you're mucking about with redirections yourself - IPC::Run3 was meant to save you all that bother.

If test2.pl worked, then IPC::Run3 could be simplified greatly!


test3.pl should work on Win32--as it seems to on Linux modulo my tweaks--as IPC::Run3 should be saving and reopening STDOUT yet again to redirect it to the scalar.

This is the first time I've actually used

open FOO, '>', \$bar;

since it was introduced; that sort of gimmickry was one of the
main reasons IPC::Run was suggested and written :).

- Barrie

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to