You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In future, this method may be enhanced to allow the insertion of multiple
Elements, inline-parsed code strings or L<PPI::Document::Fragment> objects.
Indeed, this method (and insert_after) appear to be the ideal natural interfaces for inserting a new code snippet into an existing document. Unless I've missed something, the closest that exists today is:
my $element; # the element in the existing document to insert before
my $doc = PPI::Document->new(\$code_snippet);
$element->insert_before($_) foreach $doc->schildren;
The text was updated successfully, but these errors were encountered:
PPI::Element::insert_before is documented as:
Indeed, this method (and
insert_after
) appear to be the ideal natural interfaces for inserting a new code snippet into an existing document. Unless I've missed something, the closest that exists today is:The text was updated successfully, but these errors were encountered: