Tree::Simple::Visitor - Visitor object for Simple Tree data-structures
use Tree::Simple::Visitor;
This is a very basic Visitor object for Tree::Simple objects.
If passed this constant in the constructor, the function will be applied recursively down the heirarchy of Tree::Simple objects.
If passed this constant in the constructor, the function will be applied to the immediate children of the Tree::Simple object.
The first argument to the constructor is a code reference to a function which expects a 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 Tree::Simple instance. If $depth is set to CHILDREN_ONLY, then the function will be applied to the current Tree::Simple instance and all its immediate children. If $depth is set to RECURSIVE, then the function will be applied to the current Tree::Simple instance and all its immediate children, and all of their children recursively on down the tree.
$depth
CHILDREN_ONLY
RECURSIVE
The visit method accepts a Tree::Simple and applies the function set in new appropriately.
visit
new
Tree::Simple
Gang Of Four Design Patterns Book. Specifically, the Visitor Pattern.
stevan little, <stevan@iinteractive.com>
Copyright 2004 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.
To install Tree::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tree::Simple
CPAN shell
perl -MCPAN -e shell install Tree::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.