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: 13655
Status: resolved
Worked: 10 min
Priority: 0/
Queue: PPI

People
Owner: adamk [...] cpan.org
Requestors: pmichaud [...] u.washington.edu
Cc:
AdminCc:

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



Subject: insert_before, insert_after in PPI::Statement misuse isa return values.
This was from version 1.000, pulled off CPAN. Looks like the code the same in 1.001. This patch doesn't make inserting elements work, as __insert_before and __insert_after don't do any work. Smallest code that causes the problem: my $token = PPI::Token->new(''); $token->set_content('perl code'); my $end_element = $Document->find_first('Statement::End'); $end_element->insert_before($token); Error message: Can't call method "isa" without a package or object reference at /usr/local/share/perl/5.8.4/PPI/Statement.pm line 243. A patch: 242c242,243 < my $Element = isa($_[0], 'PPI::Element') or return undef; --- Show quoted text
> my $Element = $_[0]; > isa($Element, 'PPI::Element') or return undef;
254c255,256 < my $Element = isa($_[0], 'PPI::Element') or return undef; --- Show quoted text
> my $Element = $_[0]; > isa($Element, 'PPI::Element') or return undef;
This was my first bug into rt, so please let me know if you'd like any other information, and i'll try to provide it.
Date: Tue, 12 Jul 2005 18:26:48 +1000
From: Adam Kennedy <adam [...] phase-n.com>
To: bug-PPI [...] rt.cpan.org
Subject: Re: [cpan #13655] insert_before, insert_after in PPI::Statement misuse isa return values.
RT-Send-Cc:
Nope, that should be fine. Version, demonstration code and "what happened to you" should pretty much cover it in this case. Adam K Guest via RT wrote: Show quoted text
> This message about PPI was sent to you by guest <> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=13655 > > > This was from version 1.000, pulled off CPAN. Looks like the code the same in 1.001. This patch doesn't make inserting elements work, as __insert_before and __insert_after don't do any work. > > Smallest code that causes the problem: > my $token = PPI::Token->new(''); > $token->set_content('perl code'); > my $end_element = $Document->find_first('Statement::End'); > $end_element->insert_before($token); > > Error message: > Can't call method "isa" without a package or object reference at /usr/local/share/perl/5.8.4/PPI/Statement.pm line 243. > > A patch: > 242c242,243 > < my $Element = isa($_[0], 'PPI::Element') or return undef; > --- >
>> my $Element = $_[0]; >> isa($Element, 'PPI::Element') or return undef;
> > 254c255,256 > < my $Element = isa($_[0], 'PPI::Element') or return undef; > --- >
>> my $Element = $_[0]; >> isa($Element, 'PPI::Element') or return undef;
> > > > This was my first bug into rt, so please let me know if you'd like any other information, and i'll try to provide it.