Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 74527
Status: open
Priority: 0/
Queue: PPI

People
Owner: Nobody in particular
Requestors: robert.e.debowski [...] gmail.com
Cc:
AdminCc:

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



Subject: v-numbers bug
Date: Mon, 30 Jan 2012 13:14:09 +0100
To: bug-PPI [...] rt.cpan.org
From: "Robert E. Debowski" <robert.e.debowski [...] gmail.com>
Download (untitled) / with headers
text/plain 1.1k
Hi, i think i found a tiny little bug in PPI: i have a package Foo; sub foo0 { 1; } sub foo1 { 1; } sub foo2 { 1; } sub foo3 { 1; } 1; and i want to use PPI to get all the subs: #!/usr/bin/env perl use PPI; my $filename = shift; my $Document = PPI::Document->new($filename); my $subs = $Document->find('PPI::Statement::Sub'); warn $#$subs; as result i got '3' which is correct. but when one of my subs in Foo.pm is called 'sub vN...', where N is a number, f.e.: sub v1foo {} or sub v3bar {} or simply sub v2 {} PPI::Document find seems to break parsing and returns only the already found subs. So if i modify Foo: package Foo; sub foo0 { 1; } sub foo1 { 1; } sub v2xx { 1; } sub foo3 { 1; } 1; Result of my test would be "1" (found subs are foo0 and foo1) Folks @ stackoverflow suggest this might be a bug, and i should let you know, so here it is. http://stackoverflow.com/questions/9063067/ppidocument-bug-or-some-special-subroutine-name/9063360#9063360 $ perl -v This is perl, v5.8.8 built for x86_64-linux-thread-multi $ uname -a Linux kibo 2.6.18-274.12.1.el5 #1 SMP Tue Nov 29 13:37:46 EST 2011 x86_64 x86_64 x86_64 GNU/Linux -- Robert Edward Dębowski
i believe the following patch should fix the issue. -- -jae
Subject: patch.txt
Download patch.txt
text/plain 229b
127,132d126 < my $tokens = $t->_previous_significant_tokens(1); < if ( $tokens and ($tokens->[0]->isa('PPI::Token::Word') and $tokens->[0]->content eq 'sub')) < { < return PPI::Token::Word->__TOKENIZER__commit($t); < } <
Download (untitled) / with headers
text/plain 167b
On Wed Feb 15 15:39:00 2012, JAE wrote: Show quoted text
> i believe the following patch should fix the issue.
there needs to be a content() eq 'package' check in there too. -- -jae
This issue is now being tracked on GitHub as https://github.com/adamkennedy/PPI/issues/65


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.