Tree::...eValue(3pm)
π Tree::Simple::Visitor::FindByNodeValue β the manual page, bestie edition π
okay so this is the User Contributed Perl Documentation for Tree::Simple::Visitor::FindByNodeValue (that's the manual name, and yes it's a whole mouthful, we love her anyway π«Ά).
β¨ NAME β¨
Tree::Simple::Visitor::FindByNodeValue β a Visitor for finding an element in a Tree::Simple hierarchy by node value πΈ
π SYNOPSIS π
use Tree::Simple::Visitor::FindByNodeValue;
# create a visitor object
my $visitor = Tree::Simple::Visitor::FindByNodeValue->new();
# set the search path for our tree
$visitor->searchForNodeValue("My Tree Node");
# pass the visitor to a tree
$tree->accept($visitor);
# fetch the result, which will
# be the Tree::Simple object that
# we have found, or undefined
my $result = $visitor->getResult() || die "No Tree found";
no cap, that's the whole vibe. create, search, accept, grab the result. slay π
π¦ DESCRIPTION π¦
You hand her a node value and a Tree::Simple hierarchy, and this Visitor will be like "bestie I got you" and attempt to find the node with the same node value. that's it, that's the whole job. iconic β¨
π METHODS π
newβ okay so there are no arguments to the constructor, and the object will be in its default state. you can use thesetNodeFilter,setTraversalMethod,includeTrunkandsearchForNodeValuemethods to customize its behavior. main character energy from the jump πincludeTrunk ($boolean)β based upon the value of$boolean, this will tell the visitor to include the trunk of the tree in the search as well. not me letting the trunk into the group chat πsetTraversalMethod ($visitor)β by default we will use theTree::Simplebuilt in depth-first (pre-order) traverse method. if however, you desire the tree to be search in a different ordering, this can be accomplished using a different traversal method, you can supply a$visitorobject implementing that traversal type to this method. seeTree::Simple::Visitor::BreadthFirstTraversal,Tree::Simple::Visitor::PreOrderTraversalandTree::Simple::Visitor::PostOrderTraversal. pick your fighter βsearchForNodeValue ($node_value)β this is the node value we will attempt to find within the tree. literally the whole point of the mission π―setNodeFilter ($filter_function)β this method accepts a CODE reference as its$filter_functionargument and throws an exception if it is not a code reference. this code reference is used to further check the tree nodes as they are searched and so can be used to customize search behavior. for instance, you could to check against the node value as well as some other criteria. the filter function should accept a single argument, which is the currentTree::Simpleobject and return either true (1) on success, or false (0) on failure. so like, a vibe check for nodes πvisit ($tree)β this is the method that is used by theTree::Simpleacceptmethod. it can also be used on its own, it requires the$treeargument to be aTree::Simpleobject (or derived from aTree::Simpleobject), and will throw and exception otherwise. so like, don't try it with anything else, fr fr πgetResultβ this method will return the tree found with the specified node value (set by thesearchForNodeValuemethod) orundefif no tree is found. sometimes you get the tree, sometimes you getundefand a lesson π
π¦ Repository π¦
<https://github.com/ronsavage/Tree-Simple-VisitorFactory>
π«Ά SUPPORT π«Ά
Bugs should be reported via the CPAN bug tracker at
<https://github.com/ronsavage/Tree-Simple-VisitorFactory/issues>
bestie if you find a bug, report it, don't just suffer in silence π
π₯ CODE COVERAGE π₯
See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more information.
π SEE ALSO π
These Visitor classes are all subclasses of Tree::Simple::Visitor, which can be found in the Tree::Simple module, you should refer to that module for more information.
π AUTHOR π
stevan little, <stevan@iinteractive.com>
π COPYRIGHT AND LICENSE π
Copyright 2004, 2005 by Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, bestie π¦ this was User Contributed Perl Documentation for Tree::Simple::Visitor::FindByNodeValue, from perl v5.36.0, dated 2022-11-19. go find your nodes, you absolute icon πβ¨π
π¦ where this page comes from
- debian bookworm: libtree-simple-visitorfactory-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtree-simple-visitorfactory-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtree-simple-visitorfactory-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtree-simple-visitorfactory-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtree-simple-visitorfactory-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms