Make the -F switch imply -a
authorAristotle Pagaltzis <pagaltzis@gmx.de>
Wed, 9 Jan 2013 10:26:56 +0000 (11:26 +0100)
committerTony Cook <tony@develop-help.com>
Tue, 23 Jul 2013 00:02:26 +0000 (10:02 +1000)
MANIFEST
perl.c
t/run/switchF2.t [new file with mode: 0644]

index c2c3882..8fb53e0 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -5367,6 +5367,7 @@ t/run/switchd-78586.t             See whether bug 78586 is fixed
 t/run/switchd.t                        Test the -d switch
 t/run/switches.t               Tests for the other switches (-0, -l, -c, -s, -M, -m, -V, -v, -h, -z, -i)
 t/run/switchF1.t               Pathological tests for the -F switch
+t/run/switchF2.t               Pathological tests for the -F switch
 t/run/switchF.t                        Test the -F switch
 t/run/switchI.t                        Test the -I switch
 t/run/switchM.t                        Test the -M switch
diff --git a/perl.c b/perl.c
index ee36fd1..41a62b7 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3213,6 +3213,7 @@ Perl_moreswitches(pTHX_ const char *s)
            PL_utf8cache = -1;
        return s;
     case 'F':
+       PL_minus_a = TRUE;
        PL_minus_F = TRUE;
        PL_splitstr = ++s;
        while (*s && !isSPACE(*s)) ++s;
diff --git a/t/run/switchF2.t b/t/run/switchF2.t
new file mode 100644 (file)
index 0000000..51136d2
--- /dev/null
@@ -0,0 +1,15 @@
+#!./perl
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+    require './test.pl';
+}
+plan(tests => 1);
+
+my $cmd = "echo 1 | ./perl -n -F: -e print+\\\@F";
+my $got = `$cmd` || '';
+my $ok = 0 == $?;
+chomp $got;
+ok( ($ok and $got eq 1),
+  "passing -F implies -a" );