DCPM: Timeouts in modules

Simon Waters Simon at wretched.demon.co.uk
Sun Nov 30 14:03:16 CST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Neil,

I tried this simplified version of your script, which works fine.

How are you handling the alarm outside the block?

#!/usr/bin/perl
eval{
  local $SIG{ALRM} = sub{ die "my own alarm" };
  alarm 5;
  my $input=<>;
  alarm 0;
};

if ( $@ =~ /my own alarm/) {

   print "Too slow\n";

}

I'm still mastering Perl, but assume the called code could also use or 
redefine the alarm signal handler?
-----BEGIN PGP SIGNATURE-----
Comment: Encryption...is a powerful defensive weapon for free people.

iD8DBQE/yk0EGFXfHI9FVgYRAlTmAKDViwdmNbXfIrtYCi1/Sz5UD74iiACfZBPs
FsycMSRXyjK8pj6NkMNFcEo=
=xc1p
-----END PGP SIGNATURE-----




More information about the Devoncornwall-pm mailing list