X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FClass.pm;h=dc638df99d5fd39e7449b1d8fb05971ce7fa7fb1;hb=8cf6cb3babb16036cf993765f283ef71295b8917;hp=be957020151edfcc50bd9fb6c4d8e5686d698933;hpb=7778ab1ec4652cd0c12f7004ad300cf714a334f0;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index be95702..dc638df 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -78,9 +78,7 @@ sub verify_superclass { # The metaclass of $super is not initialized. # i.e. it might be Mouse::Object, a mixin package (e.g. Exporter), # or a foreign class including Moose classes. - - # checks if $super is a foreign class (i.e. non-Mouse class) - # see also Mouse::Foreign::Meta::Role::Class + # See also Mouse::Foreign::Meta::Role::Class. my $mm = $super->can('meta'); if(!($mm && $mm == \&Mouse::Util::meta)) { if($super->can('new') or $super->can('DESTROY')) { @@ -95,9 +93,11 @@ sub verify_superclass { sub inherit_from_foreign_class { my($class, $super) = @_; - Carp::carp("You inherit from non-Mouse class ($super)," - . " but it is unlikely to work correctly." - . " Please consider using MouseX::Foreign"); + if($ENV{PERL_MOUSE_STRICT}) { + Carp::carp("You inherit from non-Mouse class ($super)," + . " but it is unlikely to work correctly." + . " Please consider using MouseX::Foreign"); + } return; } @@ -243,7 +243,7 @@ sub add_attribute { # then register the attribute to the metaclass $attr->{insertion_order} = keys %{ $self->{attributes} }; $self->{attributes}{$name} = $attr; - delete $self->{_mouse_cache}; # clears internal cache + $self->_invalidate_metaclass_cache(); if(!$attr->{associated_methods} && ($attr->{is} || '') ne 'bare'){ Carp::carp(qq{Attribute ($name) of class }.$self->name @@ -415,8 +415,7 @@ sub add_override_method_modifier { local $Mouse::SUPER_PACKAGE = $package; local $Mouse::SUPER_BODY = $super_body; local @Mouse::SUPER_ARGS = @_; - - $code->(@_); + &{$code}; }); return; } @@ -433,10 +432,10 @@ sub add_augment_method_modifier { my $super_package = $super->package_name; my $super_body = $super->body; - $self->add_method($name => sub{ + $self->add_method($name => sub { local $Mouse::INNER_BODY{$super_package} = $code; local $Mouse::INNER_ARGS{$super_package} = [@_]; - $super_body->(@_); + &{$super_body}; }); return; } @@ -471,7 +470,7 @@ Mouse::Meta::Class - The Mouse class metaclass =head1 VERSION -This document describes Mouse version 0.76 +This document describes Mouse version 0.91 =head1 DESCRIPTION