use IPC::Open3; $pid = open3($WTR, $RDR, $ERR, $cmd_with_args); $pid = open3($WTR, $RDR, $ERR, $cmd, "arg1
", "arg2
", ...);
IPC::Open3 works like IPC::Open2, with the following differences:
The first two arguments ($WTR
and $RDR
) are given in
reverse order compared to IPC::Open2.
A third filehandle can be given, for standard error. If this argument is
given as ""
, then STDERR
and STDOUT
for $cmd
will be on the same filehandle.
If $WTR
begins with
<&
, then the leading <&
is
stripped from the name and the remainder is assumed to be a regular filehandle
for an open file, rather than a reference to a typeglob.
open3()
opens this file as STDIN
for
$cmd
and closes it in the parent. Likewise, if
$RDR
or $ERR
begins with
>&
, then $cmd
directs
STDOUT
or STDERR
directly to that file
rather than to the parent.
Warnings given for IPC::Open2 regarding possible program hangs apply to IPC::Open3 as well.