No such thing as a small change | |
PerlMonks |
Re: The problem of "the" default shellby haukex (Archbishop) |
on Dec 09, 2017 at 13:56 UTC ( [id://1205218]=note: print w/replies, xml ) | Need Help?? |
Excellent post, thank you very much for this! Bookmarked :-) Did you notice that qx() and its shorter alias `` don't support a list form? IPC::System::Simple provides the function capturex as a replacement for qx that always avoids the shell*. IPC::Run3 is another good module that will avoid the shell* if you give it an arrayref. The more advanced IPC::Run, although its documentation does not mention this, will also use the exec {...} ... form, although I haven't yet fully traced back in how many cases this is used - it's not always. I wrote a post in a similar vein to yours showing example code with these modules here. * Does not apply on Windows, but I have heard good things about Win32::ShellQuote, which recent versions of IPC::Run3 use internally. On *NIX systems and others with execvp(3), the above should always completely avoid the shell. Update 2: Cleaned up formatting and wording. (Side note: I don't normally both front-page and reply to a node, but I feel this is an important topic.)
In Section
Meditations
|
|