From 0dfe3a1c9278835962b47278d32212635ca6fe76 Mon Sep 17 00:00:00 2001
From: Steve Hancock <perltidy@users.sourceforge.net>
Date: Thu, 22 Aug 2019 16:22:51 -0700
Subject: [PATCH] fixed RT#130344, false "operator in print statement" warning

---
 CHANGES.md                 | 3 +++
 lib/Perl/Tidy/Logger.pm    | 4 ++--
 lib/Perl/Tidy/Tokenizer.pm | 8 +++++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 56222eae..f6b8750c 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -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
diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm
index eb66a2c9..332767af 100644
--- a/lib/Perl/Tidy/Logger.pm
+++ b/lib/Perl/Tidy/Logger.pm
@@ -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;
 }
 
diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm
index 7c3abb2a..48f8f937 100644
--- a/lib/Perl/Tidy/Tokenizer.pm
+++ b/lib/Perl/Tidy/Tokenizer.pm
@@ -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;
             }
         }
-- 
2.39.5