I am running Kubuntu 20.04. The perl version is shown by perl -v to be
perl 5, version 30, subversion 0 (v5.30.0) built for x86_64-linux-gnu-thread-multi (with 50 registered patches, see perl -V
I have just made apt-get update and with Muon package manager I have all installed perl packages upgraded.
But after that, perl is 5 as before, I have not got perl 6.
My problem is not when I use the simple system command like
perl -we 'system("echo \"aaa\" > /tmp/WEx_args_file"); '
In this case the file is written.
But when using the indirect object way, like
perl -we ' @WE_args = ( "echo", " \"qqq\" > /tmp/WEx_args_file" ); $WE_retcod_system = system { $WE_args[0] } @WE_args; print "WE_retcod_system: ~", $WE_retcod_system, "~\n"; if($WE_retcod_system != 0) { die "\nsystem >>>YYY>>>@WE_args<<<YYY<<< failed: $?"; }; '
in this case the file is not written.
The displayed output is on screen:
"qqq" > /tmp/WEx_args_file
then follows
WE_retcode_system: ~0~
I have tried the indirect object way in many variations a whole day. I have not found a code the tmp file to be written.
Please, do anybody know a solution?
=====
In trying to proceed, I have found the very good
IPC::System::Simple
By means of this, my intention is to replace my backtick code
echo -n "qqq" | xxd -g1
with the capturex function, like
perl -we ' use IPC::System::Simple qw/capturex/; open(FHo, ">/tmp/Wex_args_file") or die; $WE_got_from_cpx = capturex("echo", "-n", ""qqq"", "|", "xxd -g1" ); print FHo "WE_got_from_cpx: ~", $WE_got_from_cpx, "~\n"; '
As far as I understood, this is the correct usage of capturex. But new problem, it does not work.
The command on the RHS of the pipe, i.e.
xxd -g1
is not executed but only copied. The result is
WE_got_from_cpx: ~"qqq" | xxd -g1~
I'm afraid that these modules in IPC::System::Simple are based on the leading point like the "indirect object" way that only the first argument is the executed command.
How can I use IPC::System::Simple to make the whole backtick function go?
Regards
anton