Tree::DeepClone(3)

πŸ“¦
version 1.16 Β· 2 versions
, in fedora 43

✨ Tree::DeepClone πŸ’–

okay bestie, so this is Tree::DeepClone(3) β€” a page from the User Contributed Perl Documentation section, and it's literally about a module called Tree::DeepClone that's a subclass of Tree::Fast which does deep cloning. that's the whole vibe. πŸŽ€


🌸 NAME 🌸

Tree::DeepClone β€” a subclass of Tree::Fast which does deep cloning. periodt. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole thing, copied with love, no notes:

#!/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 πŸŽ€

so like, this module simply adds deep cloning to Tree::Fast. and here's the important bit β€” as per the Synopsis, you must use Tree::DeepClone everywhere you want this feature. not "sometimes", not "when you feel like it". everywhere. iykyk. 🌈


πŸ’œ METHODS πŸ’œ

All methods in Tree::Fast are available in Tree::DeepClone. all of them. the whole menu. πŸ“


🫢 SUPPORT 🫢

https://github.com/ronsavage/Tree β€” that's the place. go there. πŸ’–


πŸ‘‘ ACKNOWLEDGEMENTS πŸ‘‘

  • Stevan Little for writing Tree, upon which this module is based. king behaviour, honestly. πŸ‘‘

🌟 AUTHOR 🌟

Ron Savage <rsavage@cpan.org>.

https://savage.net.au/. ✨


This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so yes, you can share it, remix it, whatever β€” same terms as Perl, no cap. πŸŽ€


and that's the whole page bestie, hope it slayed πŸ’– stay cloned, stay deep 🌸

mwah πŸ’‹ β€” this was Tree::DeepClone(3) from perl v5.42.0, dated 2025-07-25. go forth and deep clone responsibly πŸ¦‹βœ¨

πŸ“¦ where this page comes from