Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

moosex::clone::meta::attribute::trait::storableclone(3pm) [debian man page]

MooseX::Clone::Meta::Attribute::Trait::StorableClone(3pmUser Contributed Perl DocumentatiMooseX::Clone::Meta::Attribute::Trait::StorableClone(3pm)

NAME
MooseX::Clone::Meta::Attribute::Trait::StorableClone - The Moose::Meta::Attribute trait for deeply cloning attributes using Storable. SYNOPSIS
# see MooseX::Clone has foo => ( traits => [qw(StorableClone)], isa => "Something", ); my $clone = $object->clone; # $clone->foo will equal Storable::dclone($object->foo) DESCRIPTION
This meta attribute trait provides a "clone_value" method, in the spirit of "get_value" and "set_value". This allows clone methods such as the one in MooseX::Clone to make use of this per-attribute cloning behavior. DERIVATION
Deriving this role for your own cloning purposes is encouraged. This will allow your fine grained cloning semantics to interact with MooseX::Clone in the RightX way. ATTRIBUTES
clone_only_objects Whether or not Data::Visitor should be used to clone arbitrary structures. Objects found in these structures will be cloned using clone_object_value. If true then non object values will be copied over in shallow cloning semantics (shared reference). Defaults to false (all reference will be cloned). clone_visitor_config A hash ref used to construct "clone_visitor". Defaults to the empty ref. This can be used to alter the cloning behavior for non object values. clone_visitor The Data::Visitor::Callback object that will be used to clone. It has an "object" handler that delegates to "clone_object_value" and sets "tied_as_objects" to true in order to 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 $proto into $target. clone_value_data $value, %args Does the actual cloning of the value data by delegating to a "clone" method on the object if any. If the object does not support a "clone" method an error is thrown. If the value is not an object then it will not be cloned. In the future support for deep cloning of simple refs will be added too. clone_object_value $object, %args This is the actual workhorse of "clone_value_data". clone_any_value $value, %args Uses "clone_visitor" to clone all non object values. Called from "clone_value_data" if the value is not an object and "clone_only_objects" is false. perl v5.10.1 2009-04-11 MooseX::Clone::Meta::Attribute::Trait::StorableClone(3pm)

Check Out this Related Man Page

MooseX::Attribute::ChainedClone(3pm)			User Contributed Perl Documentation		      MooseX::Attribute::ChainedClone(3pm)

NAME
MooseX::Attribute::ChainedClone - Attribute that returns a cloned instance VERSION
version 1.0.1 SYNOPSIS
package Test; use Moose; has debug => ( traits => [ 'ChainedClone' ], is => 'rw', isa => 'Bool', default => 0, ); sub complex_method { my $self = shift; #... print "helper message" if $self->debug; #... } sub clone { my $self = shift; # custom clone code here # defaults to: return bless { %$self }, ref $self; } 1; Which allows for: my $test = Test->new; $test->debug(1)->complex_method; # debug enabled # complex_method is called on a cloned instance # with debug set to 1 $test->complex_method; # debug is still disabled on $test $test->debug(1); # returns a cloned $test instance with debug set to 1 $test->debug; # returns 0 DESCRIPTION
MooseX::Attribute::ChainedClone is a Moose Trait which allows for method chaining on accessors by returning a cloned instance of $self on write/set operations. If $self has a "clone" method, this method is invoked to clone the instance. This allows for easy integration with MooseX::Clone or any custom made clone method. If no "clone" method is available, the new instance is build using "bless { %$self }, ref $self". AUTHORS
o Moritz Onken <onken@netcubed.de> o David McLaughlin <david@dmclaughlin.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Moritz Onken. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-01-28 MooseX::Attribute::ChainedClone(3pm)
Man Page