NAME

Tree::Simple::View - A class for viewing Tree::Simple hierarchies in various formats

SYNOPSIS

use Tree::Simple::View;
# the default uses Tree::Simple::View::HTML 

use Tree::Simple::View qw(DHTML);
# now uses the Tree::Simple::View::DHTML class

DESCRIPTION

This serves as a proxy front end to the Tree::Simple::View::* classes. For now all that are included are; Tree::Simple::View::HTML and Tree::Simple::View::DHTML. Eventually I will be adding more Tree::Simple::View::* classes for it to proxy, see the "TO DO" section for more information.

This is the first release of this set of modules, and therefore it is not totally "complete". That is not to say it isn't usable. It is based on some older tree formatting code I had lying around but had never properly modularized. However, I will be using these modules in a production system in the upcoming months, so you can expect many updates which should provide increases in both performance and reliability.

METHODS

new ($tree, %config)

Depending upon the value given in the use statement, this will return an instance of Tree::Simple::View::* class. It is just a proxy to the Tree::Simple::View::*::new methods.

DEMO

To view a demo of the Tree::Simple::View::DHTML functionality, look in the examples/ directory.

TO DO

More Tests

We could use some more tests, to help increase the coverage (which is only at 70.9% right now). Normally I would not release a module with coverage this low, but I need to get back to working on a project for a client (for which this module was created). But because I will be using this module in this project, I know I will be able to improve the test suite as I go.

Adding new Tree::Simple::View::* classes

I have an Tree::Simple::View::ASCII class in the works, which will output Trees in plain text, and optionally support ANSI colors for terminal output.

I am considering a Tree::Simple::View::PS or Tree::Simple::View::PDF class which could output either Postscript or PDF trees.

I have thought about Tree::Simple::View::XML, but I am not sure it would be useful really.

I suppose that Tree::Simple::View::* classes could be made for various GUI toolkits like Tk, etc. But to tell the truth, I am not that familiar with non-web GUIs, so that is likely a long way off.

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.

CODE COVERAGE

I use Devel::Cover to test the code coverage of my tests, below is the Devel::Cover report on this module test suite.

---------------------------------- ------ ------ ------ ------ ------ ------ ------
File                                 stmt branch   cond    sub    pod   time  total
---------------------------------- ------ ------ ------ ------ ------ ------ ------
/Tree/Simple/View.pm                100.0   66.7    n/a  100.0  100.0    0.4   93.9
/Tree/Simple/View/Base.pm            71.4   62.5   33.3   50.0  100.0   24.7   64.5
/Tree/Simple/View/DHTML.pm           60.5   25.0    0.0   78.9  100.0    9.1   56.4
/Tree/Simple/View/HTML.pm            71.3   41.7   20.0   85.0  100.0   11.0   63.7
t/10_Tree_Simple_View_test.t        100.0    n/a    n/a  100.0    n/a    4.2  100.0
t/20_Tree_Simple_View_HTML_test.t   100.0    n/a    n/a  100.0    n/a   19.7  100.0
t/30_Tree_Simple_View_DHTML_test.t  100.0    n/a    n/a  100.0    n/a   30.9  100.0
---------------------------------- ------ ------ ------ ------ ------ ------ ------
Total                                77.3   40.5   20.0   82.9  100.0  100.0   70.9
---------------------------------- ------ ------ ------ ------ ------ ------ ------

SEE ALSO

There are a few modules out there that I have seen which do similar things to these modules. I have attempted to describe them here, but not being a user of these modules myself, I can not do them justice. If you think I have mis-represented or just under-represented these modules, please let me know. Also, if I have not included a module which should be here, let me know and I will add it.

HTML::PopupTreeSelect

This module implements a DHTML "pop-up" dialog which contains an expand-collapse tree, which can be used for selecting an item from a hierarchy. It looks to me to be very configurable and have all its bases covered, right down to handling some of the uglies of cross-browser/cross-platform DHTML. However it is really for a very specific purpose, and not for general tree display like this module.

HTML::TreeStructured

This module actually seems to do something very similar to these modules, but to be honest, the documentation is very, very sparse, and so I am not really sure how to go about using it. From a quick read of the code it seems to use HTML::Template as its base, but after that I am not sure.

CGI::Explorer

This module is similar to the HTML::PopupTreeSelect, in that it is intended for a more singular purpose. This module implements a Windows-style explorer tree.

Data::TreeDumper

This module is an alternative to Data::Dumper for dumping out tree structures. As the author points out, the output of Data::Dumper when dealing with tree structures can be difficult to read at best. This module solves that problem by dumping a much more readable and understandable output for tree data-structres. There are a lot of options for output, including custom output filters, so it is concievable that you could produce similar output to this module's with Data::TreeDumper. However, the central goal of Data::TreeDumper is more for viewing of data structures by developers and not for UI output (which Tree::Simple::View is for).

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.