There are many other more mature implementations of trees out there
Tree, Tree::Fast, Tree::Simple, Forrest::Tree and I can't think of a reason that makes mine better
I just wanted to spend the time writing a tree class with moose using weak refs and attribute traits
add_child(;$node)
add a new child to tree
get_or_add_child($node);
adds a child with $node as its data or get an existing child
returns an un-intialized orphan if node is undef
*this will be added to the family upon setting node
node_as_string()
represent node value as string
as_string
print node via node_as_string, then recurse to children
traverse_depth(;sortCallback)
returns array of nodes with a depth first search
if a sort function is passed, every node's children will be sorted prior to recursion
to perform a search while sorting on first the existence of grand children
then alphabetically on node's value
my $sortFunc = sub($$) {
$_[0]->has_children <=> $_[1]->has_children
||
$_[0]->node cmp $_[1]->node;
};
my @list = grep {
/(some|keyword)/
} map {
$_->node_as_string
} $self->traverse_depth($sortFunc);
Module Install Instructions
To install Archive::AndroidBackup, copy and paste the appropriate command in to your terminal.