Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: The 'ol shell timeout questionby hacker (Priest) |
on Jun 18, 2003 at 02:24 UTC ( [id://266705]=note: print w/replies, xml ) | Need Help?? |
This tutorial on IPC may be useful.
Also, perlfaq8 has one entry titled:
Be careful when implementing signals. Take a look at the %SIG section of the perlvar POD for some clues and warnings. Remember that the alarm signal, like other signals, can't be trapped with eval directly, it will exit unconditionally. You have to catch the signal in %SIG and die() to make it catchable. Something like: Now you can catch it with eval. Another possibility is something like the following (untested) code snippet:
For capturing the output, you probably want (my old favorite), IPC::Open3, which gives you STDIN, STDOUT, and STDERR. Be wary of the race conditions though, read the POD and examples very carefully. Good luck!
In Section
Seekers of Perl Wisdom
|
|