Tree::Simple::Visitor::GetAllDescendents(3pm) | User Contributed Perl Documentation | Tree::Simple::Visitor::GetAllDescendents(3pm) |
Tree::Simple::Visitor::GetAllDescendents - A Visitor for fetching all the descendents of a Tree::Simple object
use Tree::Simple::Visitor::GetAllDescendents; # create an instance of our visitor my $visitor = Tree::Simple::Visitor::GetAllDescendents->new(); # pass the visitor to a Tree::Simple object $tree->accept($visitor); # you can also get the descendents # back as an array of node values my @descendents = $visitor->getDescendents(); # for more complex node objects, you can specify # a node filter which will be used to extract the # information desired from each node $visitor->setNodeFilter(sub { my ($t) = @_; return $t->getNodeValue()->description(); });
Given a Tree::Simple instance this Visitor will return all the descendents recursively on down the hierarchy.
<https://github.com/ronsavage/Tree-Simple-VisitorFactory>
Bugs should be reported via the CPAN bug tracker at
<https://github.com/ronsavage/Tree-Simple-VisitorFactory/issues>
See the CODE COVERAGE section in Tree::Simple::VisitorFactory for more information.
These Visitor classes are all subclasses of Tree::Simple::Visitor, which can be found in the Tree::Simple module, you should refer to that module for more information.
stevan little, <stevan@iinteractive.com>
Copyright 2004, 2005 by Infinity Interactive, Inc.
<http://www.iinteractive.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2021-02-20 | perl v5.32.1 |