The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tree::Simple::Visitor - Visitor object for Simple Tree data-structures

SYNOPSIS

  use Tree::Simple::Visitor;

DESCRIPTION

This is a very basic Visitor object for Tree::Simple objects.

CONSTANTS

RECURSIVE

If passed this constant in the constructor, the function will be applied recursively down the heirarchy of Tree::Simple objects.

CHILDREN_ONLY

If passed this constant in the constructor, the function will be applied to the immediate children of the Tree::Simple object.

METHODS

new (CODE, $depth)

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.

visit ($tree)

The visit method accepts a Tree::Simple and applies the function set in new appropriately.

SEE ALSO

Tree::Simple

Gang Of Four Design Patterns Book. Specifically, the Visitor Pattern.

AUTHOR

stevan little, <stevan@iinteractive.com>

COPYRIGHT AND LICENSE

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.