X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FPurePerl.pm;h=8285fa7f08d185b6b2e4d7e9777da4561893b8be;hb=913b59645bf5e7f16128c0e20711090a43676096;hp=643795aabfa50ec594484ec45852814a0573e298;hpb=b5956f03156c79cfbdd20f9526f95a9df5aa26b4;p=gitmo%2FMouse.git diff --git a/lib/Mouse/PurePerl.pm b/lib/Mouse/PurePerl.pm index 643795a..8285fa7 100644 --- a/lib/Mouse/PurePerl.pm +++ b/lib/Mouse/PurePerl.pm @@ -288,6 +288,20 @@ sub new_object { return $object; } +sub clone_object { + my $class = shift; + my $object = shift; + my $args = $object->Mouse::Object::BUILDARGS(@_); + + (blessed($object) && $object->isa($class->name)) + || $class->throw_error("You must pass an instance of the metaclass (" . $class->name . "), not ($object)"); + + my $cloned = bless { %$object }, ref $object; + $class->_initialize_object($cloned, $args, 1); + + return $cloned; +} + sub _initialize_object{ my($self, $object, $args, $is_cloning) = @_; @@ -717,7 +731,7 @@ Mouse::PurePerl - A Mouse guts in pure Perl =head1 VERSION -This document describes Mouse version 0.59 +This document describes Mouse version 0.61 =head1 SEE ALSO