1Tree::Simple::Visitor::UPsoesrtOCrodnetrrTirbauTvtreeerdes:aP:leS(ri3lm)pDloec:u:mVeinstiattoiro:n:PostOrderTraversal(3)
2
3
4
6 Tree::Simple::Visitor::PostOrderTraversal - A Visitor for post-order
7 traversal a Tree::Simple hierarchy
8
10 use Tree::Simple::Visitor::PostOrderTraversal;
11
12 # create an visitor
13 my $visitor = Tree::Simple::Visitor::PostOrderTraversal->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.2 1 2.1 2 3.1 3
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
34 Post-order traversal is a variation of the depth-first traversal in
35 which the sub-tree's are processed before the parent. It is another
36 alternative to Tree::Simple's "traverse" method which implements a
37 depth-first, pre-order traversal.
38
40 new There are no arguments to the constructor the object will be in its
41 default state. You can use the "setNodeFilter" method to customize
42 its behavior.
43
44 includeTrunk ($boolean)
45 Based upon the value of $boolean, this will tell the visitor to
46 include the trunk of the tree in the traversal as well.
47
48 setNodeFilter ($filter_function)
49 This method accepts a CODE reference as its $filter_function
50 argument and throws an exception if it is not a code reference.
51 This code reference is used to filter the tree nodes as they are
52 collected. This can be used to customize output, or to gather
53 specific information from a more complex tree node. The filter
54 function should accept a single argument, which is the current
55 Tree::Simple object.
56
57 visit ($tree)
58 This is the method that is used by Tree::Simple's "accept" method.
59 It can also be used on its own, it requires the $tree argument to
60 be a Tree::Simple object (or derived from a Tree::Simple object),
61 and will throw and exception otherwise.
62
63 getResults
64 This method returns the accumulated results of the application of
65 the node filter to the tree.
66
68 None that I am aware of. Of course, if you find a bug, let me know, and
69 I will be sure to fix it.
70
72 See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more
73 information.
74
76 These Visitor classes are all subclasses of Tree::Simple::Visitor,
77 which can be found in the Tree::Simple module, you should refer to that
78 module for more information.
79
81 stevan little, <stevan@iinteractive.com>
82
84 Copyright 2004, 2005 by Infinity Interactive, Inc.
85
86 <http://www.iinteractive.com>
87
88 This library is free software; you can redistribute it and/or modify it
89 under the same terms as Perl itself.
90
91
92
93perl v5.30.0 2T0r1e9e-:0:7S-i2m6ple::Visitor::PostOrderTraversal(3)