CGI::Widget::HList - Create and manipulate Hierarchial List widgets
use CGI::Widget::HList; use CGI::Widget::HList::Node; #create a node my $root_node = CGI::Widget::HList::Node->new; $root_node->name("mama"); #create an hlist to manage the node my $hlist = CGI::Widget::HList->new(-root=>$root_node); #create a daughter node via the hlist object my $daughter = $hlist->node; $daughter->name("baby"); $root_node->add_daughter($daughter); #render the hlist print $hlist; #not very exciting
CGI::Widget::HList provides look-and-feel for displaying a CGI::Widget::HList::Node tree graph. For more information, see CGI::Widget::HList::Node.
This module is where image configurations, node rendering, and connector rendering methods are stored in the form of callbacks.
Check ex/ for example scripts
CGI::Widget::HList has only one constructor: new().
For convenient access to the CGI::Widget::HList::Node constructor, you can call the node() method.
new() accepts the following parameters, with optional leading dash. All parameters are optional.
Parameter Purpose ------------------------------------------------------------------- root Root node of the tree to be rendered Images to be used in the HTML rendering of the tree: img_open,img_close,img_leaf,img_trunk,img_branch,img_corner,img_spacer The rendering methods themselves. All are callbacks: render_node,render_branch,render_spacer,render_trunk
The rendering methods default to sensible code that uses the (also default) images. This can all be over-ridden. See Methods.
Interpreted in a scalar context, the object is overloaded to return the html for the HList. Easy!
html(), or ashtml() can also be called to produce the series html.
node() returns a CGI::Widget::HList::Node object.
root_node() returns the HList's root node.
render_*() methods allow setting/retrieving the coderefs actually used by CGI::Widget::HList::Node objects in the rendering process.
img_*() methods allow setting/retrieving image paths or text that will be used by the rendering coderefs.
Drop me a line if you use this, I'd like to know where it ends up. Allen Day <firstname.lastname@example.org> Copyright (c) 2001.