Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Use of IPC::Run rather than system()

by Rex(Wrecks) (Curate)
on Jul 16, 2003 at 16:33 UTC ( #274915=note: print w/replies, xml ) Need Help??

in reply to Use of IPC::Run rather than system()

From the description of system in the Camel:

"To capture output from a command, use backticks or qx// instead."

Update: I seem to have misread the question, the way I read it would have been a simple split operation an any output. Being ESL, it didn't sink in that the poster wanted to split up STDERR and STDOUT. My mistake, thanks fot the spanking :)

"Nothing is sure but death and taxes" I say combine the two and its death to all taxes!

Replies are listed 'Best First'.
Re: Re: Use of IPC::Run rather than system()
by IlyaM (Parson) on Jul 16, 2003 at 16:50 UTC

      Thanks for that - note however that in addition to capturing STDOUT/STDERR, I still need to have the STDIN/STDOUT/STDERR of the external program connected to the terminal where the person is running the script, in case the external program requires input from the user, and so that any output is immediately visible to the user, in addition to being saved in the scalar(s).

      I'll try your recommendation out though - maybe it does give me what I want.

        For STDIN/-ERR, just print the output to the appropriate handles yourself. For STDIN, if you have taken control of the subprocesses STDIN yourself, just copy the user input in there yourself. You can do that "realtime" rather than post mortem by passing closures rather scalar refs, if memory serves.

        Makeshifts last the longest.

Re^2: Use of IPC::Run rather than system()
by Aristotle (Chancellor) on Jul 16, 2003 at 16:42 UTC
    I would now like to additionally capture the STDOUT and STDERR of the external program in separate scalars within the Perl script.

    Makeshifts last the longest.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://274915]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2020-05-30 19:17 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (173 votes). Check out past polls.