1Tree::Simple::VisitorFaUcsteorryC(o3n)tributed Perl DocuTmreenet:a:tSiiomnple::VisitorFactory(3)
2
3
4

NAME

6       Tree::Simple::VisitorFactory - A factory object for dispensing Visitor
7       objects
8

SYNOPSIS

10         use Tree::Simple::VisitorFactory;
11
12         my $tf = Tree::Simple::VisitorFactory->new();
13
14         my $visitor = $tf->get("PathToRoot");
15
16         # or call it as a class method
17         my $visitor = Tree::Simple::VisitorFactory->getVisitor("PathToRoot");
18

DESCRIPTION

20       This object is really just a factory for dispensing
21       Tree::Simple::Visitor::* objects. It is not required to use this
22       package in order to use all the Visitors, it is just a somewhat
23       convenient way to avoid having to type their long class names.
24
25       I considered making this a Singleton, but I did not because I thought
26       that some people might not want that. I know that I am very picky about
27       using Singletons, especially in multiprocess environments like
28       mod_perl, so I implemented the smallest instance I knew how to, and
29       made sure all other methods could be called as class methods too.
30

METHODS

32       new Returns an minimal instance of this object, basically just a
33           reference back to the package (literally, see the source if you
34           care).
35
36       get ($visitor_type)
37           Attempts to load the $visitor_type and returns an instance of it if
38           successful. If no $visitor_type is specified an exception is
39           thrown, if $visitor_type fails to load, and exception is thrown.
40
41       getVisitor ($visitor_type)
42           This is an alias of "get".
43

AVAILABLE VISITORS

45       This distribution provides a number of Visitor objects which can be
46       loaded just by giving their name. Below is a description of the
47       available Visitors and a sort description of what they do. I have
48       attempted to classify the Visitors into groups which are related to
49       their use.
50
51       This factory will load any module contained inside the
52       Tree::Simple::Visitor::* namespace. Given a name, it will attempt to
53       "require" the module Tree::Simple::Visitor::<Name>.pm. This allows
54       others to create Visitors which can be accessed with this factory,
55       without needed to include them in this distribution.
56
57   Search/Path Related Visitors
58       PathToRoot
59           Given a Tree::Simple object, this Visitor will find the path back
60           to the tree's root node.
61
62       FindByPath
63           Given a path and Tree::Simple hierarchy, this Visitor will attempt
64           to find the node specified by the path.
65
66       FindByUID
67           Given a UID and Tree::Simple hierarchy, this Visitor will attempt
68           to find the node with the same UID.
69
70       FindByNodeValue
71           Given a node value and Tree::Simple hierarchy, this Visitor will
72           attempt to find the node with the same node value.
73
74   Traversal Visitors
75       BreadthFirstTraversal
76           This implements a breadth-first traversal of a Tree::Simple
77           hierarchy.
78
79       PostOrderTraversal
80           Post-order traversal is a variation of the depth-first traversal in
81           which the sub-tree's are processed before the parent.
82
83       PreOrderTraversal
84           Pre-order traversal is a depth-first traversal method in which the
85           sub-tree's are processed after the parent.
86
87   FileSystem Visitors
88       LoadDirectoryTree
89           This visitor can be used to load a directory tree into a
90           Tree::Simple hierarchy.
91
92       CreateDirectoryTree
93           This visitor can be used to create a set of directories and files
94           from a Tree::Simple object hierarchy.
95
96   Conversion Visitors
97       FromNestedArray
98           Given a tree constructed from nested arrays, this Visitor will
99           create the equivalent Tree::Simple hierarchy.
100
101       ToNestedArray
102           Given a Tree::Simple hierarchy, this Visitor will create the
103           equivalent tree constructed from nested arrays.
104
105       FromNestedHash
106           Given a tree constructed from nested hashs, this Visitor will
107           create the equivalent Tree::Simple hierarchy.
108
109       ToNestedHash
110           Given a Tree::Simple hierarchy, this Visitor will create the
111           equivalent tree constructed from nested hashes.
112
113   Reflective Visitors
114       LoadClassHierarchy
115           Given a class name or instance, this Visitor will create a
116           Tree::Simple hierarchy which models the classes inheritance
117           hierarchy.
118
119   Misc. Visitors
120       GetAllDescendents
121           Given a Tree::Simple instance this Visitor will return all the
122           descendents recursively on down the hierarchy.
123
124       Sort
125           This implements a multi-level sort of a Tree::Simple hierarchy.
126
127       VariableDepthClone
128           A Visitor for cloning parts of Tree::Simple hierarchy
129

