Hyper::Control::Base::BTree - Tree Base Control
This document describes Hyper::Control::Base::BTree 0.02
use Hyper::Control::Base::BTree; my $object = Hyper::Control::Base::BTree->new();
Base Control for HTML Trees.
my $child = Hyper::Control::Base::BTree->new(); $child->set_data('this is a nice child'); $object->add_child($child);
Add a child to a tree object. Childs are Tree Objects too.
$node->set_parent($root);
Set parent object for node.
# Sample Tree: # ROOT # '- child1 # '- child2 # '- child3 $child1->get_path(); # [ 0 ] $child2->get_path(); # [ 0, 0 ] $child3->get_path(); # [ 0, 1 ]
Get path from child to root node.
my $has_childs = $object->has_childs();
Indicates if a tree has childs.
my $has_next_sibling = $object->has_next_sibling();
Indicates if a tree object has a next siblings.
my $has_previous_sibling = $object->has_previous_sibling();
Indicates if a tree object has a previous siblings.
my $is_root = $object->is_root();
Indicates if a tree object has no parent node / if it's the root tree object.
my $html = $object->get_html();
Adjust $HTML::Template::Compiled::MAX_RECURSE and returns the rendered template.
my $template_childs = $object->get_template_childs();
Some Template engines are very stupid. This method is a helper method which returns all childs of a tree object as an array of hash refs which look like [ { this => $child[0] }, { this => $child[1] }, ... ]
If you don't understand what I mean, take a closer look on the default HTC template of for this Control.
version
Hyper::Control::Base
Class::Std::Storable
$Author: ac0v $
$Id: BTree.pm 528 2009-01-11 05:43:02Z ac0v $
$Revision: 528 $
$Date: 2009-01-11 06:43:02 +0100 (So, 11 Jan 2009) $
$HeadURL: http://svn.hyper-framework.org/Hyper/Hyper/tags/0.05/lib/Hyper/Control/Base/BTree.pm $
Andreas Specht <ACID@cpan.org>
<ACID@cpan.org>
Copyright (c) 2007, Andreas Specht <ACID@cpan.org>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Hyper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hyper
CPAN shell
perl -MCPAN -e shell install Hyper
For more information on module installation, please visit the detailed CPAN module installation guide.