From: Steve Hancock Date: Thu, 22 Aug 2019 23:22:51 +0000 (-0700) Subject: fixed RT#130344, false "operator in print statement" warning X-Git-Tag: 20190915~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0dfe3a1c9278835962b47278d32212635ca6fe76;p=perltidy.git fixed RT#130344, false "operator in print statement" warning --- 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; } }