Pod::A...t::Tree(3pm)

πŸ“¦
version 0.26 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

✨ 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 (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