summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-12-08 16:38:59 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-12-09 18:47:19 -0800
commit9423a867e1bcf854b0ed9fff9eacaadd6f48ca8d (patch)
treef019467e1b9ccdb239a6186e9d06eed18adf7fc5 /pp_sys.c
parentf01818e214428dd68e3cb9d9c7cead608216ffa5 (diff)
downloadperl-9423a867e1bcf854b0ed9fff9eacaadd6f48ca8d.tar.gz
Don’t pass PL_glob_index to glob overrides
This magic second argument is undocumented and unused on CPAN and in the core (as of the last few commits). It could also get in the way of making glob truly overridable in the future (e.g., allowing File::Glob to take a list).
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 06699d9b72..06b3684261 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -359,15 +359,19 @@ PP(pp_glob)
dVAR;
OP *result;
dSP;
+ GV * const gv = (PL_op->op_flags & OPf_SPECIAL) ? NULL : (GV *)POPs;
+
+ PUTBACK;
+
/* make a copy of the pattern if it is gmagical, to ensure that magic
* is called once and only once */
- if (SvGMAGICAL(TOPm1s)) TOPm1s = sv_2mortal(newSVsv(TOPm1s));
+ if (SvGMAGICAL(TOPs)) TOPs = sv_2mortal(newSVsv(TOPs));
- tryAMAGICunTARGETlist(iter_amg, -1, (PL_op->op_flags & OPf_SPECIAL));
+ tryAMAGICunTARGETlist(iter_amg, 0, (PL_op->op_flags & OPf_SPECIAL));
if (PL_op->op_flags & OPf_SPECIAL) {
/* call Perl-level glob function instead. Stack args are:
- * MARK, wildcard, csh_glob context index
+ * MARK, wildcard
* and following OPs should be: gv(CORE::GLOBAL::glob), entersub
* */
return NORMAL;
@@ -375,7 +379,8 @@ PP(pp_glob)
/* stack args are: wildcard, gv(_GEN_n) */
if (PL_globhook) {
- SETs(GvSV(TOPs));
+ PUSHs(GvSV(gv));
+ PUTBACK;
PL_globhook(aTHX);
return NORMAL;
}
@@ -398,7 +403,7 @@ PP(pp_glob)
#endif /* !VMS */
SAVESPTR(PL_last_in_gv); /* We don't want this to be permanent. */
- PL_last_in_gv = MUTABLE_GV(*PL_stack_sp--);
+ PL_last_in_gv = gv;
SAVESPTR(PL_rs); /* This is not permanent, either. */
PL_rs = newSVpvs_flags("\000", SVs_TEMP);