From 5fc691f12365580534cea1c0be21bed7badfb89a Mon Sep 17 00:00:00 2001 From: Aristotle Pagaltzis Date: Wed, 9 Jan 2013 11:26:56 +0100 Subject: [PATCH] Make the -F switch imply -a --- MANIFEST | 1 + perl.c | 1 + t/run/switchF2.t | 15 +++++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 t/run/switchF2.t diff --git a/MANIFEST b/MANIFEST index c2c3882..8fb53e0 100644 --- 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 --- 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 index 0000000..51136d2 --- /dev/null +++ b/t/run/switchF2.t @@ -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" ); -- 1.8.3.1