Justin Mason wrote:
[...]
sub trap_sigalrm {
  my ($handler) = @_;

if ($^V lt v5.8.0) {

I'd rather use something that will always work:

     $] < 5.008

I'm not sure v-objects work everywhere (I could be wrong).

    print "using SIG\n";
    $SIG{ALRM} = $handler;
  } else {
    print "using sigaction\n";
    use POSIX qw();

that should be:

      require POSIX;

use() is always executed, ragardless where you put it. perldoc -f use.

POSIX::sigaction POSIX::SIGALRM(), new POSIX::SigAction $handler;

Also I have to note that under Apache2 (if you plan to run this code under modperl2) most signals are not available, due to thread-safety and other issues. So only the POSIX alarm code works (i.e. requires 5.8.x+) and only with prefork mpm.
http://perl.apache.org/docs/2.0/user/coding/coding.html#Using_Signal_Handlers


--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to