I read perlcritic documentation to avoid backlinks and use IPC :: Open3 here:
http://perl-critic.stacka.to/pod/Perl/Critic/Policy/InputOutput/ProhibitBacktickOperators.html
I am trying to find the smallest verbose option that will work and satisfy perlcritic:
use strict;
use warnings;
use IPC::Open3 'open3'; $SIG{CHLD} = 'IGNORE';
my $cmd = 'ls';
my ($w,$r,$e); open3($w,$r,$e,$cmd);
my @o = <$r>; my @e = <$e>;
1;
But he complains about the following error:
Use of uninitialized value in <HANDLE> at ipc_open3.pl line 7
Any ideas?
EDITED: Alright, thatβs what I have. If there is a way to simplify it, I will stick with this:
use strict;
use warnings;
use IPC::Open3 'open3'; $SIG{CHLD} = 'IGNORE';
use Symbol 'gensym';
my $cmd = 'ls';
my ($w,$r,$e) = (undef,undef,gensym); my $p = open3($w,$r,$e,$cmd);
my @o = <$r>; my @e = <$e>;
1;
source
share