}
}
-sub get_attribute_values {
- my ($self, $instance) = @_;
-
- return +{
- map { $_->name => $_->get_value($instance) }
- grep { $_->has_value($instance) }
- $self->compute_all_applicable_attributes
- };
-}
-
-sub get_init_args {
- my ($self, $instance) = @_;
-
- return +{
- map { $_->init_arg => $_->get_value($instance) }
- grep { $_->has_value($instance) }
- grep { defined($_->init_arg) }
- $self->compute_all_applicable_attributes
- };
-}
-
# Inheritance
sub superclasses {
=item B<reset_package_cache_flag>
-Clear this flag, used in Moose.
+Clears the package cache flag to announce to the internals that we need
+to rebuild the method map.
=back
=item B<instance_metaclass>
+Returns the class name of the instance metaclass, see L<Class::MOP::Instance>
+for more information on the instance metaclasses.
+
=item B<get_meta_instance>
+Returns an instance of L<Class::MOP::Instance> to be used in the construction
+of a new instance of the class.
+
=item B<new_object (%params)>
This is a convience method for creating a new object of the class, and
$class->meta->new_object(%params);
}
-Of course the ideal place for this would actually be in C<UNIVERSAL::>
-but that is considered bad style, so we do not do that.
-
=item B<construct_instance (%params)>
-This method is used to construct an instace structure suitable for
+This method is used to construct an instance structure suitable for
C<bless>-ing into your package of choice. It works in conjunction
with the Attribute protocol to collect all applicable attributes.
$self->meta->clone_object($self, %params);
}
-Of course the ideal place for this would actually be in C<UNIVERSAL::>
-but that is considered bad style, so we do not do that.
-
=item B<clone_instance($instance, %params)>
This method is a compliment of C<construct_instance> (which means if
think Yuval "nothingmuch" Kogman put it best when he said that cloning
is too I<context-specific> to be part of the MOP.
-=item B<get_attribute_values($instance)>
-
-Returns the values of the C<$instance>'s fields keyed by the attribute names.
-
-=item B<get_init_args($instance)>
-
-Returns a hash reference where the keys are all the attributes' C<init_arg>s
-and the values are the instance's fields. Attributes without an C<init_arg>
-will be skipped.
-
=item B<rebless_instance($instance)>
This will change the class of C<$instance> to the class of the invoking
C<Class::MOP::Class>. You may only rebless the instance to a subclass of
-itself. This limitation may be relaxed in the future.
-
-This can be useful in a number of situations, such as when you are writing
-a program that doesn't know everything at object construction time.
+itself.
=back
relationships of the class the B<Class::MOP::Class> instance is
associated with. Basically, it can get and set the C<@ISA> for you.
-B<NOTE:>
-Perl will occasionally perform some C<@ISA> and method caching, if
-you decide to change your superclass relationship at runtime (which
-is quite insane and very much not recommened), then you should be
-aware of this and the fact that this module does not make any
-attempt to address this issue.
-
=item B<class_precedence_list>
This computes the a list of all the class's ancestors in the same order
-in which method dispatch will be done. This is similair to
-what B<Class::ISA::super_path> does, but we don't remove duplicate names.
+in which method dispatch will be done. This is similair to what
+B<Class::ISA::super_path> does, but we don't remove duplicate names.
=item B<linearized_isa>
=item B<subclasses>
-This returns a list of subclasses for this class.
+This returns a list of subclasses for this class.
=back
=item B<get_method_map>
+Returns a HASH ref of name to CODE reference mapping for this class.
+
=item B<method_metaclass>
+Returns the class name of the method metaclass, see L<Class::MOP::Method>
+for more information on the method metaclasses.
+
=item B<add_method ($method_name, $method)>
This will take a C<$method_name> and CODE reference to that
=item B<attribute_metaclass>
+Returns the class name of the attribute metaclass, see L<Class::MOP::Attribute>
+for more information on the attribute metaclasses.
+
=item B<get_attribute_map>
-=item B<add_attribute ($attribute_meta_object | $attribute_name, %attribute_spec)>
+This returns a HASH ref of name to attribute meta-object mapping.
+
+=item B<add_attribute ($attribute_meta_object | ($attribute_name, %attribute_spec))>
This stores the C<$attribute_meta_object> (or creates one from the
C<$attribute_name> and C<%attribute_spec>) in the B<Class::MOP::Class>