BUGS

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

CODE COVERAGE

135       I use Devel::Cover to test the code coverage of my tests, below is the
136       Devel::Cover report on this module test suite.
137
138        -------------------------------------------- ------ ------ ------ ------ ------ ------ ------
139        File                                           stmt branch   cond    sub    pod   time  total
140        -------------------------------------------- ------ ------ ------ ------ ------ ------ ------
141        Tree/Simple/VisitorFactory.pm                 100.0  100.0    n/a  100.0  100.0    0.4  100.0
142        Tree/Simple/Visitor/BreadthFirstTraversal.pm  100.0  100.0   66.7  100.0  100.0    2.5   96.3
143        Tree/Simple/Visitor/PostOrderTraversal.pm     100.0  100.0   77.8  100.0  100.0    1.7   96.3
144        Tree/Simple/Visitor/PreOrderTraversal.pm      100.0    n/a   33.3  100.0  100.0    0.7   90.5
145        Tree/Simple/Visitor/CreateDirectoryTree.pm    100.0   85.7   86.7  100.0  100.0    3.4   95.8
146        Tree/Simple/Visitor/LoadClassHierarchy.pm     100.0   73.1   33.3  100.0  100.0    4.9   89.2
147        Tree/Simple/Visitor/LoadDirectoryTree.pm      100.0   89.3   85.2  100.0  100.0   26.1   94.7
148        Tree/Simple/Visitor/FindByNodeValue.pm        100.0  100.0   86.7  100.0  100.0    3.1   98.3
149        Tree/Simple/Visitor/FindByPath.pm             100.0  100.0   66.7  100.0  100.0    1.2   97.9
150        Tree/Simple/Visitor/FindByUID.pm              100.0  100.0   86.7  100.0  100.0    2.9   98.3
151        Tree/Simple/Visitor/GetAllDescendents.pm      100.0  100.0   77.8  100.0  100.0    2.3   97.1
152        Tree/Simple/Visitor/PathToRoot.pm             100.0   87.5   75.0  100.0  100.0    0.8   95.1
153        Tree/Simple/Visitor/Sort.pm                   100.0  100.0   77.8  100.0  100.0    8.8   98.1
154        Tree/Simple/Visitor/ToNestedArray.pm          100.0  100.0   66.7  100.0  100.0    1.5   96.5
155        Tree/Simple/Visitor/ToNestedHash.pm           100.0  100.0   66.7  100.0  100.0    1.4   96.5
156        Tree/Simple/Visitor/FromNestedArray.pm        100.0   94.4   81.8  100.0  100.0    8.1   96.6
157        Tree/Simple/Visitor/FromNestedHash.pm         100.0   91.7   77.8  100.0  100.0    4.8   95.9
158        Tree/Simple/Visitor/VariableDepthClone.pm     100.0  100.0   66.7  100.0  100.0   25.5   97.3
159        -------------------------------------------- ------ ------ ------ ------ ------ ------ ------
160        Total                                         100.0   93.8   76.3  100.0  100.0  100.0   96.1
161        -------------------------------------------- ------ ------ ------ ------ ------ ------ ------
162

SEE ALSO

164       These Visitor classes are meant to work with Tree::Simple hierarchies,
165       you should refer to that module for more information.
166

Repository

168       <https://github.com/ronsavage/Tree-Simple-VisitorFactory>
169

SUPPORT

171       Bugs should be reported via the CPAN bug tracker at
172
173       <https://github.com/ronsavage/Tree-Simple-VisitorFactory/issues>
174

AUTHOR

176       stevan little, <stevan@iinteractive.com>
177
178       Ron Savage <ron@savage.net.au> has taken over maintenance as of V 0.11.
179
181       Copyright 2004, 2005 by Infinity Interactive, Inc.
182
183       <http://www.iinteractive.com>
184
185       This library is free software; you can redistribute it and/or modify it
186       under the same terms as Perl itself.
187
188
189
190perl v5.32.1                      2021-02-02   Tree::Simple::VisitorFactory(3)
Impressum