From: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date: Tue, 6 Jan 2004 18:11:22 +0000 (+0000)
Subject: Fix bug #24813 : the -0 wasn't recognized on the #! line
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=800633c3daced5882d77eb7f133a700d5838565e;p=p5sagit%2Fp5-mst-13.2.git

Fix bug #24813 : the -0 wasn't recognized on the #! line

p4raw-id: //depot/perl@22082
---

diff --git a/MANIFEST b/MANIFEST
index b2ea90a..081ac35 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2891,6 +2891,7 @@ t/run/exit.t			Test perl's exit status.
 t/run/fresh_perl.t		Tests that require a fresh perl.
 t/run/noswitch.t		Test aliasing ARGV for other switch tests
 t/run/runenv.t			Test if perl honors its environment variables.
+t/run/switch0.t			Test the -0 switch
 t/run/switcha.t			Test the -a switch
 t/run/switch_A.t		Test the -A switch
 t/run/switchC.t			Test the -C switch
diff --git a/perl.c b/perl.c
index 1b9fd18..f32e346 100644
--- a/perl.c
+++ b/perl.c
@@ -1358,7 +1358,6 @@ print \"  \\@INC:\\n    @INC\\n\";");
 	}
     }
   switch_end:
-    sv_setsv(get_sv("/", TRUE), PL_rs);
 
     if (
 #ifndef SECURE_INTERNAL_GETENV
@@ -2389,6 +2388,7 @@ Perl_moreswitches(pTHX_ char *s)
 		   PL_rs = newSVpvn(&ch, 1);
 	      }
 	 }
+	 sv_setsv(get_sv("/", TRUE), PL_rs);
 	 return s + numlen;
     }
     case 'C':
diff --git a/t/run/switch0.t b/t/run/switch0.t
new file mode 100644
index 0000000..9919e12
--- /dev/null
+++ b/t/run/switch0.t
@@ -0,0 +1,3 @@
+#!./perl -0
+print "1..1\n";
+print ord $/ == 0 ? "ok 1\n" : "not ok 1\n";