]> git.donarmstrong.com Git - perltidy.git/commitdiff
minor cleanups; removed unused var 'saw_extrude'
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 8 May 2022 00:09:38 +0000 (17:09 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 8 May 2022 00:09:38 +0000 (17:09 -0700)
lib/Perl/Tidy.pm
lib/Perl/Tidy/Logger.pm

index 15eeb7fd239852ffe9e1d69de65d716b2c9b2585..5a297021bb21d395a1acab0ac15849f0d15aa01c 100644 (file)
@@ -618,7 +618,9 @@ EOM
         unless ( defined($dump_options_type) ) {
             $dump_options_type = 'perltidyrc';
         }
-        unless ( $dump_options_type =~ /^(perltidyrc|full)$/ ) {
+        if (   $dump_options_type ne 'perltidyrc'
+            && $dump_options_type ne 'full' )
+        {
             croak <<EOM;
 ------------------------------------------------------------------------
 Please check value of -dump_options_type in call to perltidy;
@@ -704,9 +706,8 @@ EOM
         $rpending_complaint, $dump_options_type,
       );
 
-    my $saw_extrude = ( grep { m/^-extrude$/ } @{$rraw_options} ) ? 1 : 0;
     my $saw_pbp =
-      ( grep { m/^-(pbp|perl-best-practices)$/ } @{$rraw_options} ) ? 1 : 0;
+      grep { $_ eq '-pbp' || $_ eq '-perl-best-practices' } @{$rraw_options};
 
     #---------------------------------------------------------------
     # Handle requests to dump information
@@ -1133,7 +1134,9 @@ EOM
         }
 
         # Case 3. guess input stream encoding if requested
-        elsif ( $rOpts_character_encoding =~ /^guess$/i ) {
+        elsif ($rOpts_character_encoding eq 'guess'
+            || $rOpts_character_encoding eq 'GUESS' )
+        {
 
             # The guessing strategy is simple: use Encode::Guess to guess
             # an encoding.  If and only if the guess is utf8, try decoding and
@@ -1150,7 +1153,7 @@ EOM
             my $decoder = guess_encoding( $buf_in, 'utf8' );
             if ( ref($decoder) ) {
                 $encoding_in = $decoder->name;
-                if ( $encoding_in !~ /^(UTF-8|utf8)$/ ) {
+                if ( $encoding_in ne 'UTF-8' && $encoding_in ne 'utf8' ) {
                     $encoding_in = "";
                     $buf         = $buf_in;
                     $encoding_log_message .= <<EOM;
@@ -1463,7 +1466,6 @@ EOM
             log_file        => $log_file,
             warning_file    => $warning_file,
             fh_stderr       => $fh_stderr,
-            saw_extruce     => $saw_extrude,
             display_name    => $display_name,
             is_encoded_data => $is_encoded_data,
         );
index 04c290ca74479d02bc24f6717f9574b9f6781b6b..1fe4f294d92fbb72e2200ef9ca047ec8e3c5ca7c 100644 (file)
@@ -44,7 +44,6 @@ sub new {
         log_file        => undef,
         warning_file    => undef,
         fh_stderr       => undef,
-        saw_extruce     => undef,
         display_name    => undef,
         is_encoded_data => undef,
     );
@@ -55,7 +54,6 @@ sub new {
     my $log_file        = $args{log_file};
     my $warning_file    = $args{warning_file};
     my $fh_stderr       = $args{fh_stderr};
-    my $saw_extrude     = $args{saw_extrude};
     my $display_name    = $args{display_name};
     my $is_encoded_data = $args{is_encoded_data};
 
@@ -97,7 +95,6 @@ sub new {
         _is_encoded_data               => $is_encoded_data,
         _saw_code_bug      => -1,                   # -1=no 0=maybe 1=for sure
         _saw_brace_error   => 0,
-        _saw_extrude       => $saw_extrude,
         _output_array      => [],
         _input_stream_name => $input_stream_name,
         _filename_stamp    => $filename_stamp,