home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


7.2.40 IPC::Open3 - Open a Process for Reading, Writing, and Error Handling

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.


Previous: 7.2.39 IPC::Open2 - Open a Process for Both Reading and Writing Programming Perl Next: 7.2.41 lib - Manipulate @INC at Compile-Time
7.2.39 IPC::Open2 - Open a Process for Both Reading and Writing Book Index 7.2.41 lib - Manipulate @INC at Compile-Time