Hi,

I'm using mod_perl 2.0 with apache server 2.0.52 and perl version
5.8.0. The problem is that with mod_perl alarm() doesn't get timeout
through apache mod_perl. It works fine on the command with perl 5.8.0.
It also works with cgi.

The script is given below. Could somebody let me know what's going
wrong here. I read about safe signals and one of the suggested
solutions was to use POSIX signals. Still it doesn't work.

#!/opt/perl/bin/perl
use strict;

use POSIX qw(SIGALRM);
print "Content-type: text/html\n\n";

  eval {
      POSIX::sigaction(SIGALRM,
                       POSIX::SigAction->new(sub { die "alarm" }))
            or die "Error setting SIGALRM handler: $!\n";
      alarm 1;
        my_code();
      alarm 0;
  };
  die "the operation was aborted" if $@ and $@ =~ /alarm/;

sub my_code {
   for (1..100000) {
      print "$_\n";
   }
}

Thanks,
Shreeguru.

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to