Class::MOP::Instance - Instance Meta Object # for the most part, this protocol is internal # and not for public usage, but this how one # might use it package Foo; use strict; use warnings; use metaclass ( ':instance_metaclass' => 'ArrayBasedStorage::Instance', ); # now Foo->new produces blessed ARRAY ref based objects This is a sub-protocol which governs instance creation and access to the slots of the instance structure. This may seem like over-abstraction, but by abstracting this process into a sub-protocol we make it possible to easily switch the details of how an object's instance is stored with minimal impact. In most cases just subclassing this class will be all you need to do (see the examples; examples/ArrayBasedStorage.pod and examples/InsideOutClass.pod for details). Creates a new instance meta-object and gathers all the slots from the list of @attrs given. This will return a Class::MOP::Class instance which is related to this class.

Creation of Instances
This creates the appropriate structure needed for the instance and then calls "bless_instance_structure" to bless it into the class. This does just exactly what it says it does.

Instrospection
NOTE: There might be more methods added to this part of the API, we will add then when we need them basically. This will return the current list of slots based on what was given to this object in "new".

Operations on Instance Structures
An important distinction of this sub-protocol is that the instance meta-object is a different entity from the actual instance it creates. For this reason, any actions on slots require that the $instance_structure is passed into them.

Inlineable Instance Operations
This part of the API is currently un-used. It is there for use in future experiments in class finailization mostly. Best to ignore this for now. Each meta-instance should override this method to tell Class::MOP if it's possible to inline the slot access. This is currently only used by Class::MOP::Class::Immutable when performing optimizations. Yuval Kogman <nothingmuch@woobling.com> Stevan Little <stevan@iinteractive.com> Copyright 2006, 2007 by Infinity Interactive, Inc. <http://www.iinteractive.com> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.