Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Using IPC::Open3 instead of backtick operatorby karlgoethebier (Abbot) |
on Jun 11, 2016 at 12:16 UTC ( [id://1165393]=note: print w/replies, xml ) | Need Help?? |
..."...become a better Perl programmer...update the script to pass the perlcritic test..." I fear you won't become a better Perl programmer if you use perlcritic. The opposite might happen and this would be annoying. From the linked node by our beloved deputy of the leader BUK: ..."Fully 95% of Perl::Critic's (and by implication PBP) justifictions are as puerile as banning ball games from school playgrounds because participants might skin their knees. Making their own mistakes and learning from them is how kids learn. Banning every construct and idiom, that might under some obscure circumstances cause the occasional program to fail, is like trying to wrap your kids in cotton wool. Overindulgent, counter-productive and ultimately futile..." Below some code that i wrote a while ago for learning purposes and demonstration - how to capture everything from a compound external command:
Some mentioned already that IPC::Run might be the better tool. The code fails with perlcritic, despite it is IMHO well formatted, easy to read, easy to understand and therefore easy to maintain. And it does what it should do.
OK, the command is idiotic, but perlcritic doesn't complain about that it is idiotic. No Perl shari'ah, thank's. Regards, Karl «The Crux of the Biscuit is the Apostrophe»
In Section
Seekers of Perl Wisdom
|
|