From: Dave Rolsky Date: Wed, 27 Aug 2008 17:56:27 +0000 (+0000) Subject: document subclass problem with metaclass roles X-Git-Tag: 0.55_04~2^2~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=eaeacdd61bf62dacc95420413475bb1019141832;p=gitmo%2FMoose.git document subclass problem with metaclass roles --- diff --git a/lib/Moose/Util/MetaRole.pm b/lib/Moose/Util/MetaRole.pm index f0b53c4..4724da7 100644 --- a/lib/Moose/Util/MetaRole.pm +++ b/lib/Moose/Util/MetaRole.pm @@ -203,6 +203,44 @@ once. This function will apply the specified roles to the object's base class. +=head1 PROBLEMS WITH METACLASS ROLES AND SUBCLASS + +Because of the way this module works, there is an ordering problem +which occurs in certain situations. This sequence of events causes an +error: + +=over 4 + +=item 1. + +There is a class (ClassA) which uses some extension(s) that apply +roles to the metaclass. + +=item 2. + +You have another class (ClassB) which wants to subclass ClassA and +apply some more extensions. + +=back + +Normally, the call to C will happen at run time, I the +additional extensions are applied. This causes an error when we try to +make the metaclass for ClassB compatible with the metaclass for +ClassA. + +We hope to be able to fix this in the future. + +For now the workaround is for ClassB to make sure it extends ClassA +I it loads extensions: + + package ClassB; + + use Moose; + + BEGIN { extends 'ClassA' } + + use MooseX::SomeExtension; + =head1 AUTHOR Dave Rolsky Eautarch@urth.orgE