# Perltidy Change Log
-## 2023 09 12.13
+## 2024 02 02
- Added --valign-signed-numbers, or -vsn. This improves the appearance
of columns of numbers by aligning leading algebraic signs. For example:
produces a file with lines which look something like
- ...
1778:u: my $input_file
6089:r: my $j: reused - see line 6076
note - an optional note referring to another line
The issue is indicated by a letter which may be one of:
+
r: reused variable name
s: sigil change but reused bareword
p: lexical variable with scope in multiple packages
u: unused variable
- This is very useful for locating problem areas and even bugs in code.
- As an example, after it was developed it was applied to the perltidy
- source code and it revealed two bugs; fortunately both were benign.
+ This is very useful for locating problem areas and bugs in code.
- Added a related flag --warn-variable-types=string (-wvt=string) option
to warn if certain types of variables are found in a script. The types
The manual has further details.
- All parameters taking integer values are now checked for
- out-of-range values before processing starts. When a
- minimum or maximum range is exceeded, the new default
- behavior is to write a warning message, reset the
- value to its default setting, and continue. If this default
- behavior causes a problem, it can be changed with the new
- parameter B<--integer-range-check=n>, or B<-irc=n>, as follows:
+ out-of-range values before processing starts. When a maximum or
+ maximum range is exceeded, the new default behavior is to write a
+ warning message, reset the value to its default setting, and continue.
+ This default behavior can be changed with the new parameter
+ --integer-range-check=n, or -irc=n, as follows:
n=0 skip check completely (for stress-testing perltidy only)
n=1 reset bad values to defaults but do not issue a warning
- The -DEBUG option no longer automatically also writes a .LOG file.
Use --show-options if the .LOG file is needed.
- - The run time of this version with all new options in use is no
- greater than the previous version thanks to optimization work.
+ - The run time of this version with all new options in use is no greater
+ than that of the previous version thanks to optimization work.
## 2023 09 12
<h1>Perltidy Change Log</h1>
-<h2>2023 09 12.13</h2>
+<h2>2024 02 02</h2>
<pre><code>- Added --valign-signed-numbers, or -vsn. This improves the appearance
of columns of numbers by aligning leading algebraic signs. For example:
- Added --dump-mixed-call-parens (-dmcp ) which will dump a list of
operators which are sometimes followed by parens and sometimes not.
+ This can be useful for developing a uniform style for selected operators.
Issue git #128. For example
perltidy -dmcp somefile.pl >out.txt
will format as normal but warn if any user subs are called without parens.
- Added --dump-unusual-variables (-duv) option to dump a list of
- variables with certain properties of interest. For example
+ variables with certain properties of interest. For example
perltidy -duv somefile.pl >vars.txt
produces a file with lines which look something like
- ...
1778:u: my $input_file
6089:r: my $j: reused - see line 6076
note - an optional note referring to another line
The issue is indicated by a letter which may be one of:
+
r: reused variable name
s: sigil change but reused bareword
p: lexical variable with scope in multiple packages
u: unused variable
+ This is very useful for locating problem areas and bugs in code.
+
- Added a related flag --warn-variable-types=string (-wvt=string) option
to warn if certain types of variables are found in a script. The types
are a space-separated string which may include 'r', 's', and 'p' but
The manual has further details.
- All parameters taking integer values are now checked for
- out-of-range values before processing starts. When a
- minimum or maximum range is exceeded, the new default
- behavior is to write a warning message, reset the
- value to its default setting, and continue. If this default
- behavior causes a problem, it can be changed with the new
- parameter B<--integer-range-check=n>, or B<-irc=n>, as follows:
+ out-of-range values before processing starts. When a maximum or
+ maximum range is exceeded, the new default behavior is to write a
+ warning message, reset the value to its default setting, and continue.
+ This default behavior can be changed with the new parameter
+ --integer-range-check=n, or -irc=n, as follows:
n=0 skip check completely (for stress-testing perltidy only)
n=1 reset bad values to defaults but do not issue a warning
emit an else block when two elsif blocks were separated by a hanging
side comment (a very rare situation).
+- When braces are detected to be unbalanced, an attempt is made to
+ localize the error by comparing the indentation at closing braces
+ with their actual nesting levels. This can be useful for files which
+ have previously been formatted by perltidy. To illustrate, a test was
+ made in which the closing brace at line 30644 was commented out in
+ a file with a total of over 62000 lines. The new error message is
+
+ Final nesting depth of '{'s is 1
+ The most recent un-matched '{' is on line 6858
+ ...
+ Table of nesting level differences at closing braces.
+ This might help localize brace errors if the file was previously formatted.
+ line: (brace level) - (level expected from old indentation)
+ 30643: 0
+ 30645: 1
+
+ Previously, the error file only indicated that the error in this case
+ was somewhere after line 6858, so the new table is very helpful. Closing
+ brace indentation is checked because it is unambiguous and can be done
+ very efficiently.
+
- The -DEBUG option no longer automatically also writes a .LOG file.
Use --show-options if the .LOG file is needed.
+
+- The run time of this version with all new options in use is no greater
+ than that of the previous version thanks to optimization work.
</code></pre>
<h2>2023 09 12</h2>
<pre><code>- Added support for Switch::Plain syntax, issue git #31.
-- Fixed minor problem where trailing 'unless' clauses were not
+- Fixed minor problem where trailing 'unless' clauses were not
getting vertically aligned.
- Added a parameter --logical-padding or -lop to allow logical padding
'teefile' call parameters. These output streams are rarely used but
they are now treated the same as any 'logfile' stream.
-- add option --break-at-old-semicolon-breakpoints', -bos, requested
+- add option --break-at-old-semicolon-breakpoints', -bos, requested
in RT#131644. This flag will keep lines beginning with a semicolon.
- Added --use-unicode-gcstring to control use of Unicode::GCString for
- evaluating character widths of encoded data. The default is
+ evaluating character widths of encoded data. The default is
not to use this (--nouse-unicode-gcstring). If this flag is set,
- perltidy will look for Unicode::GCString and, if found, will use it
+ perltidy will look for Unicode::GCString and, if found, will use it
to evaluate character display widths. This can improve displayed
vertical alignment for files with wide characters. It is a nice
feature but it is off by default to avoid conflicting formatting
- when there are multiple developers. Perltidy installation does not
- require Unicode::GCString, so users wanting to use this feature need
+ when there are multiple developers. Perltidy installation does not
+ require Unicode::GCString, so users wanting to use this feature need
set this flag and also to install Unicode::GCString separately.
- Added --character-encoding=guess or -guess to have perltidy guess
- if a file (or other input stream) is encoded as -utf8 or some
- other single-byte encoding. This is useful when processing a mixture
+ if a file (or other input stream) is encoded as -utf8 or some
+ other single-byte encoding. This is useful when processing a mixture
of file types, such as utf8 and latin-1.
Please Note: The default encoding has been set to be 'guess'
- instead of 'none'. This seems like the best default, since
+ instead of 'none'. This seems like the best default, since
it allows perltidy work properly with both
utf8 files and older latin-1 files. The guess mode uses Encode::Guess,
- which is included in standard perl distributions, and only tries to
- guess if a file is utf8 or not, never any other encoding. If the guess is
- utf8, and if the file successfully decodes as utf8, then it the encoding
- is assumed to be utf8. Otherwise, no encoding is assumed.
- If you do not want to use this new default guess mode, or have a
- problem with it, you can set --character-encoding=none (the previous
+ which is included in standard perl distributions, and only tries to
+ guess if a file is utf8 or not, never any other encoding. If the guess is
+ utf8, and if the file successfully decodes as utf8, then it the encoding
+ is assumed to be utf8. Otherwise, no encoding is assumed.
+ If you do not want to use this new default guess mode, or have a
+ problem with it, you can set --character-encoding=none (the previous
default) or --character-encoding=utf8 (if you deal with utf8 files).
- Specific encodings of input files other than utf8 may now be given, for
<h2>2020 01 10</h2>
<pre><code>- This release adds a flag to control the feature RT#130394 (allow short nested blocks)
- introduced in the previous release. Unfortunately that feature breaks
+ introduced in the previous release. Unfortunately that feature breaks
RPerl installations, so a control flag has been introduced and that feature is now
off by default. The flag is:
- --one-line-block-nesting=n, or -olbn=n, where n is an integer as follows:
+ --one-line-block-nesting=n, or -olbn=n, where n is an integer as follows:
-olbn=0 break nested one-line blocks into multiple lines [new DEFAULT]
-olbn=1 stable; keep existing nested-one line blocks intact [previous DEFAULT]
- Fixed issue RT#131288: parse error for un-prototyped constant function without parenthesized
call parameters followed by ternary.
-- Fixed issue RT#131360, installation documentation. Added a note that the binary
- 'perltidy' comes with the Perl::Tidy module. They can both normally be installed with
+- Fixed issue RT#131360, installation documentation. Added a note that the binary
+ 'perltidy' comes with the Perl::Tidy module. They can both normally be installed with
'cpanm Perl::Tidy'
</code></pre>
one or more aliases for 'sub', separated by spaces or commas.
For example,
- perltidy -sal='method fun'
+ perltidy -sal='method fun'
will cause the perltidy to treat the words 'method' and 'fun' to be
treated the same as if they were 'sub'.
-- Added flag --space-prototype-paren=i, or -spp=i, to control spacing
+- Added flag --space-prototype-paren=i, or -spp=i, to control spacing
before the opening paren of a prototype, where i=0, 1, or 2:
i=0 no space
i=1 follow input [current and default]
i=2 always space
Previously, perltidy always followed the input.
- For example, given the following input
+ For example, given the following input
sub usage();
<h2>2019 09 15</h2>
-<pre><code>- fixed issue RT#130344: false warning "operator in print statement"
- for "use lib".
+<pre><code>- 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
- 'filename:' for clarification in case multiple files
- are processed, where 'filename' is the name of the input file. If
- input is from the standard input the displayed filename is '<stdin>',
- and if it is from a data structure then displayed 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
+ 'filename:' for clarification in case multiple files
+ are processed, where 'filename' is the name of the input file. If
+ input is from the standard input the displayed filename is '<stdin>',
+ and if it is from a data structure then displayed filename
is '<source_stream>'.
- implement issue RT#130425: check mode. A new flag '--assert-tidy'