Subject: | PPI infinite loops |
Given this one-liner an infinite loop is produced:
perl -MPPI::Document -le 'my $d = PPI::Document->new(\q[package foo; { sub bar { } }]); my $s = $d->find(q[Statement::Sub])->[0]; $s = $s->sprevious_sibling || $s->parent while $s and ref($s) !~ /Statement::Package/; print "package is: ", $s->namespace'
The trouble is in the ' || $s->parent' which seems to be the cause of the problem. I'm pretty sure it's something to do with the parent() method as I've had similiar problems before.
Dan aka broquaint