Given that the child process is expecting to read something
on stdin, you should start it with "open()" rather than with
"system()" -- this gives the parent process the ability to
continue opertation after the child is opened/started,
print data to the child process if/when needed, and also
provides the parent with the child's process-id, if you
want that, though you could probably just "close" it -- e.g.
my $child_pid = open( CHILD, "| child_program arg1 arg2" )
|| die "unable to start child_program\n";
# Feed the child, if that's necessary
select CHILD;
$|++; # turn off output buffering
print CHILD $/; # send a blank line
# give the child about 5 seconds to produce something
my $counter = 0;
until ( -s "child_output.file" or ++$counter == 5 ) {
sleep 1;
}
# now, we could kill $child_pid, or just:
close CHILD;
Depending on what the child is actually supposed to be doing,
there may be some traps here. Definitely read "perldoc -f
open" and "perldoc perlipc". | [reply] [d/l] |