#!/usr/bin/perl
use warnings;
use strict;
use IPC::Open3;
print "Content-type: text/html\n\n";
print '
IPC::Open3 Example
';
my $cmd = '/bin/ls -la';
my $pid = open3(\*WRITER, \*READER, \*ERROR, $cmd);
while( my $output = ) {
print "output-> $output\n";
}
while(my $errout = ) {
print "err-> $errout\n";
}
waitpid($pid, 0 ) or die "$!\n";
my $retval = $?;
print "retval-> $retval\n";
print "
";