Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Using IPC::Open3 instead of backtick operator

by RonW (Parson)
on Jun 10, 2016 at 17:54 UTC ( [id://1165326]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Using IPC::Open3 instead of backtick operator
in thread Using IPC::Open3 instead of backtick operator

Depending on configuration, IPC::Cmd will use either IPC::Run or IPC:Open3, so will capture STDERR as well as STDOUT.

Called with 1 buffer, IPC::Cmd will put both STDOUT and STDERR in that buffer. Called in list context, it will return seperate buffers for STDOUT and STDERR.

  • Comment on Re^3: Using IPC::Open3 instead of backtick operator

Replies are listed 'Best First'.
Re^4: Using IPC::Open3 instead of backtick operator
by ikegami (Patriarch) on Jun 10, 2016 at 18:18 UTC
    use strict; use warnings; use IPC::Cmd qw( run ); my $tool = 'tar'; my $cmd = [ 'perl', '-e', 'warn "TEST FAILED IF YOU SEE THIS\n"' ]; my $buffer = ''; my @out = run( command => $cmd, buffer => \$buffer, verbose => 1 );
    $ perl z.pl Running [perl -e warn "TEST FAILED IF YOU SEE THIS\n"]... TEST FAILED IF YOU SEE THIS

    However, one simply has to remove verbose => 1 to make this a solution.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-19 05:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found