Have add_required_methods inflate the required methods
Shawn M Moore [Sat, 30 May 2009 19:06:16 +0000 (15:06 -0400)]
lib/Moose/Meta/Role.pm

index 7c69995..9f97f50 100644 (file)
@@ -65,7 +65,6 @@ foreach my $action (
         name        => 'required_methods',
         attr_reader => 'get_required_methods_map',
         methods     => {
-            add       => 'add_required_methods',
             remove    => 'remove_required_methods',
             get_list  => 'get_required_method_list',
             existence => 'requires_method',
@@ -150,6 +149,20 @@ sub add_attribute {
     $self->get_attribute_map->{$name} = $attr_desc;
 }
 
+sub add_required_methods {
+    my $self = shift;
+
+    for (@_) {
+        my $method = $_;
+        if (!ref($method)) {
+            $method = $self->required_method_metaclass->new(
+                name => $method,
+            );
+        }
+        $self->get_required_methods_map->{$method->name} = $method;
+    }
+}
+
 ## ------------------------------------------------------------------
 ## method modifiers