1Tree::Simple::Visitor::UPsreerOrCdoenrtTrriabvuetTrersdeaelP:(e:3rS)limDpolceu:m:eVnitsaittioorn::PreOrderTraversal(3)
2
3
4

NAME

6       Tree::Simple::Visitor::PreOrderTraversal - A Visitor for pre-order
7       traversal a Tree::Simple hierarchy
8

SYNOPSIS

10         use Tree::Simple::Visitor::PreOrderTraversal;
11
12         # create an visitor
13         my $visitor = Tree::Simple::Visitor::PreOrderTraversal->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 1.1 1.1.1 1.2 2 2.1 3 3.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       Pre-order traversal is a depth-first traversal method in which the sub-
35       tree's are processed after the parent. It is essentially a wrapper
36       around the base Tree::Simple::Visitor class, and is a separate module
37       here for completeness. (If you have a post-order, you should have a
38       pre-order too).
39

METHODS

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

BUGS

69       None that I am aware of. Of course, if you find a bug, let me know, and
70       I will be sure to fix it.
71

CODE COVERAGE

73       See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more
74       information.
75

SEE ALSO

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

AUTHOR

82       stevan little, <stevan@iinteractive.com>
83
85       Copyright 2004, 2005 by Infinity Interactive, Inc.
86
87       <http://www.iinteractive.com>
88
89       This library is free software; you can redistribute it and/or modify it
90       under the same terms as Perl itself.
91
92
93
94perl v5.30.0                      20T1r9e-e0:7:-S2i6mple::Visitor::PreOrderTraversal(3)
Impressum