Hi,

in the Parse/RecDescent.pm, what is the offsetlinenum used for?

I'm trying to understand, what does this in the P::RD::LineCounter mean:

sub STORE
{
        my $parser = $_[0]->{parser};
        $parser->{offsetlinenum} -= $parser->{lastlinenum} - $_[1];
        return undef;
}

When a $thisline = 10 is called, why doesn't the STORE do 
something simple, like $parser->{MyCurrentLine} = $_[1] ?

Is offsetlinenum somehow used to cache the current line number,
so that _linecount($text) is not called too often?

Regards
Alex

PS: In the AUTOLOAD() isn't the first line below redundant?

       $_[0]->{lastlinenum} = $_[2]||_linecount($_[1]);
       $_[0]->{lastlinenum} = _linecount($_[1]);

Reply via email to