Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: The problem of "the" default shell

by haukex (Archbishop)
on Dec 09, 2017 at 13:56 UTC ( [id://1205218]=note: print w/replies, xml ) Need Help??


in reply to The problem of "the" default shell

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.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1205218]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2025-07-17 03:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.