lazy attr bug found by ashley
[gitmo/Moose.git] / lib / Moose / Meta / Role.pm
index 51628ac..5066f06 100644 (file)
@@ -149,26 +149,29 @@ sub _clean_up_required_methods {
 ## methods
 
 # FIXME:
+# this is an UGLY hack
+sub get_method_map {    
+    my $self = shift;
+    $self->{'%:methods'} ||= {}; 
+    $self->Moose::Meta::Class::get_method_map() 
+}
+
+# FIXME:
 # Yes, this is a really really UGLY hack
 # but it works, and until I can figure 
 # out a better way, this is gonna be it. 
 
 sub get_method          { (shift)->Moose::Meta::Class::get_method(@_)          }
-sub find_method_by_name { (shift)->Moose::Meta::Class::find_method_by_name(@_) }
 sub has_method          { (shift)->Moose::Meta::Class::has_method(@_)          }
 sub alias_method        { (shift)->Moose::Meta::Class::alias_method(@_)        }
-sub get_method_list { 
-    my ($self) = @_;
-    grep { 
-        # NOTE:
-        # this is a kludge for now,... these functions 
-        # should not be showing up in the list at all, 
-        # but they do, so we need to switch Moose::Role
-        # and Moose to use Sub::Exporter to prevent this
-        !/^(meta|has|extends|blessed|confess|augment|inner|override|super|before|after|around|with|requires)$/ 
-    } $self->Moose::Meta::Class::get_method_list;
+sub get_method_list     { 
+    grep {
+        !/^meta$/
+    } (shift)->Moose::Meta::Class::get_method_list(@_)     
 }
 
+sub find_method_by_name { (shift)->has_method(@_) }
+
 # ... however the items in statis (attributes & method modifiers)
 # can be removed and added to through this API
 
@@ -376,7 +379,7 @@ sub _apply_methods {
         # it if it has one already
         if ($other->has_method($method_name) &&
             # and if they are not the same thing ...
-            $other->get_method($method_name) != $self->get_method($method_name)) {
+            $other->get_method($method_name)->body != $self->get_method($method_name)->body) {
             # see if we are composing into a role
             if ($other->isa('Moose::Meta::Role')) { 
                 # method conflicts between roles result 
@@ -625,6 +628,8 @@ probably not that much really).
 
 =item B<get_method_list>
 
+=item B<get_method_map>
+
 =back
 
 =over 4