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

People
Owner: Nobody in particular
Requestors: mlockner [...] iowatelecom.net
Cc:
AdminCc:

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



Subject: PPI::Node prune() implementation broken
Please see attached test case prune-simple.pl. Asking it to simply strip out the subs from the test data simple.pl 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
Subject: simple.pl
#!/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;
Subject: prune-simple.pl
#!/usr/bin/perl use strict; use warnings; use PPI::Document; my $doc = PPI::Document->load ('simple.pl'); defined $doc->prune ('PPI::Statement::Sub') or die "prune failed!!"; exit;
Added a regression test for this case, and confirmed this is resolved.