# Perltidy Change Log
-## 2024 05 11.10
+## 2024 09 03
- Add partial support for Syntax::Operator::In and Syntax::Keyword::Match
(see git #162).
- 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
- 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,
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
=head1 VERSION
-This man page documents perltidy version 20240511.10
+This man page documents perltidy version 20240903
=head1 BUG REPORTS
<h1>Perltidy Change Log</h1>
-<h2>2024 05 11.10</h2>
+<h2>2024 09 03</h2>
<pre><code>- Add partial support for Syntax::Operator::In and Syntax::Keyword::Match
(see git #162).
- 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
- 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,
<h1 id="VERSION">VERSION</h1>
-<p>This man page documents Perl::Tidy version 20240511.10</p>
+<p>This man page documents Perl::Tidy version 20240903</p>
<h1 id="LICENSE">LICENSE</h1>
</ul>
</dd>
-<dt id="use---dump-unusual-variables-to-find-unused-reused-and-certain-other-variables-of-interest"><b>use --dump-unusual-variables to find unused, reused, and certain other variables of interest</b></dt>
+<dt id="Use---dump-unusual-variables-to-find-unused-reused-and-certain-other-variables-of-interest"><b>Use --dump-unusual-variables to find unused, reused, and certain other variables of interest</b></dt>
<dd>
<p>Variables with certain properties of interest to a programmer can be listed with <b>--dump-unusual-variables</b> or <b>-duv</b>. 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</p>
<dt id="s:-sigil-change-but-reused-bareword"><b>s: sigil change but reused bareword</b></dt>
<dd>
-<p>These are variables which have the same bareword name but a different sigil (<b>$</b>, <b>@</b>, or <b>%</b>) as another variable in the same scope. For example, this occurs if variables <b>$data</b> and <b>%data</b> share the same scope. This can be confusing and can be avoided by renaming one of the variables.</p>
+<p>These are variables which have the same bareword name but a different sigil (<b>$</b>, <b>@</b>, or <b>%</b>) as another variable in the same scope. For example, this occurs if variables <b>$data</b> and <b>%data</b> 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>
</dd>
<dt id="p:-package-crossing-variables"><b>p: package-crossing variables</b></dt>
<dt id="Use---warn-variable-types-to-warn-about-certain-variable-types"><b>Use --warn-variable-types to warn about certain variable types</b></dt>
<dd>
-<p>The flag <b>--warn-variable-types=string</b>, or <b>-wvt=string</b>, 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 <b>-wvt='*'</b> or <b>-wvt=1</b>.</p>
+<p>The flag <b>--warn-variable-types=string</b>, or <b>-wvt=string</b>, is the <b>--warn</b> counterpart to <b>--dump-unusual-variables</b>, 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 <b>-wvt='*'</b> or <b>-wvt=1</b>.</p>
<p>For example,</p>
<p>will process <i>somefile.pl</i> normally but issue a warning if either of the issues <b>s</b> or <b>r</b>, described above, are encountered.</p>
-<p>The <b>u</b> and <b>c</b> 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 <b>-wvt</b> parameter on the command line and is operating on a named file.</p>
-
<p>A companion flag, <b>--warn-variable-exclusion-list=string</b>, or <b>-wvxl=string</b>, 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.</p>
<p>For example,</p>
-<pre><code> perltidy -wvt='*' -wvxl='$self $class *_unused' somefile.pl</code></pre>
+<pre><code> perltidy -wvt=1 -wvxl='$self $class *_unused' somefile.pl</code></pre>
<p>will do all possible checks but not report any warnings for variables <code>$self</code>, <code>$class</code>, and for example <code>$value_unused</code>.</p>
+<p>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 <code>_unused</code>. This suffix is then added to the exclusion list.</p>
+
+<p>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).</p>
+
+<pre><code> my ( $package_uu, $filename, $line, $subroutine ) = caller();</code></pre>
+
+<p>The unused variable, <code>$package_uu</code>, has been specially marked with suffix <code>_uu</code>. No type <b>u</b> (unused variable) warning will be produced provided that this wildcard suffix is in the exclusion list:</p>
+
+<pre><code> -wvxl='*_uu'</code></pre>
+
</dd>
<dt id="Use---dump-mixed-call-parens-to-find-functions-called-both-with-and-without-parens"><b>Use --dump-mixed-call-parens to find functions called both with and without parens</b></dt>
<dd>
<h1 id="VERSION">VERSION</h1>
-<p>This man page documents perltidy version 20240511.10</p>
+<p>This man page documents perltidy version 20240903</p>
<h1 id="BUG-REPORTS">BUG REPORTS</h1>
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;
# 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 {
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 {
# 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
=head1 VERSION
-This man page documents Perl::Tidy version 20240511.10
+This man page documents Perl::Tidy version 20240903
=head1 LICENSE
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{ };
use strict;
use warnings;
use English qw( -no_match_vars );
-our $VERSION = '20240511.10';
+our $VERSION = '20240903';
use constant EMPTY_STRING => q{};
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{};
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()
$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
package Perl::Tidy::HtmlWriter;
use strict;
use warnings;
-our $VERSION = '20240511.10';
+our $VERSION = '20240903';
use Carp;
use English qw( -no_match_vars );
use strict;
use warnings;
use Carp;
-our $VERSION = '20240511.10';
+our $VERSION = '20240903';
use constant DEVEL_MODE => 0;
use constant EMPTY_STRING => q{};
use strict;
use warnings;
use Carp;
-our $VERSION = '20240511.10';
+our $VERSION = '20240903';
use constant DEVEL_MODE => 0;
use strict;
use warnings;
-our $VERSION = '20240511.10';
+our $VERSION = '20240903';
BEGIN {
package Perl::Tidy::Logger;
use strict;
use warnings;
-our $VERSION = '20240511.10';
+our $VERSION = '20240903';
use Carp;
use English qw( -no_match_vars );
use warnings;
use English qw( -no_match_vars );
-our $VERSION = '20240511.10';
+our $VERSION = '20240903';
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;
use strict;
use warnings;
-our $VERSION = '20240511.10';
+our $VERSION = '20240903';
sub new {
my ( $class, $rarg ) = @_;
use strict;
use warnings;
-our $VERSION = '20240511.10';
+our $VERSION = '20240903';
use English qw( -no_match_vars );
sub AUTOLOAD {
--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'
# 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;
# 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;