From: Rafael Garcia-Suarez Date: Sat, 12 Oct 2002 20:22:37 +0000 (+0000) Subject: The -0 command-line switch wasn't setting $/ at compile-time. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7f9e821f0be8f0d2dc7f73eee7bbcade8739c838;p=p5sagit%2Fp5-mst-13.2.git The -0 command-line switch wasn't setting $/ at compile-time. Move the initialization of $/ just after switch parsing (it was done after yyparse().) p4raw-id: //depot/perl@18015 --- diff --git a/perl.c b/perl.c index dd459cb..c23a184 100644 --- a/perl.c +++ b/perl.c @@ -1339,6 +1339,7 @@ print \" \\@INC:\\n @INC\\n\";"); } } switch_end: + sv_setsv(get_sv("/", TRUE), PL_rs); if ( #ifndef SECURE_INTERNAL_GETENV @@ -1538,12 +1539,6 @@ print \" \\@INC:\\n @INC\\n\";"); PL_e_script = Nullsv; } -/* - Not sure that this is still the right place to do this now that we - no longer use PL_nrs. HVDS 2001/09/09 -*/ - sv_setsv(get_sv("/", TRUE), PL_rs); - if (PL_do_undump) my_unexec(); diff --git a/t/run/switches.t b/t/run/switches.t index 996ad5d..9bcbc80 100644 --- a/t/run/switches.t +++ b/t/run/switches.t @@ -9,7 +9,7 @@ BEGIN { require "./test.pl"; -plan(tests => 19); +plan(tests => 20); # due to a bug in VMS's piping which makes it impossible for runperl() # to emulate echo -n (ie. stdin always winds up with a newline), these @@ -64,6 +64,12 @@ $r = runperl( ); is( $r, 'abc-def--ghi-jkl-mno--pq-/', '-0777 (slurp mode)' ); +$r = runperl( + switches => [ '-066' ], + prog => 'BEGIN { print "($/)" } print "[$/]"', +); +is( $r, "(\066)[\066]", '$/ set at compile-time' ); + # Tests for -c my $filename = 'swctest.tmp';