Skip Menu |
 

This queue is for tickets about the Parse-RecDescent CPAN distribution.

Report information
The Basics
Id: 27705
Status: resolved
Priority: 0/
Queue: Parse-RecDescent

People
Owner: Nobody in particular
Requestors: jvallon [...] bear.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.94
Fixed in: (no value)



Subject: Parse::RecDescent 1.94 bug report
Date: Fri, 22 Jun 2007 23:44:10 -0400
To: <bug-Parse-RecDescent [...] rt.cpan.org>
From: "Vallon, Justin" <jvallon [...] bear.com>
Download (untitled) / with headers
text/plain 1.7k
module - Parse::RecDescent 1.94 When calling a parser with $parser->rule(\$text), I am getting some warnings about lvalues and scalars. sub AUTOLOAD # ($parser, $text; $linenum, @args) { croak "Could not find method: $AUTOLOAD\n" unless ref $_[0]; my $class = ref($_[0]) || $_[0]; my $text = ref($_[1]) ? ${$_[1]} : $_[1]; $_[0]->{lastlinenum} = $_[2]||_linecount($_[1]); $_[0]->{lastlinenum} = _linecount($_[1]); $_[0]->{lastlinenum} += $_[2] if @_ > 2; $_[0]->{offsetlinenum} = $_[0]->{lastlinenum}; $_[0]->{fulltext} = $text; If \$text is passed, _linecount(\$text) is called, and it gives "Attempt to use reference as lvalue in substr". The call to _linecount($_[1]) should be _linecount($text). Also, the first lastlinenum setting is unnecessary. Patch: --- ./lib/Parse/RecDescent.pm.~1~ 2003-04-09 04:29:37.000000000 -0400 +++ ./lib/Parse/RecDescent.pm 2007-05-31 14:53:33.001675000 -0400 @@ -2778,8 +2778,7 @@ croak "Could not find method: $AUTOLOAD\n" unless ref $_[0]; my $class = ref($_[0]) || $_[0]; my $text = ref($_[1]) ? ${$_[1]} : $_[1]; - $_[0]->{lastlinenum} = $_[2]||_linecount($_[1]); - $_[0]->{lastlinenum} = _linecount($_[1]); + $_[0]->{lastlinenum} = _linecount($text); $_[0]->{lastlinenum} += $_[2] if @_ > 2; $_[0]->{offsetlinenum} = $_[0]->{lastlinenum}; $_[0]->{fulltext} = $text; -Justin *********************************************************************** Bear Stearns is not responsible for any recommendation, solicitation, offer or agreement or any information about any transaction, customer account or account activity contained in this communication. ***********************************************************************
Download (untitled) / with headers
text/plain 229b
You're correct. I've applied your patch: https://github.com/jtbraun/Parse-RecDescent/commit/765e3a7a04f0dd147f32484a66a4c2e5dd6fe830 Thank you for the bug report and patch! Your changes will appear in the next release. Jeremy


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.