develooper Front page | perl.perl5.porters | Postings from March 2003

Re: [fix] [perl #21575] Bug with print( followed by a newline

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
March 14, 2003 13:40
Subject:
Re: [fix] [perl #21575] Bug with print( followed by a newline
Message ID:
20030314224117.3b872bd7.rgarciasuarez@free.fr
Enache Adrian wrote:
> 
> The '\n' causes yylex() to switch to the 0 case, and consequently
> clobber PL_last_lop. So the test at toke.c:3473 will fail - and
> '$' won't be changed into '%'.

Looks correct. Thanks, applied as #18986. I added a test, in the most
simple way I could find :

==== //depot/perl/t/comp/parser.t#7 (text) ====

@@ -9,7 +9,7 @@
 }
 
 require "./test.pl";
-plan( tests => 20 );
+plan( tests => 21 );
 
 eval '%@x=0;';
 like( $@, qr/^Can't modify hash dereference in repeat \(x\)/, '%@x=0' );
@@ -88,3 +88,12 @@
 ${a}{ ${a}[ @{b}{
 ${a}{
 }
+
+# Bug #21575
+# ensure that the second print statement works, by playing a bit
+# with the test output.
+my %data = ( foo => "\n" );
+print "#";
+print(
+$data{foo});
+pass();

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About