diff options
author | Doug MacEachern <dougm@covalent.net> | 2001-02-10 02:57:12 -0800 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-02-10 21:25:07 +0000 |
commit | 5bd07a3d26012a115fab327912ac8788755e1251 (patch) | |
tree | 93771955569aee6376d8b39290ad18dd10204fe4 /op.c | |
parent | c049f95368b5429d658957f04652ad3e5f2d09a0 (diff) | |
download | perl-5bd07a3d26012a115fab327912ac8788755e1251.tar.gz |
[patch] GvSHARED
Message-ID: <Pine.LNX.4.21.0102101047320.15298-100000@mako.covalent.net>
p4raw-id: //depot/perl@8760
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -4548,6 +4548,12 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) cv = (!name || GvCVGEN(gv)) ? Nullcv : GvCV(gv); +#ifdef GV_SHARED_CHECK + if (cv && GvSHARED(gv) && SvREADONLY(cv)) { + Perl_croak(aTHX_ "Can't define subroutine %s (GV is shared)", name); + } +#endif + if (!block || !ps || *ps || attrs) const_sv = Nullsv; else @@ -4555,6 +4561,13 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block) if (cv) { bool exists = CvROOT(cv) || CvXSUB(cv); + +#ifdef GV_SHARED_CHECK + if (exists && GvSHARED(gv)) { + Perl_croak(aTHX_ "Can't redefine shared subroutine %s", name); + } +#endif + /* if the subroutine doesn't exist and wasn't pre-declared * with a prototype, assume it will be AUTOLOADed, * skipping the prototype check @@ -5006,6 +5019,11 @@ Perl_newFORM(pTHX_ I32 floor, OP *o, OP *block) else name = "STDOUT"; gv = gv_fetchpv(name,TRUE, SVt_PVFM); +#ifdef GV_SHARED_CHECK + if (GvSHARED(gv)) { + Perl_croak(aTHX_ "Bad symbol for form (GV is shared)"); + } +#endif GvMULTI_on(gv); if ((cv = GvFORM(gv))) { if (ckWARN(WARN_REDEFINE)) { |