summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-09-10 18:39:12 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-09-10 19:38:25 -0700
commit094a3eec8ad4cfb12d72a98f11e9186594579b57 (patch)
tree406c76025535d3bc8e1c890b465905f46a37314c /pp_sys.c
parent63d661c578abce858318b675580f163d201925a0 (diff)
downloadperl-094a3eec8ad4cfb12d72a98f11e9186594579b57.tar.gz
Make filetest ops handle get-magic correctly for glob(ref)s
This patch uses the recently-added MAYBE_DEREF_GV macro which puts the glob deref logic in one spot. It also adds _nomg and _flags varia- tions of it. _flags understands the SV_GMAGIC flag.
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 50c1a12986..d6ca53360c 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3264,11 +3264,7 @@ PP(pp_fttty)
if (PL_op->op_flags & OPf_REF)
gv = cGVOP_gv;
- else if (isGV_with_GP(TOPs))
- gv = MUTABLE_GV(POPs);
- else if (SvROK(TOPs) && isGV(SvRV(TOPs)))
- gv = MUTABLE_GV(SvRV(POPs));
- else {
+ else if (!(gv = MAYBE_DEREF_GV_nomg(TOPs))) {
tmpsv = POPs;
name = SvPV_nomg(tmpsv, namelen);
gv = gv_fetchpvn_flags(name, namelen, SvUTF8(tmpsv), SVt_PVIO);
@@ -3317,12 +3313,7 @@ PP(pp_fttext)
if (PL_op->op_flags & OPf_REF)
gv = cGVOP_gv;
- else if (isGV_with_GP(TOPs))
- gv = MUTABLE_GV(POPs);
- else if (SvROK(TOPs) && isGV(SvRV(TOPs)))
- gv = MUTABLE_GV(SvRV(POPs));
- else
- gv = NULL;
+ else gv = MAYBE_DEREF_GV_nomg(TOPs);
if (gv) {
EXTEND(SP, 1);