use Class::MOP::Attribute;
use Class::MOP::Method;
-our $VERSION = '0.21';
+our $VERSION = '0.29_02';
## ----------------------------------------------------------------------------
## Setting up our environment ...
Class::MOP::Class->meta->add_attribute(
Class::MOP::Attribute->new('$:package' => (
- reader => 'name',
+ reader => {
+ # NOTE: we need to do this in order
+ # for the instance meta-object to
+ # not fall into meta-circular death
+ 'name' => sub { (shift)->{'$:package'} }
+ },
init_arg => ':package',
))
);
Class::MOP::Class->meta->add_attribute(
Class::MOP::Attribute->new('%:attributes' => (
- reader => 'get_attribute_map',
+ reader => {
+ # NOTE: we need to do this in order
+ # for the instance meta-object to
+ # not fall into meta-circular death
+ 'get_attribute_map' => sub { (shift)->{'%:attributes'} }
+ },
init_arg => ':attributes',
default => sub { {} }
))
))
);
+Class::MOP::Class->meta->add_attribute(
+ Class::MOP::Attribute->new('$:instance_metaclass' => (
+ reader => {
+ # NOTE: we need to do this in order
+ # for the instance meta-object to
+ # not fall into meta-circular death
+ 'instance_metaclass' => sub { (shift)->{'$:instance_metaclass'} }
+ },
+ init_arg => ':instance_metaclass',
+ default => 'Class::MOP::Instance',
+ ))
+);
+
## Class::MOP::Attribute
Class::MOP::Attribute->meta->add_attribute(
Class::MOP::Attribute->new('name' => (
- reader => 'name'
+ reader => {
+ # NOTE: we need to do this in order
+ # for the instance meta-object to
+ # not fall into meta-circular death
+ 'name' => sub { (shift)->{name} }
+ }
))
);
Class::MOP::Attribute->meta->add_attribute(
Class::MOP::Attribute->new('associated_class' => (
- reader => 'associated_class'
+ reader => {
+ # NOTE: we need to do this in order
+ # for the instance meta-object to
+ # not fall into meta-circular death
+ 'associated_class' => sub { (shift)->{associated_class} }
+ }
))
);
made for these tools to keep to the spirit of the Perl 5 object
system that we all know and love.
+This documentation is admittedly sparse on details, as time permits
+I will try to improve them. For now, I suggest looking at the items
+listed in the L<SEE ALSO> section for more information. In particular
+the book "The Art of the Meta Object Protocol" was very influential
+in the development of this system.
+
=head2 What is a Meta Object Protocol?
A meta object protocol is an API to an object system.
---------------------------- ------ ------ ------ ------ ------ ------ ------
File stmt bran cond sub pod time total
---------------------------- ------ ------ ------ ------ ------ ------ ------
- Class/MOP.pm 100.0 100.0 100.0 100.0 n/a 21.4 100.0
- Class/MOP/Attribute.pm 100.0 100.0 88.9 100.0 100.0 27.1 99.3
- Class/MOP/Class.pm 100.0 100.0 93.7 100.0 100.0 44.8 99.1
- Class/MOP/Method.pm 100.0 100.0 83.3 100.0 100.0 4.8 97.1
- metaclass.pm 100.0 100.0 80.0 100.0 n/a 1.9 97.3
+ Class/MOP.pm 100.0 100.0 100.0 100.0 n/a 24.3 100.0
+ Class/MOP/Attribute.pm 100.0 100.0 91.7 63.6 100.0 9.2 88.8
+ Class/MOP/Class.pm 98.1 91.8 77.3 96.8 100.0 58.3 93.3
+ Class/MOP/Instance.pm 87.5 100.0 0.0 87.5 100.0 5.9 88.0
+ Class/MOP/Method.pm 100.0 64.3 52.9 80.0 100.0 1.4 85.3
+ metaclass.pm 100.0 100.0 83.3 100.0 n/a 0.9 97.7
---------------------------- ------ ------ ------ ------ ------ ------ ------
- Total 100.0 100.0 92.2 100.0 100.0 100.0 99.0
+ Total 97.8 90.1 74.8 82.9 100.0 100.0 91.5
---------------------------- ------ ------ ------ ------ ------ ------ ------
=head1 ACKNOWLEDGEMENTS