in reply to How to redirect STDIN and STDOUT to the particular perl script

Check out IPC::Run2 or IPC::Run3 (I use the latter even when I don't care about STDERR).

If you're really tricky, you can run your cli.pl with IPC::Run#, then fork off a reader that reads the STDOUT and saves to disk leaving your initial process to write to cli.pl without ever having to worry about blocking.

  • Comment on Re: How to redirect STDIN and STDOUT to the particular perl script

Replies are listed 'Best First'.
Re^2: How to redirect STDIN and STDOUT to the particular perl script
by Anonymous Monk on Dec 28, 2005 at 17:28 UTC
    Hi..,

    As you have suggested, currently i'm using IPC::Run module to redirect the STDIN and STDOUT of the particular perl script. In this i'm getting some issues..here is some sample code..

    my $h = start \@cat, \$in_q, '>>', "out.txt", '2>>', "err.txt", debug + => 0 ; $in_q = "help\n" ; pump $h; $in_q = "lscomp\n"; pump $h; finish $h or die "cat returned $?" ;
    Issue: After "pump" the all the inputs and "finish" it only...i will get the result for all the inputs....But i need immediate result (response) for every "pump" operation .... In my case for each input, the output have more than 10 lines of response...

    So please ..can you help me for my problem.....!

    jdporter added missing markup

A reply falls below the community's threshold of quality. You may see it by logging in.