X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FRole.pm;h=19c2a4e814ec04ea965abbfaee992073de84f242;hb=c9d7e3969b1695246e82f8d4260222216d2aa722;hp=0052bd5e3068c948d96cf2a88906d39f08205224;hpb=b3c1586ae5e5d03d44318910f9ef7e0c0b20da57;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index 0052bd5..19c2a4e 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', @@ -125,6 +124,12 @@ $META->add_attribute( default => 'Moose::Meta::Role::Method', ); +$META->add_attribute( + 'required_method_metaclass', + reader => 'required_method_metaclass', + default => 'Moose::Meta::Role::Method::Required', +); + ## some things don't always fit, so they go here ... sub add_attribute { @@ -144,6 +149,20 @@ sub add_attribute { $self->get_attribute_map->{$name} = $attr_desc; } +sub add_required_methods { + my $self = shift; + + for (@_) { + my $method = $_; + if (!blessed($method)) { + $method = $self->required_method_metaclass->new( + name => $method, + ); + } + $self->get_required_methods_map->{$method->name} = $method; + } +} + ## ------------------------------------------------------------------ ## method modifiers