X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FClass%2FMOP%2FClass.pm;h=127b360804b1a07f7a29d3041409b6b019215ab0;hb=127d39a79d936afd136ccfd8ff8271eea2bc0cbb;hp=06d6fcbd054f837122029ab75ceb06a1a9671478;hpb=0ef07b3330be07fa9aa59e3b4980023c14ed0e2f;p=gitmo%2FClass-MOP.git diff --git a/lib/Class/MOP/Class.pm b/lib/Class/MOP/Class.pm index 06d6fcb..127b360 100644 --- a/lib/Class/MOP/Class.pm +++ b/lib/Class/MOP/Class.pm @@ -433,27 +433,6 @@ sub rebless_instance { } } -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 { @@ -1070,7 +1049,8 @@ but in some cases you might want to use it, so it is here. =item B -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 @@ -1083,8 +1063,14 @@ to use them or not. =item B +Returns the class name of the instance metaclass, see L +for more information on the instance metaclasses. + =item B +Returns an instance of L to be used in the construction +of a new instance of the class. + =item B This is a convience method for creating a new object of the class, and @@ -1096,12 +1082,9 @@ would call a C this method like so: $class->meta->new_object(%params); } -Of course the ideal place for this would actually be in C -but that is considered bad style, so we do not do that. - =item B -This method is used to construct an instace structure suitable for +This method is used to construct an instance structure suitable for C-ing into your package of choice. It works in conjunction with the Attribute protocol to collect all applicable attributes. @@ -1125,9 +1108,6 @@ class would call a C this method like so: $self->meta->clone_object($self, %params); } -Of course the ideal place for this would actually be in C -but that is considered bad style, so we do not do that. - =item B This method is a compliment of C (which means if @@ -1146,24 +1126,11 @@ shallow cloning is outside the scope of the meta-object protocol. I think Yuval "nothingmuch" Kogman put it best when he said that cloning is too I to be part of the MOP. -=item B - -Returns the values of the C<$instance>'s fields keyed by the attribute names. - -=item B - -Returns a hash reference where the keys are all the attributes' Cs -and the values are the instance's fields. Attributes without an C -will be skipped. - =item B This will change the class of C<$instance> to the class of the invoking C. 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 @@ -1197,18 +1164,11 @@ This is a read-write attribute which represents the superclass relationships of the class the B instance is associated with. Basically, it can get and set the C<@ISA> for you. -B -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 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 does, but we don't remove duplicate names. +in which method dispatch will be done. This is similair to what +B does, but we don't remove duplicate names. =item B @@ -1217,7 +1177,7 @@ duplicates removed. =item B -This returns a list of subclasses for this class. +This returns a list of subclasses for this class. =back @@ -1227,8 +1187,13 @@ This returns a list of subclasses for this class. =item B +Returns a HASH ref of name to CODE reference mapping for this class. + =item B +Returns the class name of the method metaclass, see L +for more information on the method metaclasses. + =item B This will take a C<$method_name> and CODE reference to that @@ -1441,9 +1406,14 @@ their own. See L for more details. =item B +Returns the class name of the attribute metaclass, see L +for more information on the attribute metaclasses. + =item B -=item B +This returns a HASH ref of name to attribute meta-object mapping. + +=item B This stores the C<$attribute_meta_object> (or creates one from the C<$attribute_name> and C<%attribute_spec>) in the B