summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rw-r--r--perl.c2
-rw-r--r--t/run/switch0.t3
3 files changed, 5 insertions, 1 deletions
diff --git a/MANIFEST b/MANIFEST
index b2ea90aef8..081ac356c1 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 1b9fd18c58..f32e346950 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 0000000000..9919e1231a
--- /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";