in reply to (?{...code..}) regex construct causing panic: top_env in 5.8.2

local doesn't work on my'd vars, only globals. Change my $cnt; to our $cnt; and the panic goes away and your example runs fine.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
Timing (and a little luck) are everything!

Replies are listed 'Best First'.
Re: Re: (?{...code..}) regex construct causing panic: top_env in 5.8.2
by kvale (Monsignor) on Feb 25, 2004 at 03:12 UTC
    That is a good answer, but I think perl should not panic in this case, but point out the problem.

    -Mark

      Agreed. And under normal code conditions it does.

      { my $x; { local $x = 1 } }; Can't localize lexical variable $x at (eval 2) line 1, <> line 3.

      Putting my "guess the reason" hat on, I could be that they try to keep the regex engine fast and so the error reporting from code blocks in regexes is lighter than elsewhere. Alternatively, it could be just that noone has raised the perlbug to casue it to get fixed yet.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      Timing (and a little luck) are everything!
Re: Re: (?{...code..}) regex construct causing panic: top_env in 5.8.2
by leriksen (Curate) on Feb 25, 2004 at 01:22 UTC
    ah, of course, probably would of worked that out with a little more info

    Can't localize lexical variable $cnt at ...

    +++++++++++++++++
    #!/usr/bin/perl
    use warnings;use strict;use brain;