NAME
Tree::DeepClone - A subclass of Tree::Fast which does deep cloning
SYNOPSIS
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings FATAL => 'all';
use Tree::DeepClone;
# -----------------------
my(@alphabet) = (qw/a b c d e f g h i j k l m n o p q r s t u v w x y z/);
my($tree) = Tree::DeepClone -> new('root');
$tree -> add_child({}, map {Tree::DeepClone -> new($_)} 1..3);
my($value);
say 'Tree:';
for ($tree -> traverse)
{
$value = $_ -> value;
$_ -> meta({$value => ($value eq 'root') ? '0' : $alphabet[$value - 1]});
say $_ -> value, '. meta: ', ${$_ -> meta}{$value};
}
my($clone) = $tree -> clone;
say 'Clone:';
for ($clone -> traverse)
{
$value = $_ -> value;
say $_ -> value, '. meta: ', ${$_ -> meta}{$value};
}
DESCRIPTION
This module simply adds deep cloning to Tree::Fast. As per the Synopsis, you must use Tree::DeepClone everywhere you want this feature.
METHODS
All methods in <Tree::Fast> are available in Tree::DeepClone.
SUPPORT
https://github.com/ronsavage/Tree.
ACKNOWLEDGEMENTS
Stevan Little for writing Tree, upon which this module is based.
AUTHOR
Ron Savage <rsavage@cpan.org>.
COPYRIGHT AND LICENSE
Australian copyright (c) 2018, Ron Savage.
All Programs of mine are 'OSI Certified Open Source Software';
you can redistribute them and/or modify them under the terms of
The Perl License 2.0, a copy of which is available at:
http://opensource.org/licenses/alphabetical.