Tree::Simple::WithMetaData - A Tree::Simple subclass with added metadata handling
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
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.
Adds the %metadata into the node.
%metadata
Checks for presence of metadata at $key in the local metadata stash.
$key
Returns any metadata at $key in the local metadata stash.
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).
None that I am aware of. Of course, if you find a bug, let me know, and I will be sure to fix it.
stevan little, <stevan@iinteractive.com>
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.
To install Tree::Simple::Manager, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tree::Simple::Manager
CPAN shell
perl -MCPAN -e shell install Tree::Simple::Manager
For more information on module installation, please visit the detailed CPAN module installation guide.