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_hot.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_hot.c')
-rw-r--r-- | pp_hot.c | 36 |
1 files changed, 28 insertions, 8 deletions
@@ -468,10 +468,20 @@ PP(pp_rv2av) RETSETUNDEF; } sym = SvPV(sv,n_a); - if (PL_op->op_private & HINT_STRICT_REFS) - DIE(PL_no_symref, sym, "an ARRAY"); - gv = (GV*)gv_fetchpv(sym, TRUE, SVt_PVAV); - } else { + if ((PL_op->op_flags & OPf_SPECIAL) && + !(PL_op->op_flags & OPf_MOD)) + { + gv = (GV*)gv_fetchpv(sym, FALSE, SVt_PVAV); + if (!gv) + RETSETUNDEF; + } + else { + if (PL_op->op_private & HINT_STRICT_REFS) + DIE(PL_no_symref, sym, "an ARRAY"); + gv = (GV*)gv_fetchpv(sym, TRUE, SVt_PVAV); + } + } + else { gv = (GV*)sv; } av = GvAVn(gv); @@ -558,10 +568,20 @@ PP(pp_rv2hv) RETSETUNDEF; } sym = SvPV(sv,n_a); - if (PL_op->op_private & HINT_STRICT_REFS) - DIE(PL_no_symref, sym, "a HASH"); - gv = (GV*)gv_fetchpv(sym, TRUE, SVt_PVHV); - } else { + if ((PL_op->op_flags & OPf_SPECIAL) && + !(PL_op->op_flags & OPf_MOD)) + { + gv = (GV*)gv_fetchpv(sym, FALSE, SVt_PVHV); + if (!gv) + RETSETUNDEF; + } + else { + if (PL_op->op_private & HINT_STRICT_REFS) + DIE(PL_no_symref, sym, "a HASH"); + gv = (GV*)gv_fetchpv(sym, TRUE, SVt_PVHV); + } + } + else { gv = (GV*)sv; } hv = GvHVn(gv); |