1MooseX::Clone::Meta::AtUtsreirbuCtoenM:to:roTisrbeauXit:te::dC:lCPolenorenl:e:(DM3oepctmua)m:e:nAttattriiobnute::Trait::Clone(3pm)
2
3
4
6 MooseX::Clone::Meta::Attribute::Trait::Clone - The attribute trait for
7 deeply cloning attributes
8
10 version 0.06
11
13 # see MooseX::Clone
14
15 has foo => (
16 traits => [qw(Clone)],
17 isa => "Something",
18 );
19
20 $object->clone; # will recursively call $object->foo->clone and set the value properly
21
23 This meta attribute trait provides a "clone_value" method, in the
24 spirit of "get_value" and "set_value". This allows clone methods such
25 as the one in MooseX::Clone to make use of this per-attribute cloning
26 behavior.
27
29 Deriving this role for your own cloning purposes is encouraged.
30
31 This will allow your fine grained cloning semantics to interact with
32 MooseX::Clone in the RightX way.
33
35 clone_only_objects
36 Whether or not Data::Visitor should be used to clone arbitrary
37 structures. Objects found in these structures will be cloned using
38 clone_object_value.
39
40 If true then non object values will be copied over in shallow
41 cloning semantics (shared reference).
42
43 Defaults to false (all reference will be cloned).
44
45 clone_visitor_config
46 A hash ref used to construct "clone_visitor". Defaults to the empty
47 ref.
48
49 This can be used to alter the cloning behavior for non object
50 values.
51
52 clone_visitor
53 The Data::Visitor::Callback object that will be used to clone.
54
55 It has an "object" handler that delegates to "clone_object_value"
56 and sets "tied_as_objects" to true in order to deeply clone tied
57 structures while retaining magic.
58
59 Only used if "clone_only_objects" is false and the value of the
60 attribute is not an object.
61
63 clone_value $target, $proto, %args
64 Clones the value the attribute encapsulates from $proto into
65 $target.
66
67 clone_value_data $value, %args
68 Does the actual cloning of the value data by delegating to a
69 "clone" method on the object if any.
70
71 If the object does not support a "clone" method an error is thrown.
72
73 If the value is not an object then it will not be cloned.
74
75 In the future support for deep cloning of simple refs will be added
76 too.
77
78 clone_object_value $object, %args
79 This is the actual workhorse of "clone_value_data".
80
81 clone_any_value $value, %args
82 Uses "clone_visitor" to clone all non object values.
83
84 Called from "clone_value_data" if the value is not an object and
85 "clone_only_objects" is false.
86
88 XXXX XXX'XX (Yuval Kogman) <nothingmuch@woobling.org>
89
91 This software is copyright (c) 2008 by XXXX XXX'XX (Yuval Kogman).
92
93 This is free software; you can redistribute it and/or modify it under
94 the same terms as the Perl 5 programming language system itself.
95
96
97
98perl v5.36.0 Moose2X0:2:2C-l0o7n-e2:2:Meta::Attribute::Trait::Clone(3pm)