MooseX...:Clone(3pm)
π MooseX::Clone::Meta::Attribute::Trait::Clone π
okay bestie so this is a page from the User Contributed Perl Documentation collection, and it's literally the manual for MooseX::Clone::Meta::Attribute::Trait::Clone. say that five times fast, i dare you. π«Ά
β¨ NAME β¨
MooseX::Clone::Meta::Attribute::Trait::Clone β the attribute trait that does deep cloning of attributes. like, it goes all the way down. no shallow nonsense. π
πΈ VERSION π¨
version 0.06
π¦ SYNOPSIS π¦
# see MooseX::Clone
has foo => (
traits => [qw(Clone)],
isa => "Something",
);
$object->clone; # will recursively call $object->foo->clone and set the value properly
so you slap the Clone trait on an attribute and then boom, when you clone the object, it goes and recursively calls $object->foo->clone and sets the value properly. it's giving inception but make it perl. π₯
π DESCRIPTION π
This meta attribute trait hands you a clone_value method, bestie β same energy as get_value and set_value, just the clone-flavored sibling. π
and why do we care? because clone methods like the one over in MooseX::Clone can use this to get per-attribute cloning behavior. each attribute knows how to clone itself, and the parent clone just lets them cook. π
π§ DERIVATION π§
ngl, deriving this role for your own cloning purposes is encouraged. they literally want you to. π
this will let your fine grained cloning semantics interact with MooseX::Clone in the RightX way. yes that's the actual word. iconic behavior honestly. π
π ATTRIBUTES π
clone_only_objectsβ whether or notData::Visitorshould be used to clone arbitrary structures. Objects found in these structures get cloned usingclone_object_value.
if this is true, then non-object values will be copied over in shallow cloning semantics (aka a shared reference). π
defaults to false, which means all references will be cloned.
clone_visitor_configβ a hash ref used to constructclone_visitor. defaults to the empty ref.
you can use this to alter the cloning behavior for non-object values. π
clone_visitorβ theData::Visitor::Callbackobject that will be used to clone.
it's got an object handler that delegates to clone_object_value and sets tied_as_objects to true, so it can deeply clone tied structures while retaining magic. β¨
only used if clone_only_objects is false and the value of the attribute is not an object.
π METHODS π
clone_value $target, $proto, %argsβ clones the value the attribute encapsulates from$protointo$target. moving the vibes from one place to another, respectfully. πclone_value_data $value, %argsβ does the actual cloning of the value data by delegating to aclonemethod on the object, if there is one.
if the object does not support a clone method, an error is thrown. no clone method, no clone. π
if the value is not an object, then it will not be cloned.
and in the future, support for deep cloning of simple refs will be added too. future plans, bestie, we love a roadmap. πΊ
clone_object_value $object, %argsβ this is the actual workhorse ofclone_value_data. the main character, honestly. π΄πclone_any_value $value, %argsβ usesclone_visitorto clone all non-object values.
called from clone_value_data if the value is not an object and clone_only_objects is false. π
π AUTHOR π
XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2008 by XXXX XXX'XX (Yuval Kogman).
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. π«Ά
and that's the whole page, bestie!! this was generated by perl v5.34.0 and dated 2022-06-15, and that's your cute lil sign-off for MooseX...:Clone(3pm). go forth and clone responsibly. πβ¨π¦
π¦ where this page comes from
- debian bookworm: libmoosex-clone-perl 0.06-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-clone-perl 0.06-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-clone-perl 0.06-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-clone-perl 0.06-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-clone-perl 0.06-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms