NAME

Tree::Simple::View::Base - An abstract base class for viewing Tree::Simple heirarchies

SYNOPSIS

use Tree::Simple::View::Base;

DESCRIPTION

This is an abstract base class for the Tree::Simple::View::* classes. It sets up some of the common elements shared between the classes, and defines the base interface. This documentation will detail the code implemented within this pacakge, which will also be duplicated in the implementing classes as neseccary. So in reality this documentation serves little purpose.

METHODS

new ($tree, %configuration)

Accepts a $tree argument of a Tree::Simple object (or one derived from Tree::Simple). This $tree object does not need to be a ROOT, you can start at any level of the tree you desire. The options in the %config argument are determined by the implementing subclass, and you should refer to that documentation for details.

getTree

A basic accessor to reach the underlying tree object.

getConfig

A basic accessor to reach the underlying configuration hash.

expandPath (@path)

This method will return a string which will represent your tree expanded along the given @path. This is best shown visually. Given this tree:

Tree-Simple-View
    lib
        Tree
            Simple
                View.pm
                View
                    Base.pm
                    HTML.pm
                    DHTML.pm
    Makefile.PL
    MANIFEST
    README 
    Changes
    t
        10_Tree_Simple_View_test.t
        20_Tree_Simple_View_HTML_test.t
        30_Tree_Simple_View_DHTML_test.t
        

And given this path:

Tree-Simple-View, lib, Tree, Simple

Your display would like something like this:

Tree-Simple-View
    lib
        Tree
            Simple
                View.pm
                View
    Makefile.PL
    MANIFEST
    README 
    Changes
    t

As you can see, the given path has been expanded, but no other sub-trees are shown. The details of this are subject to the implementating subclass, and their documentation should be consulted.

It should be noted that this method actually calls either the expandPathSimple or expandPathComplex method depending upon the %config argument in the constructor.

expandPathSimple ($tree, @path)

If no %config argument is given in the constructor, then this method is called by expandPath. This method is optimized since it does not need to process any configuration, but just as the name implies, it's output is simple.

This method can also be used for another purpose, which is to bypass a previously specified configuration and use the base "simple" configuration instead.

expandPathComplex ($tree, $config, @path)

If a %config argument is given in the constructor, then this method is called by expandPath. This method has been optimized to be used with configurations, and will actually custom compile code (using eval) to speed up the generation of the output.

This method can also be used for another purpose, which is to bypass a previously specified configuration and use the configuration specified (as a HASH reference) in the $config parameter.

expandAll

This method will return a string of HTML which will represent your tree completely expanded. The details of this are subject to the implementating subclass, and their documentation should be consulted.

It should be noted that this method actually calls either the expandAllSimple or expandAllComplex method depending upon the %config argument in the constructor.

expandAllSimple

If no %config argument is given in the constructor, then this method is called by expandAll. This method too is optimized since it does not need to process any configuration.

This method as well can also be used to bypass a previously specified configuration and use the base "simple" configuration instead.

expandAllComplex ($config)

If a %config argument is given in the constructor, then this method is called by expandAll. This method too has been optimized to be used with configurations, and will also custom compile code (using eval) to speed up the generation of the output.

Just as with expandPathComplex, this method can be to bypass a previously specified configuration and use the configuration specified (as a HASH reference) in the $config parameter.

BUGS

None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it.

SEE ALSO

This is just an abstract base class, I suggest you read the documentation in the implementing subclasses:

Tree::Simple::View::HTML
Tree::Simple::View::DHTML

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.