Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: how to exec() with my filehandles !

by ikegami (Patriarch)
on May 21, 2010 at 20:48 UTC ( [id://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?
Username:
Password:

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

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

    No recent polls found