[Moose-commits] r7256 - in
Class-MOP/branches/meta-independence/lib/Class: . MOP
sartak at code2.0beta.co.uk
sartak at code2.0beta.co.uk
Wed Jan 7 15:18:20 GMT 2009
Author: sartak
Date: 2009-01-07 07:18:20 -0800 (Wed, 07 Jan 2009)
New Revision: 7256
Modified:
Class-MOP/branches/meta-independence/lib/Class/MOP.pm
Class-MOP/branches/meta-independence/lib/Class/MOP/Class.pm
Class-MOP/branches/meta-independence/lib/Class/MOP/Immutable.pm
Class-MOP/branches/meta-independence/lib/Class/MOP/Object.pm
Log:
Replaces $thing->meta with Class::MOP::get_meta($thing)
Modified: Class-MOP/branches/meta-independence/lib/Class/MOP/Class.pm
===================================================================
--- Class-MOP/branches/meta-independence/lib/Class/MOP/Class.pm 2009-01-07 15:04:54 UTC (rev 7255)
+++ Class-MOP/branches/meta-independence/lib/Class/MOP/Class.pm 2009-01-07 15:18:20 UTC (rev 7256)
@@ -81,7 +81,7 @@
# 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 @@
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));
Modified: Class-MOP/branches/meta-independence/lib/Class/MOP/Immutable.pm
===================================================================
--- Class-MOP/branches/meta-independence/lib/Class/MOP/Immutable.pm 2009-01-07 15:04:54 UTC (rev 7255)
+++ Class-MOP/branches/meta-independence/lib/Class/MOP/Immutable.pm 2009-01-07 15:18:20 UTC (rev 7256)
@@ -89,7 +89,7 @@
# 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 @@
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'} };
Modified: Class-MOP/branches/meta-independence/lib/Class/MOP/Object.pm
===================================================================
--- Class-MOP/branches/meta-independence/lib/Class/MOP/Object.pm 2009-01-07 15:04:54 UTC (rev 7255)
+++ Class-MOP/branches/meta-independence/lib/Class/MOP/Object.pm 2009-01-07 15:18:20 UTC (rev 7256)
@@ -18,7 +18,7 @@
}
sub _new {
- shift->meta->new_object(@_);
+ Class::MOP::get_meta(shift)->new_object(@_);
}
# RANT:
Modified: Class-MOP/branches/meta-independence/lib/Class/MOP.pm
===================================================================
--- Class-MOP/branches/meta-independence/lib/Class/MOP.pm 2009-01-07 15:04:54 UTC (rev 7255)
+++ Class-MOP/branches/meta-independence/lib/Class/MOP.pm 2009-01-07 15:18:20 UTC (rev 7256)
@@ -501,7 +501,7 @@
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_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;
});
More information about the Moose-commits
mailing list