in reply to Programmatically Updating Code with PPI
I don't have PPI installed, so can't test; but I hope you don't mind a few quick questions:
- Wouldn't
be better asmy $lexicon = $doc->find(sub { $_[1]->content eq '%Lexicon' }); $lexicon = $lexicon->[0]; # returns an array ref, but in my case, ther +e's only ever one.
?my $lexicon = $doc->find_first( ... ) - Does the insert_after call return true?
- When $lexicon is returned by find, is it still “part of” $doc? That is, could it be that you're modifying only $lexicon, not $doc?
In Section
Seekers of Perl Wisdom