From b7e077d0225eac833ce2eb6fe9e1807f77d0f848 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Fri, 30 Dec 2011 20:13:29 -0800 Subject: =?UTF-8?q?[perl=20#104288]=20Die=20with=20=E2=80=98Unrecognized?= =?UTF-8?q?=20switch=E2=80=99=C2=A0on=20#!=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a switch such as -x that cannot occur on the shebang line is used there, perl dies with ‘Can’t emulate...’. If an unrecognised switch is used on the command line, perl dies with ‘Unrecognized switch...’. It just happens to use the former error message for unrecognized switches on the shebang line, which can be confusing: $ perl -e '#!perl -G' Can't emulate -G on #! line at -e line 1. This commit changes it to output the same message as command-line switches for those that are unrecognised wherever they are used. --- perl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'perl.c') diff --git a/perl.c b/perl.c index d50116ba86..3fae0e54e2 100644 --- a/perl.c +++ b/perl.c @@ -3354,8 +3354,12 @@ Perl_moreswitches(pTHX_ const char *s) case 'S': /* OS/2 needs -S on "extproc" line. */ break; #endif - default: + case 'e': case 'f': case 'x': case 'E': case 'S': case 'V': Perl_croak(aTHX_ "Can't emulate -%.1s on #! line",s); + default: + Perl_croak(aTHX_ + "Unrecognized switch: -%.1s (-h will show valid options)",s + ); } return NULL; } -- cgit v1.2.1