From: Matt S Trout Date: Mon, 7 May 2012 16:52:46 +0000 (+0000) Subject: guard _accessor_maker_for calls in Moo::Role in case Moo isn't loaded X-Git-Tag: v0.091004~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e9290d4adfad8f03a2c21e3802535b3550fda74b;p=gitmo%2FMoo.git guard _accessor_maker_for calls in Moo::Role in case Moo isn't loaded --- diff --git a/Changes b/Changes index 4db316f..d335661 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ + - guard _accessor_maker_for calls in Moo::Role in case Moo isn't loaded + - reset handlemoose state on mutation in case somebody reified the + metaclass too early + 0.091003 - 2012-05-06 - improve attribute option documentation - update the incompatibilities section since we're less incompatible now diff --git a/lib/Moo/Role.pm b/lib/Moo/Role.pm index ff147d4..4227034 100644 --- a/lib/Moo/Role.pm +++ b/lib/Moo/Role.pm @@ -99,7 +99,8 @@ sub _maybe_make_accessors { my ($self, $role, $target) = @_; my $m; if ($INFO{$role}{inhaled_from_moose} - or $m = Moo->_accessor_maker_for($target) + or $INC{"Moo.pm"} + and $m = Moo->_accessor_maker_for($target) and ref($m) ne 'Method::Generate::Accessor') { $self->_make_accessors($role, $target); } @@ -155,7 +156,8 @@ sub create_class_with_roles { $me->_inhale_if_moose($_) for @roles; my $m; - if ($m = Moo->_accessor_maker_for($superclass) + if ($INC{"Moo.pm"} + and $m = Moo->_accessor_maker_for($superclass) and ref($m) ne 'Method::Generate::Accessor') { # old fashioned way time. *{_getglob("${new_name}::ISA")} = [ $superclass ];