X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FMethod.pm;h=7ee49008bf2ac0ac08c06decb10e2fa96e8eb41d;hb=HEAD;hp=9a0cdda61592d3e19f6d5d485cf12b01fa310521;hpb=19042e4de51060275cd940cf997a6791afb0dfec;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Method.pm b/lib/Class/MOP/Method.pm index 9a0cdda..7ee4900 100644 --- a/lib/Class/MOP/Method.pm +++ b/lib/Class/MOP/Method.pm @@ -7,7 +7,7 @@ use warnings; use Carp 'confess'; use Scalar::Util 'weaken', 'reftype', 'blessed'; -our $VERSION = '0.92'; +our $VERSION = '1.12'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -123,11 +123,19 @@ sub execute { $self->body->(@_); } -# NOTE: -# the Class::MOP bootstrap -# will create this for us -# - SL -# sub clone { ... } +# We used to go through use Class::MOP::Class->clone_instance to do this, but +# this was awfully slow. This method may be called a number of times when +# classes are loaded (especially during Moose role application), so it is +# worth optimizing. - DR +sub clone { + my $self = shift; + + my $clone = bless { %{$self}, @_ }, blessed($self); + + $clone->_set_original_method($self); + + return $clone; +} 1; @@ -269,7 +277,7 @@ Stevan Little Estevan@iinteractive.comE =head1 COPYRIGHT AND LICENSE -Copyright 2006-2009 by Infinity Interactive, Inc. +Copyright 2006-2010 by Infinity Interactive, Inc. L