NAME
Net::IPAM::Tree::Node - A node in the Net::IPAM::Tree
SYNOPSIS
A node is a recursive datastructure with a payload (block) and a parent and zero or more child nodes.
node = {
block => Net::IPAM::Block,
parent => Net::IPAM::Tree::Node,
childs => [ Net::IPAM::Tree::Node, ... ],
};
use Net::IPAM::Tree::Node;
my $n = Net::IPAM::Tree::Node->new( { block => $block, parent = $node, childs = [] } );
METHODS
new
Create Net::IPAM::Tree::Node object.
block
Accessor for the block attribute.
print $node->block;
parent
Accessor for the parent attribute.
$parent = $node->parent
childs
Accessor for the childs attribute.
$child = $node->childs->[$i]
insert_node
One method for inserting new nodes and parent-child relinking, recursive descent, heavy duty, key algorithm for this tree.
Returns undef on duplicate block.
remove
Remove block in tree, returns undef if not found. If $branch is true, don't relink the child nodes.
$node->remove($block, $branch) // warn("block not found,");
contains($block)
Reports whether the given block is contained in any child of the (root) node.
lookup($block)
Returns item in tree with longest-prefix-match for $block, returns undef if not found.
AUTHOR
Karl Gaissmaier, <karl.gaissmaier(at)uni-ulm.de>
BUGS
Please report any bugs or feature requests to bug-net-ipam-tree at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-IPAM-Tree. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Net::IPAM::Tree::Node
You can also look for information at:
on github
TODO
LICENSE AND COPYRIGHT
This software is copyright (c) 2020 by Karl Gaissmaier.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.