Subject: | alarm doesn't work inside compiled script |
I am trying to use alarm inside a compiled script;
When I run test.pl which compiles script.pl, after 2 seconds, the op is
Alarm Clock
This is the output Perl gives for an unhandled alarm.
If I comment line CGI::Compile:77
# 'local *SIG = +{ %SIG };',
then the output is
ALARM=ALRM!!!! at ... as I would expect.
I am using
This is perl 5, version 16, subversion 0 (v5.16.0) built for x86_64-linux (perlbrew) on centos 6
and
CGI::Compile version 0.15
Thanks in advance
test script below
script.pl
my $alrm;
eval {
$SIG{ALRM} = sub { $alrm="ALRM!!!!"; die ALRM!!!" };
eval {
alarm 2;
while(1){}
alarm 0;
};
};
alarm 0;
die "ALARM=$alrm";
1;
test.pl
use CGI::Compile;
my $sub = CGI::Compile->compile('script.pl');
$sub->();