1Tree::Simple::Visitor::UBsreeradCtohnFtirTrirsbetueTt:re:adSviePmrepsrlalel:(D:3oV)ciusmietnotra:t:iBorneadthFirstTraversal(3)
2
3
4

NAME

6       Tree::Simple::Visitor::BreadthFirstTraversal - A Visitor for
7       breadth-first traversal a Tree::Simple hierarchy
8

SYNOPSIS

10         use Tree::Simple::Visitor::BreadthFirstTraversal;
11
12         # create an visitor
13         my $visitor = Tree::Simple::Visitor::BreadthFirstTraversal->new();
14
15         # pass our visitor to the tree
16         $tree->accept($visitor);
17
18         # print our results
19         print join ", " => $visitor->getResults();
20
21         # this will print this:
22         #   1, 2, 3, 1.1, 1.2, 2.1, 3.1, 1.1.1
23         # assuming your tree is like this:
24         #   1
25         #     1.1
26         #       1.1.1
27         #     1.2
28         #   2
29         #     2.1
30         #   3
31         #     3.1
32

DESCRIPTION

34       This implements a breadth-first traversal of a Tree::Simple hierarchy.
35       This can be an alternative to the built in depth-first traversal of the
36       Tree::Simple "traverse" method.
37

METHODS

39       new There are no arguments to the constructor the object will be in its
40           default state. You can use the  "setNodeFilter" method to customize
41           its behavior.
42
43       includeTrunk ($boolean)
44           Based upon the value of $boolean, this will tell the visitor to
45           include the trunk of the tree in the traversal as well.
46
47       setNodeFilter ($filter_function)
48           This method accepts a CODE reference as its $filter_function
49           argument and throws an exception if it is not a code reference.
50           This code reference is used to filter the tree nodes as they are
51           collected. This can be used to customize output, or to gather
52           specific information from a more complex tree node. The filter
53           function should accept a single argument, which is the current
54           Tree::Simple object.
55
56       visit ($tree)
57           This is the method that is used by the Tree::Simple "accept"
58           method. It can also be used on its own, it requires the $tree
59           argument to be a Tree::Simple object (or derived from a
60           Tree::Simple object), and will throw and exception otherwise.
61
62       getResults
63           This method returns the accumulated results of the application of
64           the node filter to the tree.
65

Repository

67       <https://github.com/ronsavage/Tree-Simple-VisitorFactory>
68

SUPPORT

70       Bugs should be reported via the CPAN bug tracker at
71
72       <https://github.com/ronsavage/Tree-Simple-VisitorFactory/issues>
73

CODE COVERAGE

75       See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more
76       information.
77

SEE ALSO

79       These Visitor classes are all subclasses of Tree::Simple::Visitor,
80       which can be found in the Tree::Simple module, you should refer to that
81       module for more information.
82

AUTHOR

84       stevan little, <stevan@iinteractive.com>
85
87       Copyright 2004, 2005 by Infinity Interactive, Inc.
88
89       <http://www.iinteractive.com>
90
91       This library is free software; you can redistribute it and/or modify it
92       under the same terms as Perl itself.
93
94
95
96perl v5.32.1                   Tre2e0:2:1S-i0m2p-l0e2::Visitor::BreadthFirstTraversal(3)
Impressum