From 76c9b0fd550df4e9c4ae45df1f80025f00c3b447 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 23 May 2021 06:23:03 -0700 Subject: [PATCH] minor cleanups --- lib/Perl/Tidy.pm | 24 ++++++++++++------------ local-docs/BugLog.pod | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index d785497f..dd26e5f3 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -835,27 +835,27 @@ EOM # Ready to go... # main loop to process all files in argument list #--------------------------------------------------------------- - my $number_of_files = @ARGV; - my $formatter = undef; - my $tokenizer = undef; + my $formatter = undef; + my $tokenizer = undef; + + # Remove duplicate filenames. Otherwise, for example if the user entered + # perltidy -b myfile.pl myfile.pl + # the backup version of the original would be lost. + if ( @ARGV > 1 ) { + my %seen = (); + @ARGV = grep { !$seen{$_}++ } @ARGV; + } # If requested, process in order of increasing file size # This can significantly reduce perl's virtual memory usage during testing. - if ( $number_of_files > 1 && $rOpts->{'file-size-order'} ) { + if ( @ARGV > 1 && $rOpts->{'file-size-order'} ) { @ARGV = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, -e $_ ? -s $_ : 0 ] } @ARGV; } - # Remove duplicate filenames. Otherwise, for example if the user entered - # perltidy -b myfile.pl myfile.pl - # the backup version of the original would be lost. - if ( $number_of_files > 1 ) { - my %seen = (); - @ARGV = grep { !$seen{$_}++ } @ARGV; - } - + my $number_of_files = @ARGV; while ( my $input_file = shift @ARGV ) { my $fileroot; my @input_file_stat; diff --git a/local-docs/BugLog.pod b/local-docs/BugLog.pod index 1b856f37..1c2946b0 100644 --- a/local-docs/BugLog.pod +++ b/local-docs/BugLog.pod @@ -9,7 +9,7 @@ to -lp formatting mode. This fixes case b1131. -21 May 2021. +21 May 2021, a4ec4c1. =item B @@ -19,7 +19,7 @@ counting the number of line ending commas in lists. This fixes case b1130. -15 May 2021. +15 May 2021, 90cceb1. =item B -- 2.39.5