From: Shawn M Moore Date: Wed, 7 Jan 2009 15:18:20 +0000 (+0000) Subject: Replaces $thing->meta with Class::MOP::get_meta($thing) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=16e87cbbb23533037cb40e36df89afbed73d3ce3;p=gitmo%2FClass-MOP.git Replaces $thing->meta with Class::MOP::get_meta($thing) --- diff --git a/lib/Class/MOP.pm b/lib/Class/MOP.pm index f20e440..659a949 100644 --- a/lib/Class/MOP.pm +++ b/lib/Class/MOP.pm @@ -501,7 +501,7 @@ Class::MOP::Attribute->meta->add_attribute( Class::MOP::Attribute->meta->add_method('clone' => sub { my $self = shift; - $self->meta->clone_object($self, @_); + Class::MOP::get_meta($self)->clone_object($self, @_); }); ## -------------------------------------------------------- @@ -539,7 +539,7 @@ Class::MOP::Method->meta->add_attribute( Class::MOP::Method->meta->add_method('clone' => sub { my $self = shift; - my $clone = $self->meta->clone_object($self, @_); + my $clone = Class::MOP::get_meta($self)->clone_object($self, @_); $clone->_set_original_method($self); return $clone; }); diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 6157947..1ab4f64 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -81,7 +81,7 @@ sub construct_class_instance { # it is safe to use meta here because # class will always be a subclass of # Class::MOP::Class, which defines meta - $meta = $class->meta->construct_instance($options) + $meta = $class->meta->construct_instance($options); } # and check the metaclass compatibility @@ -455,9 +455,9 @@ sub rebless_instance { my $old_metaclass; if ($instance->can('meta')) { - ($instance->meta->isa('Class::MOP::Class')) - || confess 'Cannot rebless instance if ->meta is not an instance of Class::MOP::Class'; - $old_metaclass = $instance->meta; + $old_metaclass = Class::MOP::get_meta($instance); + ($old_metaclass->isa('Class::MOP::Class')) + || confess 'Cannot rebless instance if the metaclass is not an instance of Class::MOP::Class'; } else { $old_metaclass = $self->initialize(ref($instance)); diff --git a/lib/Class/MOP/Immutable.pm b/lib/Class/MOP/Immutable.pm index 0861575..398e5e8 100644 --- a/lib/Class/MOP/Immutable.pm +++ b/lib/Class/MOP/Immutable.pm @@ -89,7 +89,7 @@ my %DEFAULT_METHODS = ( # that has been made immutable and for that we need # to dig a bit ... if ($self->isa('Class::MOP::Class')) { - return $self->{'___original_class'}->meta; + return Class::MOP::get_meta($self->{'___original_class'}); } else { return $self; @@ -206,7 +206,7 @@ sub create_methods_for_immutable_metaclass { my %methods = %DEFAULT_METHODS; my $metaclass = $self->metaclass; - my $meta = $metaclass->meta; + my $meta = Class::MOP::get_meta($metaclass); $methods{get_mutable_metaclass_name} = sub { (shift)->{'___original_class'} }; diff --git a/lib/Class/MOP/Object.pm b/lib/Class/MOP/Object.pm index 029f342..0c29263 100644 --- a/lib/Class/MOP/Object.pm +++ b/lib/Class/MOP/Object.pm @@ -18,7 +18,7 @@ sub meta { } sub _new { - shift->meta->new_object(@_); + Class::MOP::get_meta(shift)->new_object(@_); } # RANT: