Forest...Builder(3pm)

πŸ“¦
version 0.10 Β· 2 versions
  • 0.10 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.10 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Forest::Tree::Builder πŸ’–

okay so bestie, welcome to Forest::Tree::Builder β€” this is the User Contributed Perl Documentation page for it, and yes the module name is literally rendered as Forest...Builder in the header because man pages are dramatic like that. it's a whole abstract role for a bottom up tree reader and honestly? it ate. πŸŽ€


✨ NAME ✨

Forest::Tree::Builder β€” an abstract role for bottom up tree reader. no cap, that's the whole job description. πŸ¦‹


🌸 SYNOPSIS 🌸

okay so here's the vibe, look at this:

package MyBuilder;
use Moose;

with qw(Forest::Tree::Builder);

# implement required builder:

sub _build_subtrees {
    return [
        $self->create_new_subtree( ... ), # probably a recursive process
    ];
}

my $builder = MyBuilder->new(
    tree_class => ...,
    ...
);

my $tree = $builder->tree;

so you use Moose, you with qw(Forest::Tree::Builder), and then you implement the required builder which is _build_subtrees. the comment in there says # probably a recursive process and honestly bestie that's the whole mood of this module. πŸ’…


🌈 DESCRIPTION 🌈

Forest::Tree::Builder replaces Forest::Tree::Loader and Forest::Tree::Reader with a bottom up construction approach. and why is that iconic? because it's also suitable for constructing Forest::Tree::Pure derived trees without excessive cloning. no wasteful copy-paste energy. 🧚

it gives you a declarative API instead of an imperative one. what does that mean fr fr? it means "tree" is lazily constructed on the first use β€” like, it shows up when it's ready, main character energy β€” instead of being constructed immediately and then "filled in" by the "load" method. glow-up behavior only. ⭐


πŸ’œ METHODS πŸ’œ

  • create_new_subtree β€” this one is implemented by Forest::Tree::Constructor. she's not your problem, she's already handled. 🫢
  • _build_tree β€” constructs a root node by using the top level "subtrees" list as the children. root node = the queen bee πŸ‘‘, subtrees = her entourage.
  • _build_subtrees β€” build the subtrees.
this is an abstract method bestie, meaning you have to write it. it should return an array ref of Forest::Tree::Pure derived objects. if you don't implement it, nothing happens, and not in the fun way. 😭

πŸ¦‹ SEE ALSO πŸ¦‹

  • Forest::Tree::Builder::SimpleTextFile β€” go read that one next, iykyk. ✨

πŸ’€ BUGS πŸ’€

all complex software has bugs lurking in it, and this module is no exception. so real. if you find a bug please either email me, or add the bug to cpan-RT. do it. do it for the plot. πŸ™ˆ


πŸŽ€ AUTHOR πŸŽ€

Yuval Kogman β€” the legend themself. πŸ’–


Copyright 2008-2014 Infinity Interactive, Inc.

<http://www.iinteractive.com>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay. periodt. 🌸


and that's the page bestie!! this was rendered by perl v5.34.0 on 2022-06-14, so if you're reading this on a different version/date, the man page just got a makeover, the facts stayed the same. mwah πŸ’…πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from