X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FRole%2FApplication%2FToRole.pm;h=49ca840d3ccbfb691f8f6bdd33f1615a83c67e89;hb=8de5717850eb1f406e5f71d2ccfac33c72cc490b;hp=d0ecdb1ecd6311804b21b5f75cc64de02ccbac3d;hpb=4c93bc92c088d7ae95e3ab597a4a01b133de763f;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Role/Application/ToRole.pm b/lib/Moose/Meta/Role/Application/ToRole.pm index d0ecdb1..49ca840 100644 --- a/lib/Moose/Meta/Role/Application/ToRole.pm +++ b/lib/Moose/Meta/Role/Application/ToRole.pm @@ -6,7 +6,7 @@ use metaclass; use Scalar::Util 'blessed'; -our $VERSION = '0.79'; +our $VERSION = '0.92'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -73,12 +73,32 @@ sub apply_attributes { sub apply_methods { my ($self, $role1, $role2) = @_; foreach my $method_name ($role1->get_method_list) { + next if $method_name eq 'meta'; + + unless ( $self->is_method_excluded($method_name) ) { + if ( $role2->has_method($method_name) + && $role2->get_method($method_name)->body + != $role1->get_method($method_name)->body ) { + + # method conflicts between roles result in the method becoming + # a requirement + $role2->add_conflicting_method( + name => $method_name, + roles => [ $role1->name, $role2->name ], + ); + } + else { + $role2->add_method( + $method_name, + $role1->get_method($method_name) + ); + } + } if ($self->is_method_aliased($method_name)) { my $aliased_method_name = $self->get_method_aliases->{$method_name}; - # it if it has one already + if ($role2->has_method($aliased_method_name) && - # and if they are not the same thing ... $role2->get_method($aliased_method_name)->body != $role1->get_method($method_name)->body) { require Moose; @@ -94,29 +114,7 @@ sub apply_methods { $role2->add_required_methods($method_name) unless $self->is_method_excluded($method_name); } - - next; - } - - next if $self->is_method_excluded($method_name); - - # it if it has one already - if ($role2->has_method($method_name) && - # and if they are not the same thing ... - $role2->get_method($method_name)->body != $role1->get_method($method_name)->body) { - # method conflicts between roles result - # in the method becoming a requirement - $role2->add_required_methods($method_name); - } - else { - # add it, although it could be overridden - $role2->add_method( - $method_name, - $role1->get_method($method_name) - ); - } - } }