use base 'Class::MOP::Class';
+# enforce the meta-circularity here
+# and hide the Immutable part
+
+sub meta {
+ my $self = shift;
+ # if it is not blessed, then someone is asking
+ # for the meta of Class::MOP::Class::Immutable
+ return Class::MOP::Class->initialize($self) unless blessed($self);
+ # otherwise, they are asking for the metaclass
+ # which has been made immutable, which is itself
+ return $self;
+}
+
# methods which can *not* be called
for my $meth (qw(
add_method
use strict;
use warnings;
-use Test::More tests => 19;
+use Test::More tests => 22;
BEGIN {
use_ok('Class::MOP');
"Class::MOP::Package-" . $Class::MOP::Package::VERSION . "-cpan:STEVAN",
],
'... got all the metaclass identifiers');
-
-
+
+# testing the meta-circularity of the system
+
+is(Class::MOP::Class->meta, Class::MOP::Class->meta->meta,
+ '... Class::MOP::Class->meta == Class::MOP::Class->meta->meta');
+
+is(Class::MOP::Class->meta, Class::MOP::Class->meta->meta->meta,
+ '... Class::MOP::Class->meta == Class::MOP::Class->meta->meta->meta');
+
+is(Class::MOP::Class->meta, Class::MOP::Class->meta->meta->meta->meta,
+ '... Class::MOP::Class->meta == Class::MOP::Class->meta->meta->meta->meta');
+
+
+