Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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


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.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://557135]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2018-05-22 00:59 GMT
Find Nodes?
    Voting Booth?