diff options
-rw-r--r-- | scope.c | 5 | ||||
-rwxr-xr-x | t/op/method.t | 8 |
2 files changed, 12 insertions, 1 deletions
@@ -222,6 +222,9 @@ save_gp(GV *gv, I32 empty) if (empty) { register GP *gp; + + if (GvCVu(gv)) + sub_generation++; /* taking a method out of circulation */ Newz(602, gp, 1, GP); GvGP(gv) = gp_ref(gp); GvSV(gv) = NEWSV(72,0); @@ -678,6 +681,8 @@ leave_scope(I32 base) SvLEN(gv) = (STRLEN)SSPOPIV; gp_free(gv); GvGP(gv) = (GP*)ptr; + if (GvCVu(gv)) + sub_generation++; /* putting a method back into circulation */ SvREFCNT_dec(gv); break; case SAVEt_FREESV: diff --git a/t/op/method.t b/t/op/method.t index d955705d1a..f1b1888ef6 100755 --- a/t/op/method.t +++ b/t/op/method.t @@ -4,7 +4,7 @@ # test method calls and autoloading. # -print "1..24\n"; +print "1..26\n"; @A::ISA = 'B'; @B::ISA = 'C'; @@ -66,6 +66,12 @@ test (A->d, "B::d4"); # Update hash table; delete $B::{d}; # Should work without any help too test (A->d, "C::d"); +{ + local *C::d; + test (eval { A->d } || "nope", "nope"); +} +test (A->d, "C::d"); + *A::x = *A::d; # See if cache incorrectly follows synonyms A->d; test (eval { A->x } || "nope", "nope"); |