From 22c9ea777a701c0b9f219a0260ae3ac2a5d2c0f5 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Mon, 2 Sep 2024 09:06:56 -0700 Subject: [PATCH] update to version 20240903 --- CHANGES.md | 9 ++++++--- MANIFEST | 1 - bin/perltidy | 2 +- docs/ChangeLog.html | 9 ++++++--- docs/Tidy.html | 2 +- docs/perltidy.html | 22 +++++++++++++++------- lib/Perl/Tidy.pm | 12 +++++++----- lib/Perl/Tidy.pod | 2 +- lib/Perl/Tidy/Debugger.pm | 2 +- lib/Perl/Tidy/Diagnostics.pm | 2 +- lib/Perl/Tidy/FileWriter.pm | 2 +- lib/Perl/Tidy/Formatter.pm | 4 ++-- lib/Perl/Tidy/HtmlWriter.pm | 2 +- lib/Perl/Tidy/IOScalar.pm | 2 +- lib/Perl/Tidy/IOScalarArray.pm | 2 +- lib/Perl/Tidy/IndentationItem.pm | 2 +- lib/Perl/Tidy/Logger.pm | 2 +- lib/Perl/Tidy/Tokenizer.pm | 2 +- lib/Perl/Tidy/VerticalAligner.pm | 4 ++-- lib/Perl/Tidy/VerticalAligner/Alignment.pm | 2 +- lib/Perl/Tidy/VerticalAligner/Line.pm | 2 +- perltidyrc | 1 + t/testwide-passthrough.t | 2 +- t/testwide-tidy.t | 2 +- 24 files changed, 55 insertions(+), 39 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a6f94f4b..d95673dc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Perltidy Change Log -## 2024 05 11.10 +## 2024 09 03 - Add partial support for Syntax::Operator::In and Syntax::Keyword::Match (see git #162). @@ -70,8 +70,8 @@ - A option was added to filter unimplemented parameters from perltidy configuration files, suggested in git #146. It works like this: if a line in the config file begins with three dashes followed by a - parameter name (rather than two), then the line will be removed if - the parameter is unknown. Otherwise, a dash will be removed to make + parameter name (rather than two dashes), then the line will be removed + if the parameter is unknown. Otherwise, a dash will be removed to make the line valid. - Parameters --dump-mismatched-args (or -dma) and @@ -81,6 +81,9 @@ - Fixed issue git #143, extend -add-trailing-commas to apply to a list with just a fat comma. + - The minimum perl version is 5.8.1. Previously it was 5.8.0, which was + not correct because of the use of utf8::is_utf8. + - Fixed issue git #142, test failure installing on perl versions before version 5.10. The error caused the new parameter -interbracket-arrow-style=s not to work. Except for this limitation, diff --git a/MANIFEST b/MANIFEST index 0e412d58..0070037d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -37,7 +37,6 @@ lib/Perl/Tidy.pm lib/Perl/Tidy.pod lib/Perl/Tidy/Debugger.pm lib/Perl/Tidy/Diagnostics.pm -lib/Perl/Tidy/diff.txt lib/Perl/Tidy/FileWriter.pm lib/Perl/Tidy/Formatter.pm lib/Perl/Tidy/HtmlWriter.pm diff --git a/bin/perltidy b/bin/perltidy index d8589048..9e4140f4 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -6955,7 +6955,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module =head1 VERSION -This man page documents perltidy version 20240511.10 +This man page documents perltidy version 20240903 =head1 BUG REPORTS diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index 2fea347c..b82d9131 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -1,6 +1,6 @@

Perltidy Change Log

-

2024 05 11.10

+

2024 09 03

- Add partial support for Syntax::Operator::In and Syntax::Keyword::Match
   (see git #162).
@@ -70,8 +70,8 @@
 - A option was added to filter unimplemented parameters from perltidy
   configuration files, suggested in git #146.  It works like this: if
   a line in the config file begins with three dashes followed by a
-  parameter name (rather than two), then the line will be removed if
-  the parameter is unknown. Otherwise, a dash will be removed to make
+  parameter name (rather than two dashes), then the line will be removed
+  if the parameter is unknown. Otherwise, a dash will be removed to make
   the line valid.
 
 - Parameters --dump-mismatched-args (or -dma) and
@@ -81,6 +81,9 @@
 - Fixed issue git #143, extend -add-trailing-commas to apply to a list
   with just a fat comma.
 
+- The minimum perl version is 5.8.1. Previously it was 5.8.0, which was
+  not correct because of the use of utf8::is_utf8.
+
 - Fixed issue git #142, test failure installing on perl versions before
   version 5.10.  The error caused the new parameter
   -interbracket-arrow-style=s not to work. Except for this limitation,
diff --git a/docs/Tidy.html b/docs/Tidy.html
index 803a9a18..f2e4b572 100644
--- a/docs/Tidy.html
+++ b/docs/Tidy.html
@@ -399,7 +399,7 @@
 
 

VERSION

-

This man page documents Perl::Tidy version 20240511.10

+

This man page documents Perl::Tidy version 20240903

LICENSE

diff --git a/docs/perltidy.html b/docs/perltidy.html index 5687b010..59587263 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -4745,7 +4745,7 @@ -
use --dump-unusual-variables to find unused, reused, and certain other variables of interest
+
Use --dump-unusual-variables to find unused, reused, and certain other variables of interest

Variables with certain properties of interest to a programmer can be listed with --dump-unusual-variables or -duv. This parameter must be on the command line, along with a single file name. It causes perltidy to scan the file for certain variable types, write any found to the standard output, and then immediately exit without doing any formatting. For example

@@ -4781,7 +4781,7 @@
s: sigil change but reused bareword
-

These are variables which have the same bareword name but a different sigil ($, @, or %) as another variable in the same scope. For example, this occurs if variables $data and %data share the same scope. This can be confusing and can be avoided by renaming one of the variables.

+

These are variables which have the same bareword name but a different sigil ($, @, or %) as another variable in the same scope. For example, this occurs if variables $data and %data share the same scope. This can also be confusing for the reasons mentioned above and can be avoided by renaming one of the variables.

p: package-crossing variables
@@ -4828,7 +4828,7 @@
Use --warn-variable-types to warn about certain variable types
-

The flag --warn-variable-types=string, or -wvt=string, can be used to produce a warning message if certain of the above variable types are encountered during formatting. All possible variable warnings may be requested with -wvt='*' or -wvt=1.

+

The flag --warn-variable-types=string, or -wvt=string, is the --warn counterpart to --dump-unusual-variables, and can be used to produce a warning message if certain of the above variable types are encountered during formatting. All possible variable warnings may be requested with -wvt='*' or -wvt=1.

For example,

@@ -4842,16 +4842,24 @@

will process somefile.pl normally but issue a warning if either of the issues s or r, described above, are encountered.

-

The u and c options (unused variables and constants) have a limitation: they may be silently turned off if perltidy detects that it is operating on just part of a script. This logic is necessary to avoid warnings when perltidy is run on small snippets of code from within an editor. These options are never turned off if perltidy receives a -wvt parameter on the command line and is operating on a named file.

-

A companion flag, --warn-variable-exclusion-list=string, or -wvxl=string, can be used to skip warning checks for a list of variable names. A leading and/or trailing '*' may be placed on any of these variable names to allow a partial match.

For example,

-
   perltidy -wvt='*' -wvxl='$self $class *_unused'  somefile.pl
+
   perltidy -wvt=1 -wvxl='$self $class *_unused'  somefile.pl

will do all possible checks but not report any warnings for variables $self, $class, and for example $value_unused.

+

This partial match option provides a way to trigger a warning message when a new unused variable is detected in a script. This can be accomplished by adding a unique suffix to the names of existing unused variables, such as _unused. This suffix is then added to the exclusion list.

+ +

As a specific example, consider the following line which is part of some debug code which only references the latter three variables (but might someday need to reference the package variable too).

+ +
    my ( $package_uu, $filename, $line, $subroutine ) = caller();
+ +

The unused variable, $package_uu, has been specially marked with suffix _uu. No type u (unused variable) warning will be produced provided that this wildcard suffix is in the exclusion list:

+ +
    -wvxl='*_uu'
+
Use --dump-mixed-call-parens to find functions called both with and without parens
@@ -5415,7 +5423,7 @@

VERSION

-

This man page documents perltidy version 20240511.10

+

This man page documents perltidy version 20240903

BUG REPORTS

diff --git a/lib/Perl/Tidy.pm b/lib/Perl/Tidy.pm index d9623e05..53426ad6 100644 --- a/lib/Perl/Tidy.pm +++ b/lib/Perl/Tidy.pm @@ -54,10 +54,12 @@ package Perl::Tidy; -# perlver reports minimum version needed is 5.8.0 +# perlver reports minimum version needed is 5.8.1 # 5.004 needed for IO::File # 5.008 needed for wide characters -use 5.008; +# 5.008001 needed for utf8::is_utf8 +# 5.008001 needed for Scalar::Util::refaddr +use 5.008001; use warnings; use strict; use Exporter; @@ -133,7 +135,7 @@ BEGIN { # then the Release version must be bumped, and it is probably past time for # a release anyway. - $VERSION = '20240511.10'; + $VERSION = '20240903'; } ## end BEGIN sub DESTROY { @@ -370,7 +372,7 @@ EOM 1; } or Die( -"Timeout reading stdin using -to=$timeout_in_seconds seconds. Use -tos=0 to skip timeout check.\n" +"Timeout reading stdin using -tos=$timeout_in_seconds seconds. Use -tos=0 to skip timeout check.\n" ); } else { @@ -494,7 +496,7 @@ sub is_char_mode { # This function isolates the call to Perl's internal function # utf8::is_utf8() which is true for strings represented in an 'upgraded - # form'. It is available after Perl version 5.8. + # form'. It is available AFTER Perl version 5.8. # See https://perldoc.perl.org/Encode. # See also comments in Carp.pm and other modules using this function diff --git a/lib/Perl/Tidy.pod b/lib/Perl/Tidy.pod index 3cc5cefb..2a8de7b8 100644 --- a/lib/Perl/Tidy.pod +++ b/lib/Perl/Tidy.pod @@ -469,7 +469,7 @@ The module 'Perl::Tidy' comes with a binary 'perltidy' which is installed when t =head1 VERSION -This man page documents Perl::Tidy version 20240511.10 +This man page documents Perl::Tidy version 20240903 =head1 LICENSE diff --git a/lib/Perl/Tidy/Debugger.pm b/lib/Perl/Tidy/Debugger.pm index 2fb8f5db..18dc0d2f 100644 --- a/lib/Perl/Tidy/Debugger.pm +++ b/lib/Perl/Tidy/Debugger.pm @@ -8,7 +8,7 @@ package Perl::Tidy::Debugger; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; use constant EMPTY_STRING => q{}; use constant SPACE => q{ }; diff --git a/lib/Perl/Tidy/Diagnostics.pm b/lib/Perl/Tidy/Diagnostics.pm index 47dd56e2..5b125297 100644 --- a/lib/Perl/Tidy/Diagnostics.pm +++ b/lib/Perl/Tidy/Diagnostics.pm @@ -18,7 +18,7 @@ package Perl::Tidy::Diagnostics; use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/FileWriter.pm b/lib/Perl/Tidy/FileWriter.pm index 2168c1e8..499608cb 100644 --- a/lib/Perl/Tidy/FileWriter.pm +++ b/lib/Perl/Tidy/FileWriter.pm @@ -16,7 +16,7 @@ package Perl::Tidy::FileWriter; use strict; use warnings; -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; use constant DEVEL_MODE => 0; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 17b7560b..2e5d2a6c 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -76,7 +76,7 @@ use constant BACKSLASH => q{\\}; use Carp; use English qw( -no_match_vars ); use List::Util qw( min max first ); # min, max first are in Perl 5.8 -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; # The Tokenizer will be loaded with the Formatter ##use Perl::Tidy::Tokenizer; # for is_keyword() @@ -9090,7 +9090,7 @@ sub get_qw_list { $string =~ s/^\s*//; # trim left $string =~ s/\s*$//; # trim right - my @list = split SPACE, $string; + my @list = split /\s+/, $string; return ( $K_last_q, \@list ); } ## end sub get_qw_list diff --git a/lib/Perl/Tidy/HtmlWriter.pm b/lib/Perl/Tidy/HtmlWriter.pm index 0570eca0..0b1b5726 100644 --- a/lib/Perl/Tidy/HtmlWriter.pm +++ b/lib/Perl/Tidy/HtmlWriter.pm @@ -7,7 +7,7 @@ package Perl::Tidy::HtmlWriter; use strict; use warnings; -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/IOScalar.pm b/lib/Perl/Tidy/IOScalar.pm index 6cabad80..d3aefd47 100644 --- a/lib/Perl/Tidy/IOScalar.pm +++ b/lib/Perl/Tidy/IOScalar.pm @@ -10,7 +10,7 @@ package Perl::Tidy::IOScalar; use strict; use warnings; use Carp; -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; use constant DEVEL_MODE => 0; use constant EMPTY_STRING => q{}; diff --git a/lib/Perl/Tidy/IOScalarArray.pm b/lib/Perl/Tidy/IOScalarArray.pm index a54340db..89a4ec3b 100644 --- a/lib/Perl/Tidy/IOScalarArray.pm +++ b/lib/Perl/Tidy/IOScalarArray.pm @@ -14,7 +14,7 @@ package Perl::Tidy::IOScalarArray; use strict; use warnings; use Carp; -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; use constant DEVEL_MODE => 0; diff --git a/lib/Perl/Tidy/IndentationItem.pm b/lib/Perl/Tidy/IndentationItem.pm index e6d284ab..0a9a6531 100644 --- a/lib/Perl/Tidy/IndentationItem.pm +++ b/lib/Perl/Tidy/IndentationItem.pm @@ -9,7 +9,7 @@ package Perl::Tidy::IndentationItem; use strict; use warnings; -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; BEGIN { diff --git a/lib/Perl/Tidy/Logger.pm b/lib/Perl/Tidy/Logger.pm index f3dd417e..f08e6f0f 100644 --- a/lib/Perl/Tidy/Logger.pm +++ b/lib/Perl/Tidy/Logger.pm @@ -8,7 +8,7 @@ package Perl::Tidy::Logger; use strict; use warnings; -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; use Carp; use English qw( -no_match_vars ); diff --git a/lib/Perl/Tidy/Tokenizer.pm b/lib/Perl/Tidy/Tokenizer.pm index ad4dc683..7ee5ada0 100644 --- a/lib/Perl/Tidy/Tokenizer.pm +++ b/lib/Perl/Tidy/Tokenizer.pm @@ -33,7 +33,7 @@ use strict; use warnings; use English qw( -no_match_vars ); -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; use Carp; diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 7d070773..93febef0 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -5,9 +5,9 @@ use Carp; { #<<< A non-indenting brace to contain all lexical variables -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; use English qw( -no_match_vars ); -use Scalar::Util 'refaddr'; +use Scalar::Util 'refaddr'; # perl 5.8.1 and later use Perl::Tidy::VerticalAligner::Alignment; use Perl::Tidy::VerticalAligner::Line; diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm index 62c5bd1a..92a4528d 100644 --- a/lib/Perl/Tidy/VerticalAligner/Alignment.pm +++ b/lib/Perl/Tidy/VerticalAligner/Alignment.pm @@ -9,7 +9,7 @@ package Perl::Tidy::VerticalAligner::Alignment; use strict; use warnings; -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; sub new { my ( $class, $rarg ) = @_; diff --git a/lib/Perl/Tidy/VerticalAligner/Line.pm b/lib/Perl/Tidy/VerticalAligner/Line.pm index 7d2ff4a3..6923520b 100644 --- a/lib/Perl/Tidy/VerticalAligner/Line.pm +++ b/lib/Perl/Tidy/VerticalAligner/Line.pm @@ -10,7 +10,7 @@ package Perl::Tidy::VerticalAligner::Line; use strict; use warnings; -our $VERSION = '20240511.10'; +our $VERSION = '20240903'; use English qw( -no_match_vars ); sub AUTOLOAD { diff --git a/perltidyrc b/perltidyrc index 5b0709ef..e8f5da38 100644 --- a/perltidyrc +++ b/perltidyrc @@ -13,6 +13,7 @@ --warn-missing-else # warn if certain of the 'unusual' variables are seen +# variable names ending in '_uu' are excluded from warnings --warn-variable-types='*' --warn-variable-exclusion-list='$self $class *_uu' diff --git a/t/testwide-passthrough.t b/t/testwide-passthrough.t index 877409fd..a26b4885 100644 --- a/t/testwide-passthrough.t +++ b/t/testwide-passthrough.t @@ -33,7 +33,7 @@ sub my_note { # try to work around problem where sub Test::More::note does not exist # in older versions of perl - if ($] >= 5.010) { + if ($] > 5.010) { note($msg); } return; diff --git a/t/testwide-tidy.t b/t/testwide-tidy.t index 13ba6405..a412a5cb 100644 --- a/t/testwide-tidy.t +++ b/t/testwide-tidy.t @@ -28,7 +28,7 @@ sub my_note { # work around problem where sub Test::More::note does not exist # in older versions of perl - if ($] >= 5.010) { + if ($] > 5.010) { note($msg); } return; -- 2.39.5