Change 16421 by jhi@alpha on 2002/05/06 01:09:24
Subject: Re: [ID 20020504.006] $s=`command` fails if $/=\integer
From: Radu Greab <[EMAIL PROTECTED]>
Date: Mon, 6 May 2002 04:23:10 +0300
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/pp_sys.c#304 edit
.... //depot/perl/t/op/exec.t#21 edit
Differences ...
==== //depot/perl/pp_sys.c#304 (text) ====
Index: perl/pp_sys.c
--- perl/pp_sys.c#303~16220~ Sat Apr 27 09:27:18 2002
+++ perl/pp_sys.c Sun May 5 18:09:24 2002
@@ -321,10 +321,13 @@
;
}
else if (gimme == G_SCALAR) {
+ SV *oldrs = PL_rs;
+ PL_rs = &PL_sv_undef;
sv_setpv(TARG, ""); /* note that this preserves previous buffer */
while (sv_gets(TARG, fp, SvCUR(TARG)) != Nullch)
/*SUPPRESS 530*/
;
+ PL_rs = oldrs;
XPUSHs(TARG);
SvTAINTED_on(TARG);
}
==== //depot/perl/t/op/exec.t#21 (xtext) ====
Index: perl/t/op/exec.t
--- perl/t/op/exec.t#20~16257~ Sun Apr 28 13:26:30 2002
+++ perl/t/op/exec.t Sun May 5 18:09:24 2002
@@ -19,7 +19,7 @@
skip_all("Tests mostly usesless on MacOS") if $^O eq 'MacOS';
-plan(tests => 20);
+plan(tests => 21);
my $Perl = which_perl();
@@ -74,6 +74,12 @@
is( scalar `$Perl -le "print 'ok'" | $Perl -e "print <STDIN>"`,
"ok\n", 'extra newlines on outgoing pipes');
+
+ {
+ local($/) = \2;
+ $out = runperl(prog => 'print q{1234}');
+ is($out, "1234", 'ignore $/ when capturing output in scalar context');
+ }
}
End of Patch.