On May 11, 9:29 pm, [email protected] ("C.DeRykus") wrote: > On May 11, 12:56 am, [email protected] (Weizhong Dai) wrote: > >> ... > > $pid = open(my $readme, "program arguments |") > or die "Couldn't fork: $!\n"; > my $timeout = 5; > eval { > local $SIG{ALRM} = sub { die "timeout"; }; > alarm( $timeout ); > print while <$readme>; > alarm(0); > 1;} or die "eval error: $@ ";
Warning: This works on Unix but alarm() won't interrupt a blocking system call on Win32. The Win32::Job module is recommended in that case. -- Charles DeRykus -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
