Subject: | A given document seemingly has circular siblings |
This simple code loops forever:
use PPI::Document;
my $d = PPI::Document->new(\q[use foo; sub this { foo->load } this(); 1;]);
my $sub = $d->find(q[Statement::Sub])->[0];
print "sib is: $sub\n"
while $sub and $sub = $sub->sprevious_sibling;
So we get output like this:
sub: sub this { foo->load }
sib is: use foo;
sib is: 1;
sib is: this();
sib is: sub this { foo->load }
sib is: use foo;
sib is: 1;
sib is: this();
sib is: sub this { foo->load }
sib is: use foo;
sib is: 1;
sib is: this();
sib is: sub this { foo->load }
sib is: use foo;
sib is: 1;
sib is: this();
sib is: sub this { foo->load }
Which isn't healthy. So it looks like a circular link is created in amongst the siblings.
Dan aka broquaint