NAME
Class::MOP::Immutable - A class to transform Class::MOP::Class metaclasses
SYNOPSIS
use Class::MOP::Immutable;my $immutable_metaclass = Class::MOP::Immutable->new($metaclass, {read_only => [qw/superclasses/],cannot_call => [qw/add_methodalias_methodremove_methodadd_attributeremove_attributeadd_package_symbolremove_package_symbol/],memoize => {class_precedence_list => 'ARRAY',compute_all_applicable_attributes => 'ARRAY',get_meta_instance => 'SCALAR',get_method_map => 'SCALAR',}});$immutable_metaclass->make_metaclass_immutable(@_)
DESCRIPTION
This is basically a module for applying a transformation on a given metaclass. Current features include making methods read-only, making methods un-callable and memoizing methods (in a type specific way too).
This module is not for the feint of heart, it does some whacky things to the metaclass in order to make it immutable. If you are just curious, I suggest you turn back now, there is nothing to see here.
METHODS
- new ($metaclass, \%options)
-
Given a
$metaclassand a set of%optionsthis module will prepare an immutable version of the$metaclass, which can then be applied to the$metaclassusing the"make_metaclass_immutable"method.
- options
-
Returns the options HASH set in
"new".
- metaclass
-
Returns the metaclass set in
"new".
- immutable_metaclass
-
Returns the immutable metaclass created within
"new".
- create_immutable_metaclass
-
This will create the immutable version of the
$metaclass, but will not actually change the original metaclass.
- create_methods_for_immutable_metaclass
-
This will create all the methods for the immutable metaclass based on the
%optionspassed into"new".
- make_metaclass_immutable (%options)
-
This will actually change the
$metaclassinto the immutable version.
- make_metaclass_mutable (%options)
-
This will change the
$metaclassinto the mutable version by reversing the immutable process.%optionsshould be the same options that were given to make_metaclass_immutable.
AUTHORS
Stevan Little <[email protected]>
COPYRIGHT AND LICENSE
Copyright 2006-2008 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.