]> git.donarmstrong.com Git - perltidy.git/commitdiff
prevent unnecessary hash-bang warning message
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 13 Sep 2020 14:38:14 +0000 (07:38 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 13 Sep 2020 14:38:14 +0000 (07:38 -0700)
lib/Perl/Tidy/Tokenizer.pm

index 894156b558fd7d3dd428ac3c37fccbcc8fec6fb0..f2a92e56b859f5159cb579adfc04720737c9ccf4 100644 (file)
@@ -814,7 +814,7 @@ sub get_line {
             }
 
             if (
-                ( $input_line_number > 1 )
+                $input_line_number > 1
 
                 # leave any hash bang in a BEGIN block alone
                 # i.e. see 'debugger-duck_type.t'
@@ -822,7 +822,11 @@ sub get_line {
                        $last_nonblank_block_type
                     && $last_nonblank_block_type eq 'BEGIN'
                 )
-                && ( !$tokenizer_self->[_look_for_hash_bang_] )
+                && !$tokenizer_self->[_look_for_hash_bang_]
+
+                # Patch: be sure there is a slash after the #! before giving a
+                # warning
+                && $input_line =~ /^\#\!\s*\/.*perl\b/
               )
             {