1MooseX::Clone::Meta::AtUtsreirbuCtoen:t:rMTiorboausiteteX:d:::CPCleloronlnee(D:3o:)cMuemtean:t:aAttitornibute::Trait::Clone(3)
2
3
4
6 MooseX::Clone::Meta::Attribute::Trait::Clone - The
7 Moose::Meta::Attribute trait for deeply cloning attributes.
8
10 # see MooseX::Clone
11
12 has foo => (
13 traits => [qw(Clone)],
14 isa => "Something",
15 );
16
17 $object->clone; # will recursively call $object->foo->clone and set the value properly
18
20 This meta attribute trait provides a "clone_value" method, in the
21 spirit of "get_value" and "set_value". This allows clone methods such
22 as the one in MooseX::Clone to make use of this per-attribute cloning
23 behavior.
24
26 Deriving this role for your own cloning purposes is encouraged.
27
28 This will allow your fine grained cloning semantics to interact with
29 MooseX::Clone in the RightX way.
30
32 clone_only_objects
33 Whether or not Data::Visitor should be used to clone arbitrary
34 structures. Objects found in these structures will be cloned using
35 clone_object_value.
36
37 If true then non object values will be copied over in shallow
38 cloning semantics (shared reference).
39
40 Defaults to false (all reference will be cloned).
41
42 clone_visitor_config
43 A hash ref used to construct "clone_visitor". Defaults to the empty
44 ref.
45
46 This can be used to alter the cloning behavior for non object
47 values.
48
49 clone_visitor
50 The Data::Visitor::Callback object that will be used to clone.
51
52 It has an "object" handler that delegates to "clone_object_value"
53 and sets "tied_as_objects" to true in order to deeply clone tied
54 structures while retaining magic.
55
56 Only used if "clone_only_objects" is false and the value of the
57 attribute is not an object.
58
60 clone_value $target, $proto, %args
61 Clones the value the attribute encapsulates from $proto into
62 $target.
63
64 clone_value_data $value, %args
65 Does the actual cloning of the value data by delegating to a
66 "clone" method on the object if any.
67
68 If the object does not support a "clone" method an error is thrown.
69
70 If the value is not an object then it will not be cloned.
71
72 In the future support for deep cloning of simple refs will be added
73 too.
74
75 clone_object_value $object, %args
76 This is the actual workhorse of "clone_value_data".
77
78 clone_any_value $value, %args
79 Uses "clone_visitor" to clone all non object values.
80
81 Called from "clone_value_data" if the value is not an object and
82 "clone_only_objects" is false.
83
84
85
86perl v5.12.1 Moo2s0e1X0:-:0C1l-o0n1e::Meta::Attribute::Trait::Clone(3)