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: 18413
Status: resolved
Priority: 0/
Queue: PPI

Owner: Nobody in particular
Requestors: mlockner [...]

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

Subject: PPI::Node prune() implementation broken
Download (untitled) / with headers
text/plain 961b
Please see attached test case Asking it to simply strip out the subs from the test data will fail with an undef return value. The undef is being returned from the exception catch at line line 548, but what actually fails is the call to $element->children in line 544. By the time you get there, $element->delete has already been called (line 535) and the object's children member deleted; so when $element->children attempts an array dereference on that member in line 209, it bombs due to an attempt to dereference undef. I would advise just returning the empty list from children() in the case of a missing object children member, possibly. Technically, I am using Debian package libppi-perl 0.903-2. Perl version: This is perl, v5.8.4 built for i386-linux-thread-multi OS version: Linux lockner 2.6.10 #1 Fri Dec 30 14:57:21 CST 2005 i686 GNU/Linux
text/x-perl 144b
#!/usr/bin/perl use strict; use warnings; sub one { 1 } sub two { 2 } sub three { 3 } print one; print "\n"; print three; print "\n"; exit;
text/x-perl 186b
#!/usr/bin/perl use strict; use warnings; use PPI::Document; my $doc = PPI::Document->load (''); defined $doc->prune ('PPI::Statement::Sub') or die "prune failed!!"; exit;
Added a regression test for this case, and confirmed this is resolved.

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

Please report any issues with to