I have used IPC::Open3 for this and found it
worked well both on Unix and Windows. If
$cmd has your command then:
use IPC::Open3;
open3("<&STDIN", \*CAPTURE, \*CAPTURE, $cmd) or die "Cannot run $cmd:
+$!";
Now you are reading both STDERR and STDOUT of
the file from CAPTURE.
I don't know how to do this and get return codes
as well though, the return of open3 is a process
ID. Also note that you need to be careful with
mixing filehandles. Should you try to get output while it is giving you input, programs take a while to get bored with that sort of silliness...