our $VERSION = '0.15';
+use base 'Class::MOP::Module';
+
use Class::MOP::Instance;
# Self-introspection
=back
+=head2 Methods which will die if you touch them.
+
+=over 4
+
+=item B<add_attribute>
+
+=item B<add_method>
+
+=item B<add_package_variable>
+
+=item B<alias_method>
+
+=item B<reinitialize>
+
+=item B<remove_attribute>
+
+=item B<remove_method>
+
+=item B<remove_package_variable>
+
+=item B<superclasses>
+
+=back
+
+=head2 Cached methods
+
=over 4
+=item B<class_precedence_list>
+
+=item B<compute_all_applicable_attributes>
+
+=item B<get_meta_instance>
+
+=back
+
+=head2 Introspection and Construction
+
+=over 4
+
+=item B<is_immutable>
+
+=item B<is_mutable>
+
+=item B<make_immutable>
+
+=item B<make_metaclass_immutable>
=back
--- /dev/null
+
+package Class::MOP::Module;
+
+use strict;
+use warnings;
+
+use Scalar::Util 'blessed';
+
+our $VERSION = '0.01';
+
+use base 'Class::MOP::Package';
+
+# introspection
+
+sub meta {
+ require Class::MOP::Class;
+ Class::MOP::Class->initialize(blessed($_[0]) || $_[0]);
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Class::MOP::Module - Module Meta Object
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+=head1 METHODS
+
+=over 4
+
+=item B<meta>
+
+=back
+
+=head1 AUTHOR
+
+Stevan Little E<lt>stevan@iinteractive.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2006 by Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
\ No newline at end of file
--- /dev/null
+
+package Class::MOP::Package;
+
+use strict;
+use warnings;
+
+use Scalar::Util 'blessed';
+
+our $VERSION = '0.01';
+
+# introspection
+
+sub meta {
+ require Class::MOP::Class;
+ Class::MOP::Class->initialize(blessed($_[0]) || $_[0]);
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Class::MOP::Package - Package Meta Object
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+=head1 METHODS
+
+=over 4
+
+=item B<meta>
+
+=back
+
+=head1 AUTHOR
+
+Stevan Little E<lt>stevan@iinteractive.comE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2006 by Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
\ No newline at end of file
my %METAS = (
'Class::MOP::Attribute' => Class::MOP::Attribute->meta,
+ 'Class::MOP::Package' => Class::MOP::Package->meta,
+ 'Class::MOP::Module' => Class::MOP::Module->meta,
'Class::MOP::Class' => Class::MOP::Class->meta,
'Class::MOP::Method' => Class::MOP::Method->meta,
- 'Class::MOP::Instance' => Class::MOP::Instance->meta
+ 'Class::MOP::Instance' => Class::MOP::Instance->meta,
);
is_deeply(
is_deeply(
[ sort { $a->name cmp $b->name } Class::MOP::Class->get_all_metaclass_instances ],
- [ Class::MOP::Attribute->meta, Class::MOP::Class->meta, Class::MOP::Instance->meta, Class::MOP::Method->meta ],
+ [
+ Class::MOP::Attribute->meta,
+ Class::MOP::Class->meta,
+ Class::MOP::Instance->meta,
+ Class::MOP::Method->meta,
+ Class::MOP::Module->meta,
+ Class::MOP::Package->meta,
+ ],
'... got all the metaclass instances');
is_deeply(
[ sort Class::MOP::Class->get_all_metaclass_names ],
- [ 'Class::MOP::Attribute', 'Class::MOP::Class', 'Class::MOP::Instance', 'Class::MOP::Method' ],
+ [ qw/
+ Class::MOP::Attribute
+ Class::MOP::Class
+ Class::MOP::Instance
+ Class::MOP::Method
+ Class::MOP::Module
+ Class::MOP::Package
+ / ],
'... got all the metaclass names');
\ No newline at end of file
use strict;
use warnings;
-use Test::More tests => 152;
+use Test::More tests => 153;
use Test::Exception;
BEGIN {
is_deeply(
[ $meta->superclasses ],
- [],
- '... Class::MOP::Class->superclasses == []');
+ [ qw/Class::MOP::Module/ ],
+ '... Class::MOP::Class->superclasses == [ Class::MOP::Module ]');
is_deeply(
[ $meta->class_precedence_list ],
- [ 'Class::MOP::Class' ],
- '... Class::MOP::Class->class_precedence_list == []');
+ [ qw/
+ Class::MOP::Class
+ Class::MOP::Module
+ Class::MOP::Package
+ / ],
+ '... Class::MOP::Class->class_precedence_list == [ Class::MOP::Class Class::MOP::Module Class::MOP::Package ]');
is($meta->attribute_metaclass, 'Class::MOP::Attribute', '... got the right value for attribute_metaclass');
is($meta->method_metaclass, 'Class::MOP::Method', '... got the right value for method_metaclass');
+is($meta->instance_metaclass, 'Class::MOP::Instance', '... got the right value for instance_metaclass');