MODULE = Class::MOP PACKAGE = Class::MOP
SV*
-check_package_cache_flag()
+check_package_cache_flag(pkg)
+ SV* pkg
CODE:
RETVAL = newSViv(PL_sub_generation);
OUTPUT:
use Class::MOP::Immutable;
-our $VERSION = '0.49';
-our $AUTHORITY = 'cpan:STEVAN';
-
-use XSLoader;
-XSLoader::load( 'Class::MOP', $VERSION );
+BEGIN {
+ our $VERSION = '0.49';
+ our $AUTHORITY = 'cpan:STEVAN';
+
+ use XSLoader;
+ XSLoader::load( 'Class::MOP', $VERSION );
+
+ unless ($] < 5.009_005) {
+ no warnings 'redefine';
+ *check_package_cache_flag = \&mro::get_pkg_gen;
+ }
+}
{
# Metaclasses are singletons, so we cache them here.
determine as best it can if the C<$class_name> is loaded, it
is probably correct about 99% of the time.
-=item B<check_package_cache_flag>
+=item B<check_package_cache_flag ($pkg)>
=item B<get_code_info ($code)>
sub reset_package_cache_flag { (shift)->{'$!_package_cache_flag'} = undef }
sub update_package_cache_flag {
+ my $self = shift;
# NOTE:
# we can manually update the cache number
# since we are actually adding the method
# to our cache as well. This avoids us
# having to regenerate the method_map.
# - SL
- (shift)->{'$!_package_cache_flag'} = Class::MOP::check_package_cache_flag();
+ $self->{'$!_package_cache_flag'} = Class::MOP::check_package_cache_flag($self->name);
}
sub check_metaclass_compatability {
my $self = shift;
if (defined $self->{'$!_package_cache_flag'} &&
- $self->{'$!_package_cache_flag'} == Class::MOP::check_package_cache_flag()) {
+ $self->{'$!_package_cache_flag'} == Class::MOP::check_package_cache_flag($self->name)) {
return $self->{'%!methods'};
}