X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FRole.pm;h=c35f7cd08a79e9079555669663394f22b7c25173;hb=c350159ff34283e00527a23b36177482962d8d82;hp=fbe94243fbe5a2e66309b81d1d4ea5aa09304b74;hpb=8ee73eeb7e76858f1dbe56f69101a2dc1e096559;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Role.pm b/lib/Moose/Meta/Role.pm index fbe9424..c35f7cd 100644 --- a/lib/Moose/Meta/Role.pm +++ b/lib/Moose/Meta/Role.pm @@ -9,9 +9,11 @@ use Carp 'confess'; use Scalar::Util 'blessed'; use B 'svref_2object'; -our $VERSION = '0.05'; +our $VERSION = '0.07'; +our $AUTHORITY = 'cpan:STEVAN'; use Moose::Meta::Class; +use Moose::Meta::Role::Method; use base 'Class::MOP::Module'; @@ -152,7 +154,7 @@ sub _clean_up_required_methods { # this is an UGLY hack sub get_method_map { my $self = shift; - $self->{'%:methods'} ||= {}; + $self->{'%!methods'} ||= {}; $self->Moose::Meta::Class::get_method_map() } @@ -326,7 +328,7 @@ sub _check_required_methods { my $method = $other->get_method($required_method_name); # check if it is an override or a generated accessor .. (!$method->isa('Moose::Meta::Method::Overriden') && - !$method->isa('Class::MOP::Attribute::Accessor')) + !$method->isa('Class::MOP::Method::Accessor')) || confess "'" . $self->name . "' requires the method '$required_method_name' " . "to be implemented by '" . $other->name . "', the method is only a method modifier"; # before/after/around methods are a little trickier @@ -365,10 +367,20 @@ sub _apply_attributes { } } else { - $other->add_attribute( - $attribute_name, - $self->get_attribute($attribute_name) - ); + # NOTE: + # this is kinda ugly ... + if ($other->isa('Moose::Meta::Class')) { + $other->_process_attribute( + $attribute_name, + %{$self->get_attribute($attribute_name)} + ); + } + else { + $other->add_attribute( + $attribute_name, + $self->get_attribute($attribute_name) + ); + } } } } @@ -540,15 +552,6 @@ sub combine { return $combined; } -package Moose::Meta::Role::Method; - -use strict; -use warnings; - -our $VERSION = '0.01'; - -use base 'Class::MOP::Method'; - 1; __END__ @@ -561,9 +564,9 @@ Moose::Meta::Role - The Moose Role metaclass =head1 DESCRIPTION -Moose's Roles are being actively developed, please see L -for more information. For the most part, this has no user-serviceable -parts inside. It's API is still subject to some change (although +Please see L for more information about roles. +For the most part, this has no user-serviceable parts inside +this module. It's API is still subject to some change (although probably not that much really). =head1 METHODS @@ -724,7 +727,7 @@ Stevan Little Estevan@iinteractive.comE =head1 COPYRIGHT AND LICENSE -Copyright 2006 by Infinity Interactive, Inc. +Copyright 2006, 2007 by Infinity Interactive, Inc. L