From: Shawn M Moore Date: Sat, 30 May 2009 19:06:16 +0000 (-0400) Subject: Have add_required_methods inflate the required methods X-Git-Tag: 0.80~49 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=16d721b3957c6f98f23201963a309d50efd1a87c;p=gitmo%2FMoose.git Have add_required_methods inflate the required methods --- diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index 7c69995..9f97f50 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -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