From: Gurusamy Sarathy Date: Fri, 5 Nov 1999 04:35:30 +0000 (+0000) Subject: allow $\ to work right when set to a string with embedded nulls X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=009c130fc3ba16de26baf9bc4a9290f046a90258;p=p5sagit%2Fp5-mst-13.2.git allow $\ to work right when set to a string with embedded nulls p4raw-id: //depot/perl@4521 --- diff --git a/mg.c b/mg.c index aed978a..bb69f5c 100644 --- a/mg.c +++ b/mg.c @@ -1699,8 +1699,10 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) case '\\': if (PL_ors) Safefree(PL_ors); - if (SvOK(sv) || SvGMAGICAL(sv)) - PL_ors = savepv(SvPV(sv,PL_orslen)); + if (SvOK(sv) || SvGMAGICAL(sv)) { + s = SvPV(sv,PL_orslen); + PL_ors = savepvn(s,PL_orslen); + } else { PL_ors = Nullch; PL_orslen = 0; diff --git a/t/io/print.t b/t/io/print.t index 180b1e8..0578ee6 100755 --- a/t/io/print.t +++ b/t/io/print.t @@ -1,8 +1,6 @@ #!./perl -# $RCSfile: print.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:32 $ - -print "1..16\n"; +print "1..18\n"; $foo = 'STDOUT'; print $foo "ok 1\n"; @@ -30,3 +28,7 @@ print "ok","11"; @x = ("ok","12\nok","13\nok"); @y = ("15\nok","16"); print @x,"14\nok",@y; +{ + local $\ = "ok 17\n# null =>[\000]\nok 18\n"; + print ""; +}