Pod::A...t::Tree(3pm)
β¨ Pod::Abstract::Tree β¨
okay bestie, gather round, because today we're reading the manpage for Pod::A...t::Tree(3pm) and honestly? it's giving backstage pass. this is the 3pm section of the Perl docs, and this module is like the little velvet rope that keeps all your Pod nodes in line π
πΈ NAME πΈ
Pod::Abstract::Tree β manage a level of Pod document tree Nodes. yes babes, we're managing a level of the tree. it's a level. it's the level. periodt.
π¦ DESCRIPTION π¦
so Pod::Abstract::Tree is the friend who keeps track of a whole set of Pod::Abstract::Node elements, and lets you mess with that list of elements. think of it as the group chat admin π
and here's the tea: elements are stored in an ordered set. a single node can only appear once in a single document tree β so if you insert a node at some point, that also removes it from its previous location. one node, one spot, no double-dipping, no cap π«
β οΈ real talk though: this is an internal class to Pod::Abstract::Node, and it should not generally be used externally. it's for the module's eyes only, iykyk π
π METHODS π
π detach
$tree->detach($node);
unparent the $node from $tree. all the other elements will be shifted over to fill the empty spot β like when someone leaves the group pic and everyone scoots in closer π«Ά
π push
add an element to the end of the node list. classic. the back of the line, bestie πΆβοΈ
π pop
remove an element from the end of the node list. bye queen π
π insert_before
$tree->insert_before($target,$node);
insert $node before $target. both of them must be children of $tree, no randoms allowed π«
π insert_after
$tree->insert_after($target,$node);
insert $node after $target. and again β both must be children of $tree. same rules, same energy β¨
π unshift
remove the first node from the node list and return it.
π warning bestie: unshift takes linear time β it has to relocate every other element in id_map so that they stay in line. it's the "everyone shuffle down one seat" of data structures. iconic but expensive.
π children
returns the in-order node list. the whole lineup, in order, slay π
π index_relative
my $node = $tree->index_relative($target, $offset);
this method returns a node at an offset of $offset (which can totally be negative, we don't discriminate) from this tree structure. and if there's no such node? you get undef. it's giving nothing. for example, an offset of 1 will give you the following element of $node. math but make it cute π§
π AUTHOR π
Ben Lilburne <bnej80@gmail.com>
π COPYRIGHT AND LICENSE π
Copyright (C) 2009-2025 Ben Lilburne
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole thing, bestie! this was Pod::Abstract::Tree(3pm) from the Perl v5.40.1 docs, dated 2025-11-16, brought to you by the User Contributed Perl Documentation section. go forth and manage your nodes responsibly π
β¨π¦
π¦ where this page comes from
- ubuntu resolute: libpod-abstract-perl 0.26-1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- ubuntu stonking: libpod-abstract-perl 0.26-1 Β· 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