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

Re: how to exec() with my filehandles !

by ikegami (Pope)
on May 21, 2010 at 20:48 UTC ( #841128=note: print w/replies, xml ) Need Help??

in reply to [Resolved] how to exec() with my filehandles !

If i post here, this is because i want to make a sub which execute some file (or a perl sub), and returns a 4 elements list : the child pid, the in, out and stderr filehandles the function generates

That describes IPC::Open3's open3 almost exactly. Here's a simple wrapper that provides the desired interface:

use IPC::Open3 qw( open3 ); sub create_child { my $pid = open3( local *TO_CHLD, local *FR_CHLD, local *FR_CHLD_ERR, @_ ); return ( $pid, *TO_CHLD, *FR_CHLD, *FR_CHLD_ERR ); }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2018-11-16 15:52 GMT
Find Nodes?
    Voting Booth?
    My code is most likely broken because:

    Results (199 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!