[Gllug] Timeouts in perl

Robert McKay robert at mckay.com
Wed Nov 1 05:31:02 UTC 2006


Your example works for me with the exception that $timeoutsecs isn't
defined anywhere. I assume this should have been $timeout.

Rob.

On 10/31/06, - Tethys <tethys at gmail.com> wrote:
[snip]
> sub sigalrm_handler
> {
>     our $timed_out = 1;
>     die "timeout";
> }
>
> sub timeout
> {
>     my ($timeout, $func, $arg) = @_;
>
>     our $timed_out = 0;
>     eval
>     {
>         local $SIG{ALRM} = \&sigalrm_handler;
>         alarm $timeoutsecs;
           ^^^^^^^^^^^^^^^^^^^^^^^^^
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list