1Tree::Simple::Visitor::UFsienrdBCyoUnItDr(i3b)uted PerlTDroeceu:m:eSnitmaptlieo:n:Visitor::FindByUID(3)
2
3
4

NAME

6       Tree::Simple::Visitor::FindByUID - A Visitor for finding an element in
7       a Tree::Simple hierarchy by UID
8

SYNOPSIS

10         use Tree::Simple::Visitor::FindByUID;
11
12         # create a visitor object
13         my $visitor = Tree::Simple::Visitor::FindByUID->new();
14
15         # set the search path for our tree
16         $visitor->searchForUID("MyTreeUID");
17
18         # pass the visitor to a tree
19         $tree->accept($visitor);
20
21         # fetch the result, which will
22         # be the Tree::Simple object that
23         # we have found, or undefined
24         my $result = $visitor->getResult() || die "No Tree found";
25

DESCRIPTION

27       Given a UID and Tree::Simple hierarchy, this Visitor will attempt to
28       find the node with the same UID.
29

METHODS

31       new There are no arguments to the constructor the object will be in its
32           default state. You can use the "setNodeFilter",
33           "setTraversalMethod", "includeTrunk" and "searchForUID" methods to
34           customize its behavior.
35
36       includeTrunk ($boolean)
37           Based upon the value of $boolean, this will tell the visitor to
38           include the trunk of the tree in the search as well.
39
40       setTraversalMethod ($visitor)
41           By default we will use Tree::Simple's built in depth-first (pre-
42           order) traverse method. If however, you desire the tree to be
43           search in a different ordering, this can be accomplished using a
44           different traversal method, you can supply a $visitor object
45           implementing that traversal type to this method (See
46           Tree::Simple::Visitor::BreadthFirstTraversal,
47           Tree::Simple::Visitor::PreOrderTraversal and
48           Tree::Simple::Visitor::PostOrderTraversal).
49
50       searchForUID ($UID)
51           This is the UID we will attempt to find within the tree.
52
53       setNodeFilter ($filter_function)
54           This method accepts a CODE reference as its $filter_function
55           argument and throws an exception if it is not a code reference.
56           This code reference is used to further check the tree nodes as they
57           are searched and so can be used to customize search behavior. For
58           instance, you could to check against the UID as well as some other
59           criteria. The filter function should accept a single argument,
60           which is the current Tree::Simple object and return either true (1)
61           on success, or false (0) on failure.
62
63       visit ($tree)
64           This is the method that is used by Tree::Simple's "accept" method.
65           It can also be used on its own, it requires the $tree argument to
66           be a Tree::Simple object (or derived from a Tree::Simple object),
67           and will throw and exception otherwise.
68
69       getResult
70           This method will return the tree found with the specified UID (set
71           by the "searchForUID" method) or "undef" if no tree is found.
72

Repository

74       <https://github.com/ronsavage/Tree-Simple-VisitorFactory>
75

SUPPORT

77       Bugs should be reported via the CPAN bug tracker at
78
79       <https://github.com/ronsavage/Tree-Simple-VisitorFactory/issues>
80

CODE COVERAGE

82       See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more
83       information.
84

SEE ALSO

86       These Visitor classes are all subclasses of Tree::Simple::Visitor,
87       which can be found in the Tree::Simple module, you should refer to that
88       module for more information.
89

ACKNOWLEDGEMENTS

91       Thanks to Vitor Mori for the idea for this Visitor.
92

AUTHOR

94       stevan little, <stevan@iinteractive.com>
95
97       Copyright 2004, 2005 by Infinity Interactive, Inc.
98
99       <http://www.iinteractive.com>
100
101       This library is free software; you can redistribute it and/or modify it
102       under the same terms as Perl itself.
103
104
105
106perl v5.38.0                      2023-07-21Tree::Simple::Visitor::FindByUID(3)
Impressum