From: Florian Ragwitz Date: Thu, 30 Jul 2009 12:18:45 +0000 (+0200) Subject: Allow reinitialization of composite role metaclasses. X-Git-Tag: 0.90~39 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6e04cb0e6f0d0ae5e2db7ff1d5e25c78504c2e4a;p=gitmo%2FMoose.git Allow reinitialization of composite role metaclasses. --- diff --git a/lib/Moose/Meta/Role/Composite.pm b/lib/Moose/Meta/Role/Composite.pm index 4c6b13e..bb21545 100644 --- a/lib/Moose/Meta/Role/Composite.pm +++ b/lib/Moose/Meta/Role/Composite.pm @@ -109,6 +109,13 @@ sub apply_params { return $self; } +sub reinitialize { + my ($class, $old_meta, @args) = @_; + Moose->throw_error('Moose::Meta::Role::Composite instances can only be reinitialized from an existing metaclass instance') + if !blessed $old_meta || !$old_meta->isa('Moose::Meta::Role::Composite'); + return $old_meta->meta->clone_object($old_meta, @args); +} + 1; __END__ @@ -157,6 +164,11 @@ the composite role to it. The RoleSummation role application class used is determined by the composite role's C attribute. +=item * reinitialize($metaclass) + +Like C<< Class::MOP::Package->reinitialize >>, but doesn't allow passing a +string with the package name, as there is no real package for composite roles. + =back =back