From: Perl 5 Porters Date: Sun, 25 Aug 1996 00:13:55 +0000 (+0000) Subject: perl 5.003_03: pp.c X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b1dadf134bc1d7458a050c3b4ad2ce62652892ad;p=p5sagit%2Fp5-mst-13.2.git perl 5.003_03: pp.c Add support for tied filehandles. If a regex supplied to split() contains paranthesized subpatterns that can result in null matches, perl coredumps. --- diff --git a/pp.c b/pp.c index 5b6af5a..d75566f 100644 --- a/pp.c +++ b/pp.c @@ -98,7 +98,13 @@ PP(pp_rv2gv) if (SvROK(sv)) { wasref: sv = SvRV(sv); - if (SvTYPE(sv) != SVt_PVGV) + if (SvTYPE(sv) == SVt_PVIO) { + GV *gv = (GV*) sv_newmortal(); + gv_init(gv, 0, "", 0, 0); + GvIOp(gv) = (IO *)sv; + SvREFCNT_inc(sv); + sv = (SV*) gv; + } else if (SvTYPE(sv) != SVt_PVGV) DIE("Not a GLOB reference"); } else { @@ -3515,7 +3521,7 @@ PP(pp_split) iters++; } else if (!origlimit) { - while (iters > 0 && SvCUR(TOPs) == 0) + while (iters > 0 && (!TOPs || !SvANY(TOPs) || SvCUR(TOPs) == 0)) iters--, SP--; } if (realarray) {