NAME

Tree::Simple::WithMetaData - A Tree::Simple subclass with added metadata handling

SYNOPSIS

use Tree::Simple::WithMetaData;

my $tree = Tree::Simple::WithMetaData->new('a node');
$tree->addMetaData(
    foo => "bar",
    bar => "baz",
);

print $tree->fetchMetaData('foo'); # bar

$tree->addChild(
    Tree::Simple::WithMetaData->new('another node');
);

# metadata is "inherited"
print $tree->getChild(0)->fetchMetaData('foo'); # bar

DESCRIPTION

This is a very simple (but actually very handy) subclass of Tree::Simple. It adds node level metadata and the ability for tree's to "inherit" their parents metadata as well. Read the source, it's really simple actually.

METHODS

addMetaData (%metadata)

Adds the %metadata into the node.

hasMetaDataFor ($key)

Checks for presence of metadata at $key in the local metadata stash.

getMetaDataFor ($key)

Returns any metadata at $key in the local metadata stash.

fetchMetaData ($key)

Looks in the local stash for metadata at $key, if it is not found, then it will traverse up the tree until it finds something (or returns undef).

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.

AUTHOR

stevan little, <stevan@iinteractive.com>

COPYRIGHT AND LICENSE

Copyright 2004-2007 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.