diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-12-16 23:03:42 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-12-16 23:03:42 +0000 |
commit | 1ccdb7301362000755034d5e6a7e73f566973104 (patch) | |
tree | 0fa142dae37f66fff801c799e2f2d0829fbdec0b /gv.c | |
parent | 2e5b91de24d62e1e2bf0fd32a1d4d1d849cafc82 (diff) | |
download | perl-1ccdb7301362000755034d5e6a7e73f566973104.tar.gz |
Add a new flag SVprv_PCS_IMPORTED (which is a pseudonym for SVf_SCREAM)
to note when a proxy constant subroutine is copied. This allows us to
correctly set GvIMPORTED_CV_on() if the symbol is ever turned into a
real GV.
p4raw-id: //depot/perl@29566
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -191,6 +191,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) const bool doproto = old_type > SVt_NULL; const char * const proto = (doproto && SvPOK(gv)) ? SvPVX_const(gv) : NULL; SV *const has_constant = doproto && SvROK(gv) ? SvRV(gv) : NULL; + const U32 exported_constant = has_constant ? SvPCS_IMPORTED(gv) : 0; assert (!(proto && has_constant)); @@ -239,6 +240,11 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) if (has_constant) { /* newCONSTSUB takes ownership of the reference from us. */ GvCV(gv) = newCONSTSUB(stash, name, has_constant); + /* If this reference was a copy of another, then the subroutine + must have been "imported", by a Perl space assignment to a GV + from a reference to CV. */ + if (exported_constant) + GvIMPORTED_CV_on(gv); } else { /* XXX unsafe for threads if eval_owner isn't held */ (void) start_subparse(0,0); /* Create empty CV in compcv. */ |