in reply to Getting output from continuous program
You can open the subprocess as a filehandle and then read from that filehandle. See open for the simplest case and IPC::Open2IPC::Run2 and IPC::Open3IPC::Run3 for the more complex cases.
my $cmd = '/engine/monitor'; my $pid = open my $fh, '-|', $cmd or die "Couldn't launch [$cmd]: $!/$?"; for( 1..10) { print scalar <$fh>; }; close $fh; # kills the child when it next tries to write kill $pid;
|
|---|