From: Stevan Little Date: Tue, 26 Feb 2008 15:42:39 +0000 (+0000) Subject: ovidsbug X-Git-Tag: 0_55~292 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9c10b5ad9c24b7d09982daa5e07cf009222049cf;p=gitmo%2FMoose.git ovidsbug --- diff --git a/Changes b/Changes index a14b044..29d8b9b 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,12 @@ Revision history for Perl extension Moose that come from recently composed roles. It makes sense, people are using it, and so why not just officially support it. + - fixing the 'extends' keyword so that it will not + trigger Ovid's bug (http://use.perl.org/~Ovid/journal/35763) + + * Moose::Util + - fixing the 'apply_all_roles' keyword so that it will not + trigger Ovid's bug (http://use.perl.org/~Ovid/journal/35763) * t/ - making test for using '+name' on attributes consumed diff --git a/lib/Moose.pm b/lib/Moose.pm index 1fe7548..0b49926 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -82,13 +82,17 @@ use Moose::Util (); my $class = $CALLER; return subname 'Moose::extends' => sub (@) { confess "Must derive at least one class" unless @_; - Class::MOP::load_class($_) for @_; + + my @supers = @_; + foreach my $super (@supers) { + Class::MOP::load_class($super); + } # this checks the metaclass to make sure # it is correct, sometimes it can get out # of sync when the classes are being built - my $meta = $class->meta->_fix_metaclass_incompatability(@_); - $meta->superclasses(@_); + my $meta = $class->meta->_fix_metaclass_incompatability(@supers); + $meta->superclasses(@supers); }; }, with => sub { diff --git a/lib/Moose/Meta/Instance.pm b/lib/Moose/Meta/Instance.pm index 0e9baac..addaa97 100644 --- a/lib/Moose/Meta/Instance.pm +++ b/lib/Moose/Meta/Instance.pm @@ -30,8 +30,8 @@ This class provides the low level data storage abstractions for attributes. Using this API generally violates attribute encapsulation and is not reccomended, instead look at L, L, etc, as well as L -for the reccomended way to fiddle with attribute values in a generic way, -independant of how/whether accessors have been defined. Accessors can be found +for the recommended way to fiddle with attribute values in a generic way, +independent of how/whether accessors have been defined. Accessors can be found using L. See the L docs for details on the instance protocol. diff --git a/lib/Moose/Util.pm b/lib/Moose/Util.pm index 466e2aa..5d1ba37 100644 --- a/lib/Moose/Util.pm +++ b/lib/Moose/Util.pm @@ -8,7 +8,7 @@ use Scalar::Util 'blessed'; use Carp 'confess'; use Class::MOP (); -our $VERSION = '0.03'; +our $VERSION = '0.04'; our $AUTHORITY = 'cpan:STEVAN'; my @exports = qw[ @@ -78,7 +78,9 @@ sub apply_all_roles { my $meta = (blessed $applicant ? $applicant : find_meta($applicant)); - Class::MOP::load_class($_->[0]) for @$roles; + foreach my $role_spec (@$roles) { + Class::MOP::load_class($role_spec->[0]); + } ($_->[0]->can('meta') && $_->[0]->meta->isa('Moose::Meta::Role')) || confess "You can only consume roles, " . $_->[0] . " is not a Moose role"