use Carp 'confess';
use Scalar::Util 'blessed', 'weaken';
-our $VERSION = '0.78';
+our $VERSION = '0.78_02';
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
sub immutable_transformer { $_[0]->{immutable_transformer} }
sub _set_immutable_transformer { $_[0]->{immutable_transformer} = $_[1] }
+sub make_immutable {
+ my $self = shift;
+
+ return if $self->is_immutable;
+
+ my $transformer = $self->immutable_transformer
+ || $self->_make_immutable_transformer(@_);
+
+ $self->_set_immutable_transformer($transformer);
+
+ $transformer->make_metaclass_immutable;
+}
+
{
my %Default_Immutable_Options = (
read_only => [qw/superclasses/],
cannot_call => [
- qw/
+ qw(
add_method
alias_method
remove_method
add_attribute
remove_attribute
remove_package_symbol
- /
+ )
],
memoize => {
class_precedence_list => 'ARRAY',
},
);
- sub make_immutable {
- my $self = shift;
-
- return if $self->is_immutable;
-
- my $transformer = $self->immutable_transformer
- || Class::MOP::Immutable->new(
- $self,
- %Default_Immutable_Options,
- @_
- );
+ sub _default_immutable_transformer_options {
+ return %Default_Immutable_Options;
+ }
+}
- $self->_set_immutable_transformer($transformer);
+sub _make_immutable_transformer {
+ my $self = shift;
- $transformer->make_metaclass_immutable;
- }
+ Class::MOP::Immutable->new(
+ $self,
+ $self->_default_immutable_transformer_options,
+ @_
+ );
}
sub make_mutable {
=head1 DESCRIPTION
-This is the largest and most complex part of the Class::MOP
-meta-object protocol. It controls the introspection and manipulation
-of Perl 5 classes, and it can create them as wlel. The best way to
-understand what this module can do, is to read the documentation for
-each of its methods.
+The Class Protocol is the largest and most complex part of the
+Class::MOP meta-object protocol. It controls the introspection and
+manipulation of Perl 5 classes, and it can create them as well. The
+best way to understand what this module can do, is to read the
+documentation for each of its methods.
=head1 INHERITANCE
This method clones an existing object instance. Any parameters you
provide are will override existing attribute values in the object.
-This is a convience method for cloning an object instance, then
+This is a convenience method for cloning an object instance, then
blessing it into the appropriate package.
You could implement a clone method in your class, using this method:
Returns the class name of the instance metaclass, see
L<Class::MOP::Instance> for more information on the instance
-metaclasses.
+metaclass.
=item B<< $metaclass->get_meta_instance >>
Remove the named method from the class. This method returns the
L<Class::MOP::Method> object for the method.
+=item B<< $metaclass->method_metaclass >>
+
+Returns the class name of the method metaclass, see
+L<Class::MOP::Method> for more information on the method metaclass.
+
+=item B<< $metaclass->wrapped_method_metaclass >>
+
+Returns the class name of the wrapped method metaclass, see
+L<Class::MOP::Method::Wrapped> for more information on the wrapped
+method metaclass.
+
=back
=head2 Attribute introspection and creation
longer call methods which alter the class, such as adding or removing
methods or attributes.
-Making a class immutable lets us optimize the class by inlning some
+Making a class immutable lets us optimize the class by inlining some
methods, and also allows us to optimize some methods on the metaclass
object itself.
Method modifiers work by wrapping the original method and then
replacing it in the class's symbol table. The wrappers will handle
-calling all the modifiers in the appropariate orders and preserving
-the calling context for the original method.
+calling all the modifiers in the appropriate order and preserving the
+calling context for the original method.
The return values of C<before> and C<after> modifiers are
ignored. This is because their purpose is B<not> to filter the input
=back
+=head2 Introspection
+
+=over 4
+
+=item B<< Class::MOP::Class->meta >>
+
+This will return a L<Class::MOP::Class> instance for this class.
+
+It should also be noted that L<Class::MOP> will actually bootstrap
+this module by installing a number of attribute meta-objects into its
+metaclass.
+
+=back
+
=head1 AUTHORS
Stevan Little E<lt>stevan@iinteractive.comE<gt>