• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/CPANInternal-140/Tree-Simple-1.18/lib/Tree/Simple/

Lines Matching +refs:Tree +refs:see

2 package Tree::Simple::Visitor;
92 (blessed($tree) && $tree->isa("Tree::Simple"))
93 || die "Insufficient Arguments : You must supply a valid Tree::Simple object";
125 Tree::Simple::Visitor - Visitor object for Tree::Simple objects
129 use Tree::Simple;
130 use Tree::Simple::Visitor;
133 my $visitor = Tree::Simple::Visitor->new();
136 my $tree = Tree::Simple->new(Tree::Simple->ROOT)
138 Tree::Simple->new("1.0"),
139 Tree::Simple->new("2.0")
141 Tree::Simple->new("2.1.0")
143 Tree::Simple->new("3.0")
163 # backwards compatible to the older version, see the
168 This object has been revised into what I think is more intelligent approach to Visitor objects. This is now a more suitable base class for building your own Visitors. It is also the base class for the visitors found in the B<Tree::Simple::VisitorFactory> distribution, which includes a number of useful pre-built Visitors.
173 my $visitor = Tree::Simple::Visitor->new(sub {
177 Tree::Simple::Visitor->RECURSIVE);
185 my $visitor = Tree::Simple::Visitor->new();
189 This object is still pretty much a wrapper around the Tree::Simple C<traverse> method, and can be thought of as a depth-first traversal Visitor object.
201 The first argument to the constructor is a code reference to a function which expects a B<Tree::Simple> object as its only argument. The second argument is optional, it can be used to set the depth to which the function is applied. If no depth is set, the function is applied to the current B<Tree::Simple> instance. If C<$depth> is set to C<CHILDREN_ONLY>, then the function will be applied to the current B<Tree::Simple> instance and all its immediate children. If C<$depth> is set to C<RECURSIVE>, then the function will be applied to the current B<Tree::Simple> instance and all its immediate children, and all of their children recursively on down the tree. If no C<$depth> is passed to the constructor, then the function will only be applied to the current B<Tree::Simple> object and none of its children.
217 This method accepts a CODE reference as its C<$filter_function> argument. This code reference is used to filter the tree nodes as they are collected. This can be used to customize output, or to gather specific information from a more complex tree node. The filter function should accept a single argument, which is the current Tree::Simple object.
229 The C<visit> method accepts a B<Tree::Simple> and applies the function set in C<new> or C<setNodeFilter> appropriately. The results of this application can be retrieved with C<getResults>
241 If passed this constant in the constructor, the function will be applied recursively down the hierarchy of B<Tree::Simple> objects.
245 If passed this constant in the constructor, the function will be applied to the immediate children of the B<Tree::Simple> object.
251 None that I am aware of. The code is pretty thoroughly tested (see B<CODE COVERAGE> section in B<Tree::Simple>) and is based on an (non-publicly released) module which I had used in production systems for about 2 years without incident. Of course, if you find a bug, let me know, and I will be sure to fix it.
255 I have written a set of pre-built Visitor objects, available on CPAN as B<Tree::Simple::VisitorFactory>.