backtick_count - Compilation problem

John Gruber gruber at fedora.net
Tue May 4 14:30:29 EDT 2004


Stefan Tilkov <stefan.tilkov at innoq.com> wrote on 05/03/04 at 3:55p:

> Since I have not found any reference to this in the archives, it's 
> probably a problem specific to my environment; but when I try to run 
> Markdown.pl as included in the 1.0b4 release, I get the following error:
> 
> Global symbol "$backtick_count" requires explicit package name at (re_eval 
> 2) line 1.
> Global symbol "$backtick_count" requires explicit package name at (re_eval 
> 2) line 1.
> Compilation failed in regexp at Markdown.pl line 854.
> 
> If I add a 'my $backtick_count;' before the regexp, everything works 
> perfectly. I'm on a Mac with Panther (10.3.3), Perl version is 5.8.4 
> (built from source, installed in /usr).
> The same problem (and fix (?)) helped me get the version included with 
> ecto to run.

That's very interesting. My only guess is that Perl 5.8.4 is
stricter about variables having been declared when used within /e
regexen.

Most of my testing and development is under Perl 5.8.1 (stock OS X
Panther build, so it's really 5.8.1 RC3) and Perl 5.8.3 on my web
server. I don't have Perl 5.8.4 anywhere.

Did you replace Mac OS X's stock perl with your build of 5.8.4? If
not, can you try running Markdown.pl using that perl?

Where did you put the my declaration? Like this?

    my $text = shift;
    my $backtick_count; # <----------------------NEW

    $text =~ s@
            (`+)        # Opening run of `
            (.+?)       # the code block
            (?<!`)
            (??{ $backtick_count = length $1; "`{$backtick_count}";  })
            (?!`)
        @
            my $c = $2;
            $c =~ s/^[ \t]*//g; # leading whitespace
            $c =~ s/[ \t]*$//g; # trailing whitespace
            $c = _EncodeCode($c);
            "<code>$c</code>";
        @egsx;

    return $text;

-J.G.


More information about the Markdown-discuss mailing list