diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-02-12 05:39:29 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-02-12 05:39:29 +0000 |
commit | 35cd451c5a1303394968903750cc3b3a1a6bc892 (patch) | |
tree | 0dff9ce049b3cd7facf6fbfd54dcddddc8ac0990 /pp.c | |
parent | cf34019797138569fd71cfc48bb60249b9df0ec3 (diff) | |
download | perl-35cd451c5a1303394968903750cc3b3a1a6bc892.tar.gz |
fix ops that are not filehandle constructors to not create GV if it
doesn't already exist (avoids leaks); extend semantics of defined()
so that defined(*{$foo}) works (experimental)
p4raw-id: //depot/perl@2879
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -240,9 +240,18 @@ PP(pp_rv2gv) RETSETUNDEF; } sym = SvPV(sv, n_a); - if (PL_op->op_private & HINT_STRICT_REFS) - DIE(PL_no_symref, sym, "a symbol"); - sv = (SV*)gv_fetchpv(sym, TRUE, SVt_PVGV); + if ((PL_op->op_flags & OPf_SPECIAL) && + !(PL_op->op_flags & OPf_MOD)) + { + sv = (SV*)gv_fetchpv(sym, FALSE, SVt_PVGV); + if (!sv) + RETSETUNDEF; + } + else { + if (PL_op->op_private & HINT_STRICT_REFS) + DIE(PL_no_symref, sym, "a symbol"); + sv = (SV*)gv_fetchpv(sym, TRUE, SVt_PVGV); + } } } if (PL_op->op_private & OPpLVAL_INTRO) @@ -287,9 +296,18 @@ PP(pp_rv2sv) RETSETUNDEF; } sym = SvPV(sv, n_a); - if (PL_op->op_private & HINT_STRICT_REFS) - DIE(PL_no_symref, sym, "a SCALAR"); - gv = (GV*)gv_fetchpv(sym, TRUE, SVt_PV); + if ((PL_op->op_flags & OPf_SPECIAL) && + !(PL_op->op_flags & OPf_MOD)) + { + gv = (GV*)gv_fetchpv(sym, FALSE, SVt_PV); + if (!gv) + RETSETUNDEF; + } + else { + if (PL_op->op_private & HINT_STRICT_REFS) + DIE(PL_no_symref, sym, "a SCALAR"); + gv = (GV*)gv_fetchpv(sym, TRUE, SVt_PV); + } } sv = GvSV(gv); } |