]> git.donarmstrong.com Git - perltidy.git/commitdiff
fixed RT#130344, false "operator in print statement" warning
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 22 Aug 2019 23:22:51 +0000 (16:22 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 22 Aug 2019 23:22:51 +0000 (16:22 -0700)
CHANGES.md
lib/Perl/Tidy/Logger.pm
lib/Perl/Tidy/Tokenizer.pm

index 56222eae0855e07d98255cbb9afacce864b9ea39..f6b8750ca3bdd629d1a985e83620081c9415d6ac 100644 (file)
@@ -2,6 +2,9 @@
 
 ## 2019 06 01.01
 
+    - fixed issue RT#130344: false warning "operator in print statement" 
+      for "use lib". 
+
     - fixed issue RT#130304: standard error output should include filename.
       When perltidy error messages are directed to the standard error output with
       -se or --standard-error-output, the message lines now have a prefix with
index eb66a2c99ad37773a77e231a8feefae73372e6f4..332767afc0c1af03c6c7ad455a35856119e2eb79 100644 (file)
@@ -12,7 +12,7 @@ our $VERSION = '20190601.01';
 sub new {
 
     my ( $class, $rOpts, $log_file, $warning_file, $fh_stderr, $saw_extrude,
-        $filename_stamp )
+        $display_name )
       = @_;
 
     my $fh_warnings = $rOpts->{'standard-error-output'} ? $fh_stderr : undef;
@@ -52,7 +52,7 @@ sub new {
         _saw_brace_error => 0,
         _saw_extrude     => $saw_extrude,
         _output_array    => [],
-        _filename_stamp => $filename_stamp ? $filename_stamp . ':' : "",
+        _filename_stamp => $display_name ? $display_name . ':' : "",
     }, $class;
 }
 
index 7c3abb2a2b3c51d4c0fd5bf0e0e1326f3a4ac1bf..48f8f93771c7fe80748479c2b48d320609aa6de2 100644 (file)
@@ -4225,7 +4225,13 @@ sub operator_expected {
         # could change the interpretation of the statement.
         else {
             if ( $tok =~ /^([x\/\+\-\*\%\&\.\?\<]|\>\>)$/ ) {
-                complain("operator in print statement not recommended\n");
+
+               # Do not complain in 'use' statements, which have special syntax. 
+                # For example, from RT#130344:
+                #   use lib $FindBin::Bin . '/lib';
+               if ($statement_type ne 'use') {
+                    complain("operator in print statement not recommended\n");
+               }
                 $op_expected = OPERATOR;
             }
         }