summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-02-12 05:39:29 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-02-12 05:39:29 +0000
commit35cd451c5a1303394968903750cc3b3a1a6bc892 (patch)
tree0dff9ce049b3cd7facf6fbfd54dcddddc8ac0990 /pp_hot.c
parentcf34019797138569fd71cfc48bb60249b9df0ec3 (diff)
downloadperl-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.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/pp_hot.c b/pp_hot.c
index f304e8bd68..27af29d071 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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);