Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by ikegami (Patriarch)
on Jun 10, 2016 at 15:58 UTC ( [id://1165308]=note: print w/replies, xml ) Need Help??


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

This is the equivalent of doing no warnings;. It simply silences the message without addressing the issue (preventing error log from being filled with child's STDERR output). If your goal is simply to circumvent perlcritic, it provides far better ways of doing that.

Replies are listed 'Best First'.
Re^3: Using IPC::Open3 instead of backtick operator
by RonW (Parson) on Jun 10, 2016 at 17:54 UTC

    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.

      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://1165308]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (6)
As of 2024-03-29 09:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found