http://www.perlmonks.org?node_id=841128


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 ); }