From: Dave Rolsky Date: Tue, 30 Jun 2009 20:01:16 +0000 (-0500) Subject: The immutable class's metaclass should be an object of the mutable X-Git-Tag: 0.89~11 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a986e165da3f72e1fe7a4dfed9bb392a968afa39;p=gitmo%2FClass-MOP.git The immutable class's metaclass should be an object of the mutable class's metaclass. Wrap _immutable_metaclass in the trait for the sake of the tests (not sure if the test is valid, but whatever). --- diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 6a464c8..2a6f01c 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -1098,7 +1098,7 @@ sub _immutable_metaclass { return $class_name if Class::MOP::is_class_loaded($class_name); - my $meta = Class::MOP::Class->create( + my $meta = (ref $self)->create( $class_name, superclasses => [ ref $self ], ); diff --git a/lib/Class/MOP/Class/Immutable/Trait.pm b/lib/Class/MOP/Class/Immutable/Trait.pm index 0c8a505..038e5d2 100644 --- a/lib/Class/MOP/Class/Immutable/Trait.pm +++ b/lib/Class/MOP/Class/Immutable/Trait.pm @@ -20,6 +20,8 @@ sub immutable_options { %{ $_[0]{__immutable}{options} } } sub is_mutable { 0 } sub is_immutable { 1 } +sub _immutable_metaclass { ref $_[1] } + sub superclasses { my $orig = shift; my $self = shift;