From: Steve Hancock Date: Fri, 18 Sep 2020 15:53:19 +0000 (-0700) Subject: modify check to avoid false hash-bang warning X-Git-Tag: 20201001~29 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=67a60d80001e9d7cf78d811bf26e3bca28bf20fb;p=perltidy.git modify check to avoid false hash-bang warning --- diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index 35d18d42..4fbb54d6 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -824,9 +824,20 @@ sub get_line { ) && !$tokenizer_self->[_look_for_hash_bang_] - # Patch: be sure there is either a slash or the word 'perl' - # after the #! before giving a warning. - && $input_line =~ /^\#\!\s*(\/|perl)/ + # Try to avoid giving a false alarm at a simple comment. + # These look like valid hash-bang lines: + + #!/usr/bin/perl -w + #! /usr/bin/perl -w + #!c:\perl\bin\perl.exe + + # These are comments: + #! I love perl + #! sunos does not yet provide a /usr/bin/perl + + # Comments typically have multiple spaces, which suggests + # the filter + && $input_line =~ /^\#\!(\s+)?(\S+)?perl/ ) {