in reply to Re: Timeout alarm for regex
in thread Timeout alarm for regex

The alarm does go of for the example you gave me, however, a regex given by leronim below :
my $re = ('a*' x80).'(b|c)'; my $str = "a" x 80; $str =~ /$re/;
Never sets off the alarm. Any idea why that is the case. Thanks.

Replies are listed 'Best First'.
Re^3: Timeout alarm for regex
by Hue-Bond (Priest) on Jul 27, 2006 at 17:40 UTC

    Works fine here:

    $ perl $SIG{'ALRM'} = sub { die "alrm received"; }; alarm 2; my $re = ('a*' x80).'(b|c)'; my $str = "a" x 80; $str =~ /$re/; __END__ ... runs forever ... $ PERL_SIGNALS=unsafe perl $SIG{'ALRM'} = sub { die "alrm received"; }; alarm 2; my $re = ('a*' x80).'(b|c)'; my $str = "a" x 80; $str =~ /$re/; __END__ alrm received at - line 1.

    --
    David Serrano

      on windows does not make any change.
      C:\Perl\bin>set PERL_SIGNALS=unsafe C:\Perl\bin>perl -e"$SIG{ALRM} = sub{die}; alarm(1); $re = ('a*' x80). +'(b|c)'; $str = 'a' x 80;$str =~ /$re/;"
      does not finish.

           s;;Just-me-not-h-Ni-m-P-Ni-lm-I-ar-O-Ni;;tr?IerONim-?HAcker ?d;print