diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-07-07 17:35:10 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-09-15 22:44:59 -0700 |
commit | b290562ef436d5316a2f75513def7f4f18c4ef34 (patch) | |
tree | cf17255810711fb72c2702959076b99265b56068 /pp.c | |
parent | 97b03d64e557578d3dbfeb6e6ca37ba57d57e858 (diff) | |
download | perl-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.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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: |