From: Graham Knop Date: Thu, 21 Feb 2013 12:20:55 +0000 (-0500) Subject: move moose method registration after attribute registration X-Git-Tag: v1.001000~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c77791832473ac06c9114fd4dc620b07f8c1712f;p=gitmo%2FMoo.git move moose method registration after attribute registration --- diff --git a/lib/Moo/HandleMoose.pm b/lib/Moo/HandleMoose.pm index c7c29f0..2b861ee 100644 --- a/lib/Moo/HandleMoose.pm +++ b/lib/Moo/HandleMoose.pm @@ -75,10 +75,6 @@ sub inject_real_metaclass_for { my %methods = %{Role::Tiny->_concrete_methods_of($name)}; - while (my ($meth_name, $meth_code) = each %methods) { - $meta->add_method($meth_name, $meth_code) if $meth_code; - } - # if stuff gets added afterwards, _maybe_reset_handlemoose should # trigger the recreation of the metaclass but we need to ensure the # Role::Tiny cache is cleared so we don't confuse Moo itself. @@ -144,6 +140,10 @@ sub inject_real_metaclass_for { } } } + while (my ($meth_name, $meth_code) = each %methods) { + $meta->add_method($meth_name, $meth_code) if $meth_code; + } + if ($am_role) { my $info = $Moo::Role::INFO{$name}; $meta->add_required_methods(@{$info->{requires}});