diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-10-12 20:22:37 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-10-12 20:22:37 +0000 |
commit | 7f9e821f0be8f0d2dc7f73eee7bbcade8739c838 (patch) | |
tree | 6f83ca0733ec26484182a714bdb87800e3906739 | |
parent | a5c16299e4688e58a2a7b276af191a614da68f07 (diff) | |
download | perl-7f9e821f0be8f0d2dc7f73eee7bbcade8739c838.tar.gz |
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
-rw-r--r-- | perl.c | 7 | ||||
-rw-r--r-- | t/run/switches.t | 8 |
2 files changed, 8 insertions, 7 deletions
@@ -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 996ad5d4c6..9bcbc80a9e 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'; |