From: Matt S Trout Date: Thu, 3 May 2012 19:25:56 +0000 (+0000) Subject: use slow path for role create_class_with_roles under custom accessor generator X-Git-Tag: v0.091002~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMoo.git;a=commitdiff_plain;h=64284a1b21ce94c351f555f0e74929e4ff8ad323 use slow path for role create_class_with_roles under custom accessor generator --- diff --git a/lib/Moo/Role.pm b/lib/Moo/Role.pm index fb82079..d84a5fd 100644 --- a/lib/Moo/Role.pm +++ b/lib/Moo/Role.pm @@ -106,6 +106,15 @@ sub create_class_with_roles { $me->_inhale_if_moose($_) for @roles; + my $m; + if ($m = Moo->_accessor_maker_for($superclass) + and ref($m) ne 'Method::Generate::Accessor') { + # old fashioned way time. + *{_getglob("${new_name}::ISA")} = [ $superclass ]; + $me->apply_roles_to_package($new_name, @roles); + return $new_name; + } + require Sub::Quote; $me->SUPER::create_class_with_roles($superclass, @roles);