From: Matt S Trout Date: Thu, 5 Apr 2012 20:20:33 +0000 (+0000) Subject: remember to register roles with newly created metaclass X-Git-Tag: v0.009_015~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7c418d0bd71a50c906656d044581a0854b98b0a1;p=gitmo%2FMoo.git remember to register roles with newly created metaclass --- diff --git a/lib/Moo/HandleMoose.pm b/lib/Moo/HandleMoose.pm index 8f3e095..5c7cd4b 100644 --- a/lib/Moo/HandleMoose.pm +++ b/lib/Moo/HandleMoose.pm @@ -5,7 +5,9 @@ use Moo::_Utils; our %TYPE_MAP; -sub import { inject_all() } +our $SETUP_DONE; + +sub import { return if $SETUP_DONE; inject_all(); $SETUP_DONE = 1; } sub inject_all { require Class::MOP; @@ -72,6 +74,8 @@ sub inject_real_metaclass_for { } } } + $meta->add_role(Class::MOP::class_of($_)) + for keys %{$Role::Tiny::APPLIED_TO{$name}}; $DID_INJECT{$name} = 1; $meta; }