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

NAME

Hyper::Control::Base::BTree - Tree Base Control

VERSION

This document describes Hyper::Control::Base::BTree 0.02

SYNOPSIS

    use Hyper::Control::Base::BTree;
    my $object = Hyper::Control::Base::BTree->new();

DESCRIPTION

Base Control for HTML Trees.

ATTRIBUTES

childs :set :get :default<[]>
parent :set :get
data :set :get
position :set :get

SUBROUTINES/METHODS

add_child

    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.

set_parent

    $node->set_parent($root);

Set parent object for node.

get_path

    # 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.

has_childs

    my $has_childs = $object->has_childs();

Indicates if a tree has childs.

has_next_sibling

    my $has_next_sibling = $object->has_next_sibling();

Indicates if a tree object has a next siblings.

has_previous_sibling

    my $has_previous_sibling = $object->has_previous_sibling();

Indicates if a tree object has a previous siblings.

is_root

    my $is_root = $object->is_root();

Indicates if a tree object has no parent node / if it's the root tree object.

get_html

    my $html = $object->get_html();

Adjust $HTML::Template::Compiled::MAX_RECURSE and returns the rendered template.

get_template_childs

    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.

DIAGNOSTICS

CONFIGURATION AND ENVIRONMENT

DEPENDENCIES

  • version

  • Hyper::Control::Base

  • Class::Std::Storable

INCOMPATIBILITIES

BUGS AND LIMITATIONS

RCS INFORMATIONS

Last changed by

$Author: ac0v $

Id

$Id: BTree.pm 528 2009-01-11 05:43:02Z ac0v $

Revision

$Revision: 528 $

Date

$Date: 2009-01-11 06:43:02 +0100 (So, 11 Jan 2009) $

HeadURL

$HeadURL: http://svn.hyper-framework.org/Hyper/Hyper/tags/0.05/lib/Hyper/Control/Base/BTree.pm $

AUTHOR

Andreas Specht <ACID@cpan.org>

LICENSE AND COPYRIGHT

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.