Class::MethodCache - Manipulate Perl's method resolution cache
use Class::MethodCache;
Sets the CV slot of the glob to $coderef, and sets the cvgen slot of the glob to signify that this is a currently valid cache entry.
Overwriting a real method is an error. Use set_cvgen with get_class_gen first to force this.
set_cvgen
get_class_gen
Adding a cache entry to a shared GV (get_gv_refcount > 1) is an error, too, because the GV is shared by more than one stash and this will cause strange behavior. Use set_cv and set_cvgen for that. Devel::Peek will probably tell you wtf is going on.
set_cv
Gets the CV slot of the glob if this is a currently valid cache entry.
Updates the cvgen slot to mark this cache entry as valid.
It is an error to update cvgen if it is not set but the CV slot is set, because that will overwrite a real method.
To force this behavior call set_cvgen with get_class_gen.
Remove the CV and reset the CVGEN of a glob.
Returns the current class generation for a class.
This is like "get_pkg_gen" in mro (See also MRO::Compat).
This is equal to PL_sub_generation under perls predating mro, but still requires $class to be passed in for consistency.
PL_sub_generation
$class
This is provided mainly for convenience, for furthere manipuatlion of method caching please consult MRO::Compat, it has all the encessary functionality for manipulating cache invalidation. Using it in conjunction with Class::C3::XS is reccomended on perls below 5.9.5.
This differs from *{$glob}{CODE} in that it will return the cached code ref if any, wheras accessing the code slot is more like GvCVu(gv) (which checks that GvCVGEN is == 0 first).
*{$glob}{CODE}
GvCVu(gv)
GvCVGEN
Manipulate GvCV directly.
GvCV
A value of undef will clear the field.
undef
Returns the cvgen slot of the gv.
Manipulate GvCVGEN directly.
Any value greater than zero implies the GvCV is a cache entry. If GvCV is not set then this is a cache of a failed lookup.
mro, MRO::Compat, Class::C3::XS
This module is maintained using Darcs. You can get the latest version from http://nothingmuch.woobling.org/code, and use darcs send to commit changes.
darcs send
Yuval Kogman <nothingmuch@woobling.org>
Copyright (c) 2008 Yuval Kogman. All rights reserved This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Expected text after =item, not a bullet
To install Class::MethodCache, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::MethodCache
CPAN shell
perl -MCPAN -e shell install Class::MethodCache
For more information on module installation, please visit the detailed CPAN module installation guide.