in reply to Re^6: How to timeout if a call to an external program takes too long
in thread How to timeout if a call to an external program takes too long
In both cases, the the signal takes control away from the backticks and hands it to the signal handler.
In the first example, the signal handler just prints a message and returns control to the backticks. That's why you get the message at five seconds. Since control returns to where it came from, the backticks finish (ten seconds after they started), and everything goes along as if there had been no alarm.
In the second example, the signal handler uses die rather than just return. This way, it avoids returning control to the backticks. As such, $yawn is never set (it retains the value it had before the attempted assignment), and control flows out after the eval which caught the exception the signal handler threw.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: How to timeout if a call to an external program takes too long
by BrowserUk (Patriarch) on Aug 30, 2007 at 12:38 UTC | |
by kyle (Abbot) on Aug 30, 2007 at 14:47 UTC |