Use IO::Select on a pipe.
use IO::Select; my $s = new IO::Select(); my $pid = open PH, "arbitrary command|" or die "arbitrary command: $!" +; $s->add( \*PH ); my @ready = $s->can_read( 3000 ); if (@ready == 0) { # nothing to read, kill the child and close the pipe kill( $pid); close PH; } else { while (<PH>) { # do something with the output } }
dmm
If you GIVE a man a fish you feed him for a dayIn reply to Re: Forking Question
by dmmiller2k
in thread Forking Question
by cheshirecat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |