summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-07 17:35:10 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:44:59 -0700
commitb290562ef436d5316a2f75513def7f4f18c4ef34 (patch)
treecf17255810711fb72c2702959076b99265b56068 /pp.c
parent97b03d64e557578d3dbfeb6e6ca37ba57d57e858 (diff)
downloadperl-b290562ef436d5316a2f75513def7f4f18c4ef34.tar.gz
Allow CVs to point to HEKs rather than GVs
This will allow named lexical subs to exist independent of GVs.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index 00b28aee41..a14b62be24 100644
--- a/pp.c
+++ b/pp.c
@@ -935,8 +935,14 @@ PP(pp_undef)
{
/* let user-undef'd sub keep its identity */
GV* const gv = CvGV((const CV *)sv);
+ HEK * const hek = CvNAME_HEK((CV *)sv);
+ if (hek) share_hek_hek(hek);
cv_undef(MUTABLE_CV(sv));
- CvGV_set(MUTABLE_CV(sv), gv);
+ if (gv) CvGV_set(MUTABLE_CV(sv), gv);
+ else if (hek) {
+ SvANY((CV *)sv)->xcv_gv_u.xcv_hek = hek;
+ CvNAMED_on(sv);
+ }
}
break;
case SVt_PVGV: