summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2001-09-09 19:41:54 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2001-09-15 12:33:49 +0000
commit8bfdd7d95bcb290ba639e2c88c5d4370ab8fcfc0 (patch)
tree73ff47381401919d6d90daccf674fc93918f21a7 /sv.c
parentc366adb4d8e96138e96920f4a327296016a696e0 (diff)
downloadperl-8bfdd7d95bcb290ba639e2c88c5d4370ab8fcfc0.tar.gz
Re: [ID 20010815.012] Unfortunate interaction between -0 cmd line arg & (??{CODE}) regex
Message-Id: <200109091741.f89HfsM18534@crypt.compulink.co.uk> p4raw-id: //depot/perl@12027
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sv.c b/sv.c
index 1505a4ff91..efac7465a8 100644
--- a/sv.c
+++ b/sv.c
@@ -5507,13 +5507,19 @@ Perl_sv_gets(pTHX_ register SV *sv, register PerlIO *fp, I32 append)
register STDCHAR *bp;
register I32 cnt;
I32 i = 0;
+ I32 rspara = 0;
SV_CHECK_THINKFIRST(sv);
(void)SvUPGRADE(sv, SVt_PV);
SvSCREAM_off(sv);
- if (RsSNARF(PL_rs)) {
+ if (PL_curcop == &PL_compiling) {
+ /* we always read code in line mode */
+ rsptr = "\n";
+ rslen = 1;
+ }
+ else if (RsSNARF(PL_rs)) {
rsptr = NULL;
rslen = 0;
}
@@ -5545,6 +5551,7 @@ Perl_sv_gets(pTHX_ register SV *sv, register PerlIO *fp, I32 append)
else if (RsPARA(PL_rs)) {
rsptr = "\n\n";
rslen = 2;
+ rspara = 1;
}
else {
/* Get $/ i.e. PL_rs into same encoding as stream wants */
@@ -5563,7 +5570,7 @@ Perl_sv_gets(pTHX_ register SV *sv, register PerlIO *fp, I32 append)
rslast = rslen ? rsptr[rslen - 1] : '\0';
- if (RsPARA(PL_rs)) { /* have to do this both before and after */
+ if (rspara) { /* have to do this both before and after */
do { /* to make sure file boundaries work right */
if (PerlIO_eof(fp))
return 0;
@@ -5769,7 +5776,7 @@ screamer2:
}
}
- if (RsPARA(PL_rs)) { /* have to do this both before and after */
+ if (rspara) { /* have to do this both before and after */
while (i != EOF) { /* to make sure file boundaries work right */
i = PerlIO_getc(fp);
if (i != '\n') {
@@ -10175,7 +10182,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PL_tainted = proto_perl->Ttainted;
PL_curpm = proto_perl->Tcurpm; /* XXX No PMOP ref count */
- PL_nrs = sv_dup_inc(proto_perl->Tnrs, param);
PL_rs = sv_dup_inc(proto_perl->Trs, param);
PL_last_in_gv = gv_dup(proto_perl->Tlast_in_gv, param);
PL_ofs_sv = sv_dup_inc(proto_perl->Tofs_sv, param);