FAQ
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]);

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprecdescent @
categoriesperl
postedSep 19, '04 at 2:01p
activeSep 19, '04 at 2:01p
posts1
users1
websitemetacpan.org...

1 user in discussion

Alexander Farber: 1 post

People

Translate

site design / logo © 2018 Grokbase