Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: Modules which improve system() ?

by xdg (Monsignor)
on Jun 23, 2006 at 10:27 UTC ( #557135=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Modules which improve system() ?
in thread Modules which improve system() ?

As I just mentioned in this post, how about IPC::Run3?

From its Pod:

compared to system(), qx'', open "...|", open "|...": + redirects more than one file descriptor + returns TRUE on success, FALSE on failure + throws an error if problems occur in the parent process (or the +pre-exec child) + allows a very perlish interface to Perl data structures and subr +outines + allows 1 word invocations to avoid the shell easily: run3 ["foo"]; # does not invoke shell - does not return the exit code, leaves it in $?

So you could use it like this:

eval { run3 $program } or die "Errors running $program";

Its docs leave a bit to be desired, but the current maintainer might be willing to take some doc patches...

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.


Comment on Re^3: Modules which improve system() ?
Select or Download Code
Re^4: Modules which improve system() ?
by adamk (Chaplain) on Jun 24, 2006 at 23:44 UTC
    I concur with my learned friend on IPC::Run3 as a direct replacement to system(), although it can't do some of the more interactive tricks of IPC::Run.

    Morover, IPC::Run3 works on every single platform flawlessly, and so it makes for a very safe dependency. Some of the others do have the odd platform issue.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-07-23 04:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (133 votes), past polls