summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ExtUtils/Constant/ProxySubs.pm3
-rw-r--r--lib/constant.pm1
-rw-r--r--universal.c14
3 files changed, 18 insertions, 0 deletions
diff --git a/lib/ExtUtils/Constant/ProxySubs.pm b/lib/ExtUtils/Constant/ProxySubs.pm
index 921da9a3f4..4317e1ebe8 100644
--- a/lib/ExtUtils/Constant/ProxySubs.pm
+++ b/lib/ExtUtils/Constant/ProxySubs.pm
@@ -338,6 +338,9 @@ EOBOOT
}
print $xs_fh <<EOCONSTANT
+ /* As we've been creating subroutines, we better invalidate any cached
+ methods */
+ ++PL_sub_generation;
}
void
diff --git a/lib/constant.pm b/lib/constant.pm
index d6c8a090d6..0b8efb3e71 100644
--- a/lib/constant.pm
+++ b/lib/constant.pm
@@ -109,6 +109,7 @@ sub import {
# constants from cv_const_sv are read only. So we have to:
Internals::SvREADONLY($scalar, 1);
$symtab->{$name} = \$scalar;
+ Internals::inc_sub_generation;
} else {
if(!exists $symtab->{$name}) {
print STDERR "$name $scalar\n";
diff --git a/universal.c b/universal.c
index 24aa3b8e48..5c147b675a 100644
--- a/universal.c
+++ b/universal.c
@@ -199,6 +199,7 @@ XS(XS_Regexp_DESTROY);
XS(XS_Internals_hash_seed);
XS(XS_Internals_rehash_seed);
XS(XS_Internals_HvREHASH);
+XS(XS_Internals_inc_sub_generation);
void
Perl_boot_core_UNIVERSAL(pTHX)
@@ -247,6 +248,8 @@ Perl_boot_core_UNIVERSAL(pTHX)
newXSproto("Internals::hash_seed",XS_Internals_hash_seed, file, "");
newXSproto("Internals::rehash_seed",XS_Internals_rehash_seed, file, "");
newXSproto("Internals::HvREHASH", XS_Internals_HvREHASH, file, "\\%");
+ newXSproto("Internals::inc_sub_generation",XS_Internals_inc_sub_generation,
+ file, "");
}
@@ -949,6 +952,17 @@ XS(XS_Internals_HvREHASH) /* Subject to change */
Perl_croak(aTHX_ "Internals::HvREHASH $hashref");
}
+XS(XS_Internals_inc_sub_generation)
+{
+ /* Using dXSARGS would also have dITEM and dSP,
+ * which define 2 unused local variables. */
+ dAXMARK;
+ PERL_UNUSED_ARG(cv);
+ PERL_UNUSED_VAR(mark);
+ ++PL_sub_generation;
+ XSRETURN_EMPTY;
+}
+
/*
* Local variables:
* c-indentation-style: bsd