Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Use IPC::System::Simple for non-shell invoking system/exec/qx

by pjf (Curate)
on Jun 23, 2008 at 02:42 UTC ( [id://693429]=note: print w/replies, xml ) Need Help??


in reply to Non-shell-invoking system/exec and qx//

I believe that IPC::System::Simple is exactly what you're after. It provides a function called capture() that works just like backticks in how you'd call it, but never invokes the shell when called with multiple arguments.

It has the advantages of running on both Unix and Windows, provides an easy way to get access to the exit value without manually unpacking $?, throws nice error strings on failure, is pure perl, and has no dependencies.

Under Windows it has the added advantage of providing access to the full 32-bit return value, and avoids the bugs in Perl's core which can result in the shell being invoked anyway or potentially running the command twice.

Note: I have some personal bias, as I'm the author of the module. ;)

All the best,

  • Comment on Use IPC::System::Simple for non-shell invoking system/exec/qx

Replies are listed 'Best First'.
Re: Use IPC::System::Simple for non-shell invoking system/exec/qx
by ikegami (Patriarch) on Jul 17, 2008 at 19:30 UTC
    The author added capturex which is guaranteed not to call the shell, even if no arguments are provided.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-24 06:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found