in reply to Timeout alarm for regex
Take into account that signals behaviour changed in Perl 5.7.3. From then on, signals are deferred and aren't delivered to the program until perl decides it's safe to do so. If you want to get signals immediatly, you'll have to set the environment variable PERL_SIGNALS to the value "unsafe". You can read more about this in perlipc, "Deferred Signals (Safe Signals)".
Update: There's a slow regex in perlre. Try this code with and without the environment variable PERL_SIGNALS:
$SIG{'ALRM'} = sub { die "alrm received"; }; alarm 2; 'aaaaaaaaaaaa' =~ /((a{0,5}){0,5}){0,5}[c]/;
--
David Serrano
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Timeout alarm for regex
by Otogi (Beadle) on Jul 27, 2006 at 17:27 UTC | |
by Hue-Bond (Priest) on Jul 27, 2006 at 17:40 UTC | |
by Ieronim (Friar) on Jul 27, 2006 at 17:56 UTC |