PPI::Do...Fragment(3)
π PPI::Document::Fragment(3) π
okay bestie, so this is the manual for PPI::Document::Fragment from the PPI crew β and it's literally just here to let you vibe with a piece of a Perl document instead of the whole entire thing. no cap.
β¨ NAME β¨
PPI::Document::Fragment β a fragment of a Perl Document. that's it, that's the whole name, she's simple and she knows it π
πΈ DESCRIPTION πΈ
so here's the tea, bestie: sometimes you're out here and you only wanna work with a fragment of a bigger document. like, not the whole doc, just a lil chunk of it. and PPI::Document::Fragment is the class made for exactly that.
it's functionally almost identical to a normal PPI::Document β like, same energy, same vibe β EXCEPT for two very important things:
- it is not possible to get line/column positions for the elements within it π
- it does not represent a scope
so yeah. basically a PPI::Document that doesn't know where it is and doesn't hold space for a scope. she's a fragment, not a whole meal π
π¦ METHODS π¦
π index_locations
so when you call this on a regular PPI::Document object, it does the whole location-indexing thing. but on a PPI::Document::Fragment? bestie, you should not be trying to find locations of things in there in the first place.
and because of that, any call to index_locations will:
- print a warning β οΈ
- return
undef
instead of even attempting to index the locations of the Elements. it's not being dramatic, it's just being honest about what it can't do π«Ά
π TO DO π
the actual plans, fr fr: integrate this into the rest of PPI so it has actual practical uses. because rn? it's giving untapped potential.
and the most obvious glow-up would be to implement arbitrary cut/copy/paste more easily. imagine the clipboard drama we could avoid. iconic behaviour, honestly. π₯
π§ SUPPORT π§
head over and see the support section in the main module. iykyk π
π« AUTHOR π«
Adam Kennedy <adamk@cpan.org> β legend, icon, the moment. π
β COPYRIGHT β
Copyright 2001 - 2011 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module. π
and that's the whole page, bestie!! π this was documented in perl v5.42.0, dated 2026-01-17, and it's the PPI::Do...Fragment(3) page β now go forth and fragment responsibly πβ¨
π¦ where this page comes from
- fedora 44: perl-PPI 1.284-2.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms