summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1996-08-25 00:13:55 +0000
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1996-08-25 00:13:55 +0000
commitb1dadf134bc1d7458a050c3b4ad2ce62652892ad (patch)
tree8f05be86b2b3731912a8e002a1624415ad2a2c40 /pp.c
parentcf6f4e918622ec80f33cb4c23b8f8c844c6c0755 (diff)
downloadperl-b1dadf134bc1d7458a050c3b4ad2ce62652892ad.tar.gz
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.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index 5b6af5a3fc..d75566fa3a 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) {