1Tree::Simple::Visitor::ULsoeardCCloanstsrHiibeuTrtraeerdec:hP:yeS(ri3lm)pDloec:u:mVeinstiattoiro:n:LoadClassHierarchy(3)
2
3
4
6 Tree::Simple::Visitor::LoadClassHierarchy - A Visitor for loading class
7 hierarchies into a Tree::Simple hierarchy
8
10 use Tree::Simple::Visitor::LoadClassHierarchy;
11
12 # create an visitor
13 my $visitor = Tree::Simple::Visitor::LoadClassHierarchy->new();
14
15 # set class as an instance, or
16 $visitor->setClass($class);
17
18 # as a package name
19 $visitor->setClass("My::Class");
20
21 # pass our visitor to the tree
22 $tree->accept($visitor);
23
24 # the $tree now mirrors the inheritance hierarchy of the $class
25
27 This visitor will traverse a class's inheritance hierarchy (through the
28 @ISA arrays) and create a Tree::Simple hierarchy which mirrors it.
29
31 new There are no arguments to the constructor the object will be in its
32 default state. You can use the "setNodeFilter" method to customize
33 its behavior.
34
35 includeTrunk ($boolean)
36 Setting the $boolean value to true (1) will cause the node value of
37 the $tree object passed into "visit" to be set with the root value
38 found in the class hierarchy. Setting it to false (0), or not
39 setting it, will result in the first value in the class hierarchy
40 creating a new node level.
41
42 includeMethods ($boolean)
43 Setting the $boolean value to true (1) will cause methods to be
44 added as a children of the class node. Setting it to false (0), or
45 not setting it, will result in this not happening.
46
47 NOTE: Methods are sorted ascii-betically before they are added to
48 the tree. This allows a more predictable hierarchy.
49
50 setClass ($class)
51 The argument $class should be either a class name or an instance,
52 it is then used as the root from which to determine the class
53 hierarchy.
54
55 setNodeFilter ($filter_function)
56 This method accepts a CODE reference as its $filter_function
57 argument and throws an exception if it is not a code reference.
58 This code reference is used to filter the tree nodes as they are
59 created, the $filter_function is passed the node value extracted
60 from the hash prior to it being inserted into the tree being built.
61 The $filter_function is expected to return the value desired for
62 inclusion into the tree.
63
64 visit ($tree)
65 This is the method that is used by Tree::Simple's "accept" method.
66 It can also be used on its own, it requires the $tree argument to
67 be a Tree::Simple object (or derived from a Tree::Simple object),
68 and will throw and exception otherwise.
69
70 The $tree argument which is passed to "visit" must be a leaf node.
71 This is because this Visitor will create all the sub-nodes for this
72 tree. If the tree is not a leaf, an exception is thrown. We do not
73 require the tree to be a root though, and this Visitor will not
74 affect any nodes above the $tree argument.
75
77 Improve the "includeMethods" functionality
78 I am not sure the tree this creates is the optimal tree for this
79 situation. It is sufficient for now, until I have more of an actual
80 need for this functionality.
81
82 Add "includeFullSymbolTable" functionality
83 This would traverse the full symbol tables and produce a detailed
84 tree of everything it finds. This takes a lot more work, and as I
85 have no current need for it, it remains in the TO DO list.
86
88 <https://github.com/ronsavage/Tree-Simple-VisitorFactory>
89
91 Bugs should be reported via the CPAN bug tracker at
92
93 <https://github.com/ronsavage/Tree-Simple-VisitorFactory/issues>
94
96 See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more
97 information.
98
100 These Visitor classes are all subclasses of Tree::Simple::Visitor,
101 which can be found in the Tree::Simple module, you should refer to that
102 module for more information.
103
105 stevan little, <stevan@iinteractive.com>
106
108 Copyright 2004, 2005 by Infinity Interactive, Inc.
109
110 <http://www.iinteractive.com>
111
112 This library is free software; you can redistribute it and/or modify it
113 under the same terms as Perl itself.
114
115
116
117perl v5.32.1 2T0r2e1e-:0:2S-i0m2ple::Visitor::LoadClassHierarchy(3)