]> git.donarmstrong.com Git - perltidy.git/commitdiff
update VERSION to 20210111
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 10 Jan 2021 14:18:50 +0000 (06:18 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 10 Jan 2021 14:18:50 +0000 (06:18 -0800)
27 files changed:
CHANGES.md
bin/perltidy
dev-bin/perltidy_random_run.pl
docs/BugLog.html
docs/ChangeLog.html
docs/Tidy.html
docs/perltidy.html
lib/Perl/Tidy.pm
lib/Perl/Tidy.pod
lib/Perl/Tidy/Debugger.pm
lib/Perl/Tidy/DevNull.pm
lib/Perl/Tidy/Diagnostics.pm
lib/Perl/Tidy/FileWriter.pm
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/HtmlWriter.pm
lib/Perl/Tidy/IOScalar.pm
lib/Perl/Tidy/IOScalarArray.pm
lib/Perl/Tidy/IndentationItem.pm
lib/Perl/Tidy/LineBuffer.pm
lib/Perl/Tidy/LineSink.pm
lib/Perl/Tidy/LineSource.pm
lib/Perl/Tidy/Logger.pm
lib/Perl/Tidy/Tokenizer.pm
lib/Perl/Tidy/VerticalAligner.pm
lib/Perl/Tidy/VerticalAligner/Alignment.pm
lib/Perl/Tidy/VerticalAligner/Line.pm
local-docs/BugLog.pod

index d195cc92fdbb6e34d8053060bbaabd5932307164..066c3fb3e6b721681386367e44e3ae8c9a52a0b3 100644 (file)
@@ -1,24 +1,60 @@
 # Perltidy Change Log
 
-## 2020 12 07 xx
+## 2021 01 11
 
-    - Fixed issue git #51, in which closing qw pattern delimiters not always
+    - Fixed issue git #49, -se breaks warnings exit status behavior.
+    The exit status flag was not always being set when the -se flag was set.
+
+    - Some improvements have been made in the method for aligning side comments.
+    One of the problems that was fixed is that there was a tendency for side comment
+    placement to drift to the right in long scripts.  Programs with side comments
+    may have a few changes.
+
+    - Some improvements have been made in formatting qw quoted lists.  This
+    fixes issue git #51, in which closing qw pattern delimiters not always
     following the settings specified by the --closing-token-indentation=n settings.
     Now qw closing delimiters ')', '}' and ']' follow these flags, and the
     delimiter '>' follows the flag for ')'.  Other qw pattern delimiters remain
     indented as the are now.  This change will cause some small formatting changes
     in some existing programs.
 
-    - Fixed issue git #49, -se breaks warnings exit status behavior.
-    The exit status flag was not always being set when the -se flag was set.
+    - Another change involving qw lists is that they get full indentation,
+    rather than just continuation indentation, if
+
+         (1) the closing delimiter is one of } ) ] > and is on a separate line,
+         (2) the opening delimiter  (i.e. 'qw{' ) is also on a separate line, and
+         (3) the -xci flag (--extended-continuation-indentation) is set.
+
+    This improves formatting when qw lists are contained in other lists. For example,
+
+            # OLD: perltidy
+            foreach $color (
+                qw(
+                AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
+                SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
+                ),
+                qw(
+                LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
+                SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
+                )
+              )
+
+            # NEW, perltidy -xci
+            foreach $color (
+                qw(
+                    AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
+                    SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
+                ),
+                qw(
+                    LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
+                    SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
+                )
+              )
 
     - Some minor improvements have been made to the rules for formatting
     some edge vertical alignment cases, usually involving two dissimilar lines.
 
-    - Some improvements have been made to the location of side comments.
-
-    - Some minor issues that the average user would not encounter were found
-      and fixed. They can be seen in the more complete list of updates at
+    - A more complete list of updates is at
 
            https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod
 
index ed90fa183a2ede8f8eee6f82dfa4e0a648c2e31d..891ed7f05fc523c790bfbf28c44ba1e48002b019 100755 (executable)
@@ -746,23 +746,40 @@ number of spaces assigned to a full indentation level on the B<-i=n> command, or
 
 =item B<-xci>, B<--extended-continuation-indentation>
 
-This flag causes continuation indentation to "extend" deeper into structures.
-If you use B<-ci=n> and B<-i=n> with the same value of B<n> you will probably
-want to set this flag.  Since this is a fairly new flag, the default is B<-nxci> 
-to avoid disturbing existing formatting.  
-
-Here is an explanation. There are two common strategies for continuation
-indentation.  One is the strategy recommend in the original perl style
-guidelines, in which B<-ci=2> and B<-i=4>.  The other is the strategy is the
-strategy recommended for example in the "Perl Best Practices" book by Conway,
-in which B<-ci=4> and B<-i=4>.  The default formatting in perltidy works fairly
-well with the orignal perl style, but problems arise when B<-ci> and B<-i> are
-given equal values as in the B<pbp> style, particularly with ternary
-statements.  The B<-xci> flag was added to fix this.  It may be used with
-any value of B<-ci> but is particularly helpful when B<-ci> and B<-i> are given
-similar values.
-
-For an illustration, please see the section L<"B<-pbp>, B<--perl-best-practices>">.
+This flag allows perltidy to use some improvements which have been made to its
+indentation model. One of the things it does is "extend" continuation
+indentation deeper into structures, hence the name.  The improved indentation
+is particularly noticable when the flags B<-ci=n> and B<-i=n> use the same value of
+B<n>. There are no significant disadvantages to using this flag, but to avoid
+disturbing existing formatting the default is not to use it, B<-nxci>.
+
+Please see the section L<"B<-pbp>, B<--perl-best-practices>"> for an example of
+how this flag can improve the formatting of ternary statements.  It can also
+improve indentation of some multi-line qw lists as shown below.
+
+            # perltidy
+            foreach $color (
+                qw(
+                AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
+                SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
+                ),
+                qw(
+                LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
+                SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
+                )
+              )
+
+            # perltidy -xci
+            foreach $color (
+                qw(
+                    AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
+                    SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
+                ),
+                qw(
+                    LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
+                    SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
+                )
+              )
 
 =item B<-sil=n> B<--starting-indentation-level=n>   
 
@@ -4588,7 +4605,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module
 
 =head1 VERSION
 
-This man page documents perltidy version 20201207
+This man page documents perltidy version 20210111
 
 =head1 BUG REPORTS
 
index e69c42e2d6967582cf14a344a06f769f150f0318..f8210feb5978e3e00ac2c22f4faf2bf27262e7dc 100755 (executable)
@@ -478,9 +478,9 @@ if (@saved_for_deletion) {
 if (@problems) {
     print STDERR <<EOM;
 
-=============================
-SUMMARY OF POSSIBLE PROBLEMS:
-=============================
+$hash =============================
+$hash SUMMARY OF POSSIBLE PROBLEMS:
+$hash =============================
 EOM
 
     foreach my $nf (@problems) {
@@ -491,8 +491,8 @@ EOM
         my $num = @chkfile_errors;
         $num = 20 if ( $num > 20 );
         print STDERR <<EOM;
-Some check files with errors (search above for '**ERROR'):
-(@chkfile_errors[1..$num-1])
+$hash Some check files with errors (search above for '**ERROR'):
+$hash (@chkfile_errors[1..$num-1])
 EOM
     }
     if (@size_errors) {
@@ -500,8 +500,8 @@ EOM
         my $num = @size_errors;
         $num = 20 if ( $num > 20 );
         print STDERR <<EOM;
-Some files with definite size errors (search above for '**ERROR'):
-(@size_errors[1..$num-1])
+$hash Some files with definite size errors (search above for '**ERROR'):
+$hash (@size_errors[1..$num-1])
 EOM
     }
     if (@syntax_errors) {
@@ -509,8 +509,8 @@ EOM
         my $num = @syntax_errors;
         $num = 20 if ( $num > 20 );
         print STDERR <<EOM;
-Some files with definite size errors (search above for '**ERROR'):
-(@syntax_errors[1..$num-1])
+$hash Some files with definite size errors (search above for '**ERROR'):
+$hash (@syntax_errors[1..$num-1])
 EOM
     }
 }
index cb5402f4a1148780f748c991b038b041bbe8f135..17d1b0c57122211d482cc9b24e07e586a4b2f581 100644 (file)
 
 
 <ul id="index">
+  <li><a href="#Issues-fixed-after-release-20201207">Issues fixed after release 20201207</a></li>
   <li><a href="#Issues-fixed-after-release-20201202">Issues fixed after release 20201202</a></li>
   <li><a href="#Issues-fixed-after-release-20201001">Issues fixed after release 20201001</a></li>
   <li><a href="#Issues-fixed-after-release-20200907">Issues fixed after release 20200907</a></li>
   <li><a href="#Open-Issues">Open Issues</a></li>
+  <li><a href="#POD-ERRORS">POD ERRORS</a></li>
 </ul>
 
+<h1 id="Issues-fixed-after-release-20201207">Issues fixed after release 20201207</h1>
+
+<dl>
+
+<dt id="Improve-indentation-of-multiline-qw-quotes-when--xci-flag-is-set"><b>Improve indentation of multiline qw quotes when -xci flag is set</b></dt>
+<dd>
+
+<p>The indentation of multiline qw quotes runs into problems when there is nesting, as in the following.</p>
+
+<pre><code>    # OLD: perltidy -xci -ci=4
+    for my $feep (
+        qw{
+        pwage      pwchange   pwclass    pwcomment
+        pwexpire   pwgecos    pwpasswd   pwquota
+        }
+        )</code></pre>
+
+<p>The problem is that multiline qw quotes do not get the same indentation treatment as lists.</p>
+
+<p>This update fixes this in the following circumstances:</p>
+
+<pre><code>  - the leading qw( and trailing ) are on separate lines
+  - the closing token is one of ) } ] &gt;
+  - the -xci flag is set</code></pre>
+
+<p>The above example becomes</p>
+
+<pre><code>    # NEW: perltidy -xci -ci=4
+    for my $feep (
+        qw{
+            pwage      pwchange   pwclass    pwcomment
+            pwexpire   pwgecos    pwpasswd   pwquota
+        }
+        )</code></pre>
+
+<p>The reason that the -xci flag is required is to minimize unexpected changes to existing scripts. The extra indentation is removed if the -wn flag is also given, so both old and new versions with -wn give</p>
+
+<pre><code>    # OLD and NEW: perltidy -wn -xci -ci=4
+    for my $feep ( qw{
+        pwage      pwchange   pwclass    pwcomment
+        pwexpire   pwgecos    pwpasswd   pwquota
+    } )</code></pre>
+
+<p>This update added 8 Jan 2021, 474cfa8.</p>
+
+</dd>
+<dt id="Improve-alignment-of-leading-equals-in-rare-situation"><b>Improve alignment of leading equals in rare situation</b></dt>
+<dd>
+
+<p>A rare case in which a vertical alignment opportunity of leading equals was missed has been fixed. This involved lines with additional varying alignment tokens, such as &#39;unless&#39; and second &#39;=&#39; in lines 1-3 below. In this example lines 4 and 5 were not &#39;looking&#39; backwards to align their leading equals.</p>
+
+<pre><code>    # OLD:
+    $them = &#39;localhost&#39; unless ( $them = shift );
+    $cmd  = &#39;!print&#39;    unless ( $cmd  = shift );
+    $port = 2345        unless ( $port = shift );
+    $saddr = &#39;S n a4 x8&#39;;
+    $SIG{&#39;INT&#39;} = &#39;dokill&#39;;
+
+    # NEW
+    $them       = &#39;localhost&#39; unless ( $them = shift );
+    $cmd        = &#39;!print&#39;    unless ( $cmd  = shift );
+    $port       = 2345        unless ( $port = shift );
+    $saddr      = &#39;S n a4 x8&#39;;
+    $SIG{&#39;INT&#39;} = &#39;dokill&#39;;</code></pre>
+
+<p>Fixed 5 Jan 2021, 9244678.</p>
+
+</dd>
+<dt id="Moved-previous-patch-to-a-better-location"><b>Moved previous patch to a better location</b></dt>
+<dd>
+
+<p>The previous patch was moved to a location where it only applies if there is a side comment on the line with a closing token. This minimizes changes to other side comment locations.</p>
+
+</dd>
+<dt id="Further-improvement-in-rules-for-forgetting-last-side-comment-location"><b>Further improvement in rules for forgetting last side comment location</b></dt>
+<dd>
+
+<p>The code for forgetting the last side comment location was rewritten to improve formatting in some edge cases. The update also fixes a very rare problem discovered during testing and illustrated with the following snippet. The problem occurs for the particular combination of parameters -sct -act=2 and when a closing paren has a side comment:</p>
+
+<pre><code>    OLD: perltidy -sct -act=2
+    foreach $line (
+        [0, 1, 2], [3, 4, 5], [6, 7, 8],    # rows
+        [0, 3, 6], [1, 4, 7], [2, 5, 8],    # columns
+        [0, 4, 8], [2, 4, 6])                                     # diagonals
+
+    NEW: perltidy -sct -act=2
+    foreach $line (
+        [0, 1, 2], [3, 4, 5], [6, 7, 8],    # rows
+        [0, 3, 6], [1, 4, 7], [2, 5, 8],    # columns
+        [0, 4, 8], [2, 4, 6])    # diagonals</code></pre>
+
+<p>In the old version the last side comment was aligned before the closing paren was attached to the previous line, causing the final side comment to be far to the right. A patch in the new version just places it at the default location. This is the best than can be done for now, but is preferable to the old formatting. 3 Jan 2021, e57d8db.</p>
+
+</dd>
+<dt id="Improve-rule-for-forgetting-last-side-comment-location"><b>Improve rule for forgetting last side comment location</b></dt>
+<dd>
+
+<p>The code which aligns side comments remembers the most recent side comment and in some cases tries to start aligning at that column for later side comments. Sometimes the old side comment column was being remembered too long, causing occasional poor formatting and causing a noticable and unexpected drift of side comment locations to the right. The rule for forgetting the previous side comment column has been modified to reduce this problem. The new rule is essentially to forget the previous side comment location at a new side comment with different indentation level or significant number of lines without side comments (about 12). The previous implementation forgetting changes in indentation level across code blocks only. Below is an example where the old method gets into trouble and the new method is ok:</p>
+
+<pre><code>        # OLD:
+        foreach my $r (@$array) {
+            $Dat{Data}{ uc $r-&gt;[0] } = join( &quot;;&quot;, @$r );    # store all info
+            my $name = $Dat{GivenName}{ uc $r-&gt;[0] } || $r-&gt;[1];
+
+            # pass array as ad-hoc string, mark missing values
+            $Dat{Data}{ uc $r-&gt;[0] } = join(
+                &quot;;&quot;,
+                (
+                    uc $r-&gt;[0], uc $name,                   # symbol, name
+                    $r-&gt;[2],    $r-&gt;[3], $r-&gt;[4],           # price, date, time
+                    $r-&gt;[5],    $r-&gt;[6],                    # change, %change
+                    $r-&gt;[7],    &quot;-&quot;, &quot;-&quot;, &quot;-&quot;,    # vol, avg vol, bid,ask
+                    $r-&gt;[8],               $r-&gt;[9],     # previous, open
+                    &quot;$r-&gt;[10] - $r-&gt;[11]&quot;, $r-&gt;[12],    # day range,year range,
+                    &quot;-&quot;,                   &quot;-&quot;, &quot;-&quot;, &quot;-&quot;, &quot;-&quot;
+                )
+            );                                          # eps,p/e,div,yld,cap
+        }</code></pre>
+
+<p>The second side comment is at a deeper indentation level but was not being forgotten, causing line length limits to interfere with later alignment. The new rule gives a better result:</p>
+
+<pre><code>        # NEW:
+        foreach my $r (@$array) {
+            $Dat{Data}{ uc $r-&gt;[0] } = join( &quot;;&quot;, @$r );    # store all info
+            my $name = $Dat{GivenName}{ uc $r-&gt;[0] } || $r-&gt;[1];
+
+            # pass array as ad-hoc string, mark missing values
+            $Dat{Data}{ uc $r-&gt;[0] } = join(
+                &quot;;&quot;,
+                (
+                    uc $r-&gt;[0], uc $name,               # symbol, name
+                    $r-&gt;[2],    $r-&gt;[3], $r-&gt;[4],       # price, date, time
+                    $r-&gt;[5],    $r-&gt;[6],                # change, %change
+                    $r-&gt;[7],    &quot;-&quot;, &quot;-&quot;, &quot;-&quot;,          # vol, avg vol, bid,ask
+                    $r-&gt;[8],               $r-&gt;[9],     # previous, open
+                    &quot;$r-&gt;[10] - $r-&gt;[11]&quot;, $r-&gt;[12],    # day range,year range,
+                    &quot;-&quot;,                   &quot;-&quot;, &quot;-&quot;, &quot;-&quot;, &quot;-&quot;
+                )
+            );    # eps,p/e,div,yld,cap
+        }</code></pre>
+
+<p>The following exampel shows an unexpected alignment in the cascade of trailing comments which are aligned but slowly separating from their closing containers:</p>
+
+<pre><code>    # OLD:
+    {
+        $a = [
+            Cascade    =&gt; $menu_cb,
+            -menuitems =&gt; [
+                [ Checkbutton =&gt; &#39;Oil checked&#39;, -variable =&gt; \$OIL ],
+                [
+                    Button   =&gt; &#39;See current values&#39;,
+                    -command =&gt; [
+                        \&amp;see_vars, $TOP,
+
+                    ],    # end see_vars
+                ],        # end button
+            ],            # end checkbutton menuitems
+        ];                # end checkbuttons cascade
+    }</code></pre>
+
+<p>This was caused by forgetting side comments only across code block changes. The new result is more reasonable:</p>
+
+<pre><code>    # NEW:
+    {
+        $a = [
+            Cascade    =&gt; $menu_cb,
+            -menuitems =&gt; [
+                [ Checkbutton =&gt; &#39;Oil checked&#39;, -variable =&gt; \$OIL ],
+                [
+                    Button   =&gt; &#39;See current values&#39;,
+                    -command =&gt; [
+                        \&amp;see_vars, $TOP,
+
+                    ],    # end see_vars
+                ],    # end button
+            ],    # end checkbutton menuitems
+        ];    # end checkbuttons cascade
+    }</code></pre>
+
+<p>This change will cause occasional differences in side comment locations from previous versions but overall it gives fewer unexpected results so it is a worthwhile change. 29-Dec-2020, 76993f4.</p>
+
+</dd>
+<dt id="Fixed-very-minor-inconsistency-in-redefining-lists-after-prune-step"><b>Fixed very minor inconsistency in redefining lists after prune step</b></dt>
+<dd>
+
+<p>In rare cases it is necessary to update the type of lists, and this influences vertical alignment. This update fixes a minor inconsistency in doing this. In some rare cases with complex list elements vertical alignment can be improved. 27 Dec, 2020, 751faec.</p>
+
+<pre><code>            # OLD
+            return join( &#39;&#39;,
+                $pre,   &#39;&lt;IMG &#39;,   $iconsizes{$alt} || &#39;&#39;,
+                $align, &#39;BORDER=&#39;, $nav_border,
+                &#39; ALT=&quot;&#39;, $alt,        &quot;\&quot;\n&quot;,
+                &#39; SRC=&quot;&#39;, $ICONSERVER, &quot;/$icon&quot;,
+                &#39;&quot;&gt;&#39; );
+
+            # NEW
+            return join( &#39;&#39;,
+                $pre,     &#39;&lt;IMG &#39;,     $iconsizes{$alt} || &#39;&#39;,
+                $align,   &#39;BORDER=&#39;,   $nav_border,
+                &#39; ALT=&quot;&#39;, $alt,        &quot;\&quot;\n&quot;,
+                &#39; SRC=&quot;&#39;, $ICONSERVER, &quot;/$icon&quot;,
+                &#39;&quot;&gt;&#39; );</code></pre>
+
+</dd>
+<dt id="Improved-vertical-alignment-of-some-edge-cases"><b>Improved vertical alignment of some edge cases</b></dt>
+<dd>
+
+<p>The existing rules for aligning two lines with very different lengths were rejecting some good alignments, such as the first line of numbers in the example below:</p>
+
+<pre><code>    # OLD:
+    @gg_3 = (
+        [
+            0.0, 1.360755E-2, 9.569446E-4, 9.569446E-4,
+            1.043498E-3, 1.043498E-3
+        ],
+        [
+            9.569446E-4, 9.569446E-4, 0.0, 7.065964E-5,
+            1.422811E-4, 1.422811E-4
+        ],
+        ...
+    );
+
+    # NEW:
+    @gg_3 = (
+        [
+            0.0,         1.360755E-2, 9.569446E-4, 9.569446E-4,
+            1.043498E-3, 1.043498E-3
+        ],
+        [
+            9.569446E-4, 9.569446E-4, 0.0, 7.065964E-5,
+            1.422811E-4, 1.422811E-4
+        ],
+        ...
+    );</code></pre>
+
+<p>The rule in sub &#39;two_line_pad&#39; was updated to allow alignment of any lists if the patterns match exactly (all numbers in this case). Updated 27-Dec-2020, 035d2b7.</p>
+
+</dd>
+<dt id="Avoid--lp-style-formatting-of-lists-containing-multiline-qw-quotes"><b>Avoid -lp style formatting of lists containing multiline qw quotes</b></dt>
+<dd>
+
+<p>The -lp formatting style often does not work well when lists contain multiline qw quotes. This update avoids this problem by not formatting such lists with the -lp style. For example,</p>
+
+<pre><code>    # OLD, perltidy -gnu
+    @EXPORT = (
+        qw(
+          i Re Im rho theta arg
+          sqrt log ln
+          log10 logn cbrt root
+          cplx cplxe
+          ),
+        @trig,
+              );
+
+
+    # NEW, perltidy -gnu
+    @EXPORT = (
+        qw(
+          i Re Im rho theta arg
+          sqrt log ln
+          log10 logn cbrt root
+          cplx cplxe
+        ),
+        @trig,
+    );</code></pre>
+
+<p>27-Dec-2020, 948c9bd.</p>
+
+</dd>
+<dt id="improve-formatting-of-multiline-qw"><b>improve formatting of multiline qw</b></dt>
+<dd>
+
+<p>This update adds a sequence numbering system for multiline qw quotes. In the perltidy tokenizer normal container pair types, like { }, (), [], are given unique serial numbers which are used as keys to data structures. qw quoted lists do not get serial numbers by the tokenizer, so this update creates a separate serial number scheme for them to correct this problem. One formatting problem that this solves is that of preventing the closing token of a multiline quote from being outdented more than the opening token. This is a general formatting rule which should be followed. Without a sequence number, the closing qw token could not lookup its corresponding opening indentation so it had to resort to a default, breaking the rule, as in the following:</p>
+
+<pre><code>    # OLD, perltidy -wn
+    # qw line
+    if ( $pos == 0 ) {
+        @return = grep( /^$word/,
+            sort qw(
+              ! a b d h i m o q r u autobundle clean
+              make test install force reload look
+        ) ); #&lt;-- outdented more than &#39;sort&#39;
+    }
+
+    # Here is the same with a list instead of a qw; note how the
+    # closing sort paren does not outdent more than the &#39;sort&#39; line.
+    # This is the desired result for qw.
+    # perltidy -wn
+    if ( $pos == 0 ) {
+        @return = grep( /^$word/,
+            sort (
+
+                &#39;!&#39;,          &#39;a&#39;, &#39;b&#39;, &#39;d&#39;, &#39;h&#39;, &#39;i&#39;, &#39;m&#39;, &#39;o&#39;, &#39;q&#39;, &#39;r&#39;, &#39;u&#39;,
+                &#39;autobundle&#39;, &#39;clean&#39;,
+                &#39;make&#39;,       &#39;test&#39;, &#39;install&#39;, &#39;force&#39;, &#39;reload&#39;, &#39;look&#39;
+            ) );  #&lt;-- not outdented more than &#39;sort&#39;
+    }
+
+    # NEW (perltidy -wn)
+    if ( $pos == 0 ) {
+        @return = grep( /^$word/,
+            sort qw(
+              ! a b d h i m o q r u autobundle clean
+              make test install force reload look
+            ) ); #&lt;-- not outdented more than sort
+    }</code></pre>
+
+<p>Here is another example # OLD: $_-&gt;meta-&gt;make_immutable( inline_constructor =&gt; 0, constructor_name =&gt; &quot;_new&quot;, inline_accessors =&gt; 0, ) for qw( Class::XYZ::Package Class::XYZ::Module Class::XYZ::Class</p>
+
+<pre><code>        Class::XYZ::Overload
+    );  #&lt;-- outdented more than the line with &#39;for qw(&#39;
+
+    # NEW:
+    $_-&gt;meta-&gt;make_immutable(
+        inline_constructor =&gt; 0,
+        constructor_name   =&gt; &quot;_new&quot;,
+        inline_accessors   =&gt; 0,
+      )
+      for qw(
+      Class::XYZ::Package
+      Class::XYZ::Module
+      Class::XYZ::Class
+
+      Class::XYZ::Overload
+      ); #&lt;-- outdented same as the line with &#39;for qw(&#39;</code></pre>
+
+<p>26 Dec 2020, cdbf0e4.</p>
+
+</dd>
+<dt id="improve-list-marking-method"><b>improve list marking method</b></dt>
+<dd>
+
+<p>In the process of making vertical alignments, lines which are simple lists of items are treated different from other lines. The old method for finding and marking these lines had a few problems which are corrected with this update. The main problem was that the old method ran into trouble when there were side comments. For example, the old method was not marking the following list and as a result the two columns of values were not aligned:</p>
+
+<pre><code>    # OLD
+    return (
+        $startpos, $ldelpos - $startpos,         # PREFIX
+        $ldelpos,  1,                            # OPENING BRACKET
+        $ldelpos + 1, $endpos - $ldelpos - 2,    # CONTENTS
+        $endpos - 1, 1,                          # CLOSING BRACKET
+        $endpos, length($$textref) - $endpos,    # REMAINDER
+    );
+
+    # NEW
+    return (
+        $startpos,    $ldelpos - $startpos,           # PREFIX
+        $ldelpos,     1,                              # OPENING BRACKET
+        $ldelpos + 1, $endpos - $ldelpos - 2,         # CONTENTS
+        $endpos - 1,  1,                              # CLOSING BRACKET
+        $endpos,      length($$textref) - $endpos,    # REMAINDER
+    );</code></pre>
+
+<p>Another problem was that occasionally unwanted alignments were made between lines which were not really lists because the lines were incorrectly marked. For example (note padding after first comma)</p>
+
+<pre><code>    # OLD: (undesirable alignment)
+    my ( $isig2, $chisq ) = ( 1 / ( $sig * $sig ), 0 );
+    my ( $ym,    $al, $cov, $bet, $olda, $ochisq, $di, $pivt, $info ) =
+      map { null } ( 0 .. 8 );
+
+    # NEW: (no alignment)
+    my ( $isig2, $chisq ) = ( 1 / ( $sig * $sig ), 0 );
+    my ( $ym, $al, $cov, $bet, $olda, $ochisq, $di, $pivt, $info ) =
+      map { null } ( 0 .. 8 );</code></pre>
+
+<p>This update was made 22 Dec 2020, 36d4c35.</p>
+
+</dd>
+<dt id="Fix-git-51-closing-quote-pattern-delimiters-not-following--cti-flag-settings"><b>Fix git #51, closing quote pattern delimiters not following -cti flag settings</b></dt>
+<dd>
+
+<p>Closing pattern delimiter tokens of qw quotes were not following the -cti flag settings for containers in all cases, as would be expected, in particular when followed by a comma. For example, the closing qw paren below was indented with continuation indentation but would not have that extra indentation if it followed the default -cpi setting for a paren:</p>
+
+<pre><code>    # OLD:
+    @EXPORT = (
+        qw(
+          i Re Im rho theta arg
+          sqrt log ln
+          log10 logn cbrt root
+          cplx cplxe
+          ),
+        @trig
+    );
+
+    # NEW
+    @EXPORT = (
+        qw(
+            i Re Im rho theta arg
+            sqrt log ln
+            log10 logn cbrt root
+            cplx cplxe
+        ),
+        @trig
+    );</code></pre>
+
+<p>This update makes closing qw quote terminators follow the settings for their corresponding container tokens as closely as possible. For a closing &#39;&gt;&#39; the setting for a closing paren will now be followed. Other closing qw terminators will remain indented, to minimize changes to existing formatting. For example (&#39;&gt;&#39; is outdented):</p>
+
+<pre><code>    @EXPORT = (
+        qw&lt;
+          i Re Im rho theta arg
+          sqrt log ln
+          log10 logn cbrt root
+          cplx cplxe
+        &gt;,
+        @trig
+    );</code></pre>
+
+<p>but (&#39;;&#39; remains indented):</p>
+
+<pre><code>    @EXPORT = (
+        qw;
+          i Re Im rho theta arg
+          sqrt log ln
+          log10 logn cbrt root
+          cplx cplxe
+          ;,
+        @trig
+    );</code></pre>
+
+<p>This update was added 18 Dec 2020 and modified 24 Dec 2020, 538688f.</p>
+
+</dd>
+<dt id="Update-manual-pages-regarding-issue-git-50"><b>Update manual pages regarding issue git #50</b></dt>
+<dd>
+
+<p>Additional wording was added to the man pages regarding situations in which perltidy does not change whitespace. This update was added 17 Dec 2020.</p>
+
+</dd>
+<dt id="Rewrote-sub-check_match"><b>Rewrote sub check_match</b></dt>
+<dd>
+
+<p>Moved inner part of sub check_match into sub match_line_pair in order to make info available earlier. This gave some minor alignment improvements. This was done 16 Dec 2020, 7ba4f3b.</p>
+
+<pre><code>    # OLD:
+    @tests = (
+        @common,     &#39;$_&#39;,
+        &#39;&quot;\$_&quot;&#39;,     &#39;@_&#39;,
+        &#39;&quot;\@_&quot;&#39;,     &#39;??N&#39;,
+        &#39;&quot;??N&quot;&#39;,     chr 256,
+        &#39;&quot;\x{100}&quot;&#39;, chr 65536,
+        &#39;&quot;\x{10000}&quot;&#39;, ord &#39;N&#39; == 78 ? ( chr 11, &#39;&quot;\013&quot;&#39; ) : ()
+    );
+
+    # NEW:
+    @tests = (
+        @common,       &#39;$_&#39;,
+        &#39;&quot;\$_&quot;&#39;,       &#39;@_&#39;,
+        &#39;&quot;\@_&quot;&#39;,       &#39;??N&#39;,
+        &#39;&quot;??N&quot;&#39;,       chr 256,
+        &#39;&quot;\x{100}&quot;&#39;,   chr 65536,
+        &#39;&quot;\x{10000}&quot;&#39;, ord &#39;N&#39; == 78 ? ( chr 11, &#39;&quot;\013&quot;&#39; ) : ()
+    );</code></pre>
+
+</dd>
+<dt id="Improved-vertical-alignments-by-avoiding-pruning-step"><b>Improved vertical alignments by avoiding pruning step</b></dt>
+<dd>
+
+<p>There is a step in vertical alignment where the alignments are formed into a tree with different levels, and some deeper levels are pruned to preserve lower level alignments. This usually works well, but some deeper alignments will be lost, which is what was happening in the example below. It turns out that if the tree pruning is skipped when alignment depths increase monotonically across lines, as in the example, then better overall alignment is achieved by the subsequent &#39;sweep&#39; pass.</p>
+
+<pre><code>    # OLD
+    my $cmd = shift @ARGV;
+    if    ( $cmd eq &quot;new&quot; )         { $force_new = 1; }
+    elsif ( $cmd eq &quot;interactive&quot; ) { $interactive = 1; $batch       = 0; }
+    elsif ( $cmd eq &quot;batch&quot; )       { $batch       = 1; $interactive = 0; }
+    elsif ( $cmd eq &quot;use_old&quot; )     { $use_old = 1; }
+    elsif ( $cmd eq &quot;show&quot; )        { $show    = 1; last; }
+    elsif ( $cmd eq &quot;showall&quot; )     { $showall = 1; last; }
+    elsif ( $cmd eq &quot;show_all&quot; )    { $showall = 1; last; }
+    elsif ( $cmd eq &quot;remove&quot; )      { $remove  = 1; last; }
+    elsif ( $cmd eq &quot;help&quot; )        { $help    = 1; last; }
+
+    # NEW
+    my $cmd = shift @ARGV;
+    if    ( $cmd eq &quot;new&quot; )         { $force_new   = 1; }
+    elsif ( $cmd eq &quot;interactive&quot; ) { $interactive = 1; $batch       = 0; }
+    elsif ( $cmd eq &quot;batch&quot; )       { $batch       = 1; $interactive = 0; }
+    elsif ( $cmd eq &quot;use_old&quot; )     { $use_old     = 1; }
+    elsif ( $cmd eq &quot;show&quot; )        { $show        = 1; last; }
+    elsif ( $cmd eq &quot;showall&quot; )     { $showall     = 1; last; }
+    elsif ( $cmd eq &quot;show_all&quot; )    { $showall     = 1; last; }
+    elsif ( $cmd eq &quot;remove&quot; )      { $remove      = 1; last; }
+    elsif ( $cmd eq &quot;help&quot; )        { $help        = 1; last; }</code></pre>
+
+<p>This update was made 14 Dec 2020, 44e0afa.</p>
+
+</dd>
+<dt id="Improved-some-marginal-vertical-alignments"><b>Improved some marginal vertical alignments</b></dt>
+<dd>
+
+<p>This update fixed a rare situation in which some vertical alignment was missed. The problem had to do with two lines being incorrectly marked as a marginal match. A new routine, &#39;match_line_pairs&#39; was added to set a flag with the information needed to detect and prevent this. This fix was made 13 Dec 2020, 9a8e49b.</p>
+
+<pre><code>    # OLD
+    $sec = $sec + ( 60 * $min );
+    $graphcpu[$sec] = $line;
+    $secmax  = $sec  if ( $sec &gt; $secmax );
+    $linemax = $line if ( $line &gt; $linemax );
+
+    # NEW
+    $sec            = $sec + ( 60 * $min );
+    $graphcpu[$sec] = $line;
+    $secmax         = $sec  if ( $sec &gt; $secmax );
+    $linemax        = $line if ( $line &gt; $linemax );</code></pre>
+
+</dd>
+<dt id="Do-not-align-equals-across-changes-in-continuation-indentation"><b>Do not align equals across changes in continuation indentation</b></dt>
+<dd>
+
+<p>A rule was added to prevent vertical alignment of lines with leading &#39;=&#39; across a change in continuation indentation. Sometimes aligning across a change in CI can come out okay, but sometimes it can be very poor. For example:</p>
+
+<pre><code>    # BAD:
+    $!               = 2, die qq/$0: can&#39;t stat -${arg}&#39;s &quot;$file&quot;./
+        unless $time = ( stat($file) )[$STAT_MTIME];
+
+    # FIXED:
+    $! = 2, die qq/$0: can&#39;t stat -${arg}&#39;s &quot;$file&quot;./
+      unless $time = ( stat($file) )[$STAT_MTIME];</code></pre>
+
+<p>The second line is a continuation of the first, and this update prevents this alignment. The above &#39;BAD&#39; formatting was in the previous developmental version of perltidy, not the previous release. This update added 12 Dec 2020, 5b56147.</p>
+
+</dd>
+<dt id="Improve-vertical-alignment-in-some-two-line-matches"><b>Improve vertical alignment in some two-line matches</b></dt>
+<dd>
+
+<p>When two lines would be perfectly aligned except for the line length limit, previously they would only be aligned if they had a common leading equals. The update removes this restriction and allows as many alignments to be made as possible. The results are generally improved. This update was made 11 Dec 2020, f3c6cd8. Some examples:</p>
+
+<p># In this example the side comments were limiting the matches</p>
+
+<pre><code>    # OLD
+    shift @data if @data and $data[0] =~ /Contributed\s+Perl/;    # Skip header
+    pop @data if @data and $data[-1] =~ /^\w/;    # Skip footer, like
+
+    # NEW
+    shift @data if @data and $data[0]  =~ /Contributed\s+Perl/;    # Skip header
+    pop @data   if @data and $data[-1] =~ /^\w/;    # Skip footer, like</code></pre>
+
+<p># The same is true here.</p>
+
+<pre><code>    # OLD
+    if ($tvg::o_span) { $tvg::hour_span = $tvg::o_span; }
+    if ( $tvg::hour_span % 2 &gt; 0 ) { $tvg::hour_span++; }    # Multiple of 2
+
+    # NEW
+    if ($tvg::o_span)              { $tvg::hour_span = $tvg::o_span; }
+    if ( $tvg::hour_span % 2 &gt; 0 ) { $tvg::hour_span++; }    # Multiple of 2</code></pre>
+
+<p>In the next example, the first comma is now aligned but not the second, because of the line length limit:</p>
+
+<pre><code>    # OLD
+    is( MyClass-&gt;meta, $mc, &#39;... these metas are still the same thing&#39; );
+    is( MyClass-&gt;meta-&gt;meta, $mc-&gt;meta, &#39;... these meta-metas are the same thing&#39; );
+
+    # NEW
+    is( MyClass-&gt;meta,       $mc, &#39;... these metas are still the same thing&#39; );
+    is( MyClass-&gt;meta-&gt;meta, $mc-&gt;meta, &#39;... these meta-metas are the same thing&#39; );</code></pre>
+
+<p>In this last example, the first comma is not aligned, but alignment resumes after the second comma.</p>
+
+<pre><code>    # OLD
+    is( $obj-&gt;name, $COMPRESS_FILE, &quot;   Name now set to &#39;$COMPRESS_FILE&#39;&quot; );
+    is( $obj-&gt;prefix, &#39;&#39;, &quot;   Prefix now empty&quot; );
+
+    # NEW
+    is( $obj-&gt;name, $COMPRESS_FILE, &quot;   Name now set to &#39;$COMPRESS_FILE&#39;&quot; );
+    is( $obj-&gt;prefix, &#39;&#39;,           &quot;   Prefix now empty&quot; );</code></pre>
+
+</dd>
+<dt id="Improve-vertical-alignment-in-some-marginal-matches"><b>Improve vertical alignment in some marginal matches</b></dt>
+<dd>
+
+<p>In perltidy a &#39;marginal match&#39; occurs for example when two lines share some alignment tokens but are somewhat different. When this happens some limits are placed on the size of the padding spaces that can be introduced. In this update the amount of allowed padding is significatly increased for certain &#39;good&#39; alignment tokens. Results of extensive testing were favorable provided that the change is restricted to alignments of &#39;=&#39;, &#39;if&#39; and &#39;unless&#39;. Update made 10 Dec 2020, a585f0b.</p>
+
+<pre><code>    # OLD
+    my @roles = $self-&gt;role_names;
+    my $role_names = join &quot;|&quot;, @roles;
+
+    # NEW
+    my @roles      = $self-&gt;role_names;
+    my $role_names = join &quot;|&quot;, @roles;
+
+    # OLD
+    $sysname .= &#39;del&#39; if $self-&gt;label =~ /deletion/;
+    $sysname .= &#39;ins&#39; if $self-&gt;label =~ /insertion/;
+    $sysname .= uc $self-&gt;allele_ori-&gt;seq if $self-&gt;allele_ori-&gt;seq;
+
+    # NEW
+    $sysname .= &#39;del&#39;                     if $self-&gt;label =~ /deletion/;
+    $sysname .= &#39;ins&#39;                     if $self-&gt;label =~ /insertion/;
+    $sysname .= uc $self-&gt;allele_ori-&gt;seq if $self-&gt;allele_ori-&gt;seq;</code></pre>
+
+</dd>
+<dt id="Improve-vertical-alignment-of-lines-ending-in-fat-comma"><b>Improve vertical alignment of lines ending in fat comma</b></dt>
+<dd>
+
+<p>A minor adjustment was made to the rule for aligning lines which end in &#39;=&gt;&#39;. When there are just two lines in an alignment group, the alignment is avoided if the first of the two ends in a &#39;=&gt;&#39;. Previously, alignment was avoided if either ended in a &#39;=&gt;&#39;. The old rule was preventing some good alignments in a later stage of the iteration. In the following example, the last two lines are processed separately because they do not match the comma in &#39;sprintf&#39;. The new rule allows the fat comma alignment to eventually get made later in the iteration. Update made 9 Dec 2020, ca0ddf4.</p>
+
+<pre><code>    # OLD
+    $template-&gt;param(
+        classlist =&gt; $classlist,
+        ...,
+        suggestion =&gt; $suggestion,
+        totspent   =&gt; sprintf( &quot;%.2f&quot;, $totspent ),
+        totcomtd   =&gt; sprintf( &quot;%.2f&quot;, $totcomtd ),
+        totavail   =&gt; sprintf( &quot;%.2f&quot;, $totavail ),
+        nobudget =&gt; $#results == -1 ? 1 : 0,
+        intranetcolorstylesheet =&gt;
+          C4::Context-&gt;preference(&quot;intranetcolorstylesheet&quot;),
+        ...
+    );
+
+    # NEW
+    $template-&gt;param(
+        classlist =&gt; $classlist,
+        ...,
+        suggestion              =&gt; $suggestion,
+        totspent                =&gt; sprintf( &quot;%.2f&quot;, $totspent ),
+        totcomtd                =&gt; sprintf( &quot;%.2f&quot;, $totcomtd ),
+        totavail                =&gt; sprintf( &quot;%.2f&quot;, $totavail ),
+        nobudget                =&gt; $#results == -1 ? 1 : 0,
+        intranetcolorstylesheet =&gt;
+          C4::Context-&gt;preference(&quot;intranetcolorstylesheet&quot;),
+        ...
+    );</code></pre>
+
+</dd>
+<dt id="Avoid-processing-a-file-more-than-once"><b>Avoid processing a file more than once</b></dt>
+<dd>
+
+<p>In the unlikely event that a user enters a filename more than once on the command line to perltidy, as for &#39;file1.pl&#39; here</p>
+
+<pre><code>  perltidy file1.pl file1.pl </code></pre>
+
+<p>then that file will be processed more than once. This looks harmless, but if the user was also using the -b (backup) parameter, then the original backup would be overwritten, which is not good. To avoid this, a filter has been placed on the list of files to remove duplicates. 9 Dec 2020, 646a542.</p>
+
+</dd>
+</dl>
+
+<dl>
+
+<dt id="Fix-for-issue-git-49-exit-status-not-correctly-set"><b>Fix for issue git #49, exit status not correctly set</b></dt>
+<dd>
+
+<p>The exit status flag was not being set for the -w option if the -se or if the -q flag were set. Issue git #44 was similar but a special case of the problem. The problem was fixed 8 Dec 2020, cb6028f.</p>
+
+</dd>
+</dl>
+
 <h1 id="Issues-fixed-after-release-20201202">Issues fixed after release 20201202</h1>
 
 <dl>
         return ();
         } );</code></pre>
 
-<p>This bug has been fixed, and code which has been incorrectly formatted will be correctly formatted with the next release. The bug was a result of a new coding introduced in v20201202 for fixing some issues with parsing sub signatures. Previously they were sometimes parsed the same as prototypes and sometimes as lists, now they are always parsed as lists.</p>
+<p>This bug has been fixed, and code which has been incorrectly formatted will be correctly formatted with the next release. The bug was a result of a new coding introduced in v20201202 for fixing some issues with parsing sub signatures. Previously they were sometimes parsed the same as prototypes and sometimes as lists, now they are always parsed as lists. Fixed 6 Dec 2020, 6fd0c4f.</p>
 
 </dd>
 </dl>
 </dd>
 </dl>
 
+<h1 id="POD-ERRORS">POD ERRORS</h1>
+
+<p>Hey! <b>The above document had some coding errors, which are explained below:</b></p>
+
+<dl>
+
+<dt id="Around-line-711">Around line 711:</dt>
+<dd>
+
+<p>&#39;=item&#39; outside of any &#39;=over&#39;</p>
+
+</dd>
+</dl>
+
 
 </body>
 
index 6937e365064845af3c92aa5375a7efad8c637a3c..529d1638f7ac5ec02b5840a1ef7f91fed67c8eb3 100644 (file)
@@ -1,8 +1,67 @@
 <h1>Perltidy Change Log</h1>
 
+<h2>2021 01 11</h2>
+
+<pre><code>- Fixed issue git #49, -se breaks warnings exit status behavior.
+The exit status flag was not always being set when the -se flag was set.
+
+- Some improvements have been made in the method for aligning side comments.
+One of the problems that was fixed is that there was a tendency for side comment
+placement to drift to the right in long scripts.  Programs with side comments
+may have a few changes.
+
+- Some improvements have been made in formatting qw quoted lists.  This
+fixes issue git #51, in which closing qw pattern delimiters not always
+following the settings specified by the --closing-token-indentation=n settings.
+Now qw closing delimiters ')', '}' and ']' follow these flags, and the
+delimiter '&gt;' follows the flag for ')'.  Other qw pattern delimiters remain
+indented as the are now.  This change will cause some small formatting changes
+in some existing programs.
+
+- Another change involving qw lists is that they get full indentation,
+rather than just continuation indentation, if
+
+     (1) the closing delimiter is one of } ) ] &gt; and is on a separate line,
+     (2) the opening delimiter  (i.e. 'qw{' ) is also on a separate line, and
+     (3) the -xci flag (--extended-continuation-indentation) is set.
+
+This improves formatting when qw lists are contained in other lists. For example,
+
+        # OLD: perltidy
+        foreach $color (
+            qw(
+            AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
+            SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
+            ),
+            qw(
+            LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
+            SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
+            )
+          )
+
+        # NEW, perltidy -xci
+        foreach $color (
+            qw(
+                AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
+                SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
+            ),
+            qw(
+                LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
+                SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
+            )
+          )
+
+- Some minor improvements have been made to the rules for formatting
+some edge vertical alignment cases, usually involving two dissimilar lines.
+
+- A more complete list of updates is at
+
+       https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod
+</code></pre>
+
 <h2>2020 12 07</h2>
 
-<pre><code>- Fixed issue git #47, incorrect welding of anonymous subs. 
+<pre><code>- Fixed issue git #47, incorrect welding of anonymous subs.
   An incorrect weld format was being made when the --weld-nested-containers option
   (-wn) was used in to format a function which returns a list of anonymous subs.
   For example, the following snippet was incorrectly being welded.
index be01abdd12844841f51a848536f191e1cbb1deb4..070716e9170b6b69dd30ee5a31569db965c8b548 100644 (file)
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents Perl::Tidy version 20201207</p>
+<p>This man page documents Perl::Tidy version 20210111</p>
 
 <h1 id="LICENSE">LICENSE</h1>
 
index 3914d9cc8631840ce50c20104a3d08f9d3d7b746..46c9b0f74eeaafce72b08f3c61945753de8f69e5 100644 (file)
 <dt id="l-n---maximum-line-length-n"><b>-l=n</b>, <b>--maximum-line-length=n</b></dt>
 <dd>
 
-<p>The default maximum line length is n=80 characters. Perltidy will try to find line break points to keep lines below this length. However, long quotes and side comments may cause lines to exceed this length. Setting <b>-l=0</b> is equivalent to setting <b>-l=(a large number)</b>.</p>
+<p>The default maximum line length is n=80 characters. Perltidy will try to find line break points to keep lines below this length. However, long quotes and side comments may cause lines to exceed this length.</p>
+
+<p>The default length of 80 comes from the past when this was the standard CRT screen width. Many programmers prefer to increase this to something like 120.</p>
+
+<p>Setting <b>-l=0</b> is equivalent to setting <b>-l=(a very large number)</b>. But this is not recommended because, for example, a very long list will be formatted in a single long line.</p>
 
 </dd>
 <dt id="vmll---variable-maximum-line-length"><b>-vmll</b>, <b>--variable-maximum-line-length</b></dt>
 <dt id="xci---extended-continuation-indentation"><b>-xci</b>, <b>--extended-continuation-indentation</b></dt>
 <dd>
 
-<p>This flag causes continuation indentation to &quot;extend&quot; deeper into structures. If you use <b>-ci=n</b> and <b>-i=n</b> with the same value of <b>n</b> you will probably want to set this flag. Since this is a fairly new flag, the default is <b>-nxci</b> to avoid disturbing existing formatting.</p>
+<p>This flag allows perltidy to use some improvements which have been made to its indentation model. One of the things it does is &quot;extend&quot; continuation indentation deeper into structures, hence the name. The improved indentation is particularly noticable when the flags <b>-ci=n</b> and <b>-i=n</b> use the same value of <b>n</b>. There are no significant disadvantages to using this flag, but to avoid disturbing existing formatting the default is not to use it, <b>-nxci</b>.</p>
+
+<p>Please see the section <a href="#pbp---perl-best-practices">&quot;<b>-pbp</b>, <b>--perl-best-practices</b>&quot;</a> for an example of how this flag can improve the formatting of ternary statements. It can also improve indentation of some multi-line qw lists as shown below.</p>
 
-<p>Here is an explanation. There are two common strategies for continuation indentation. One is the strategy recommend in the original perl style guidelines, in which <b>-ci=2</b> and <b>-i=4</b>. The other is the strategy is the strategy recommended for example in the &quot;Perl Best Practices&quot; book by Conway, in which <b>-ci=4</b> and <b>-i=4</b>. The default formatting in perltidy works fairly well with the orignal perl style, but problems arise when <b>-ci</b> and <b>-i</b> are given equal values as in the <b>pbp</b> style, particularly with ternary statements. The <b>-xci</b> flag was added to fix this. It may be used with any value of <b>-ci</b> but is particularly helpful when <b>-ci</b> and <b>-i</b> are given similar values.</p>
+<pre><code>            # perltidy
+            foreach $color (
+                qw(
+                AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
+                SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
+                ),
+                qw(
+                LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
+                SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
+                )
+              )
 
-<p>For an illustration, please see the section <a href="#pbp---perl-best-practices">&quot;<b>-pbp</b>, <b>--perl-best-practices</b>&quot;</a>.</p>
+            # perltidy -xci
+            foreach $color (
+                qw(
+                    AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
+                    SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
+                ),
+                qw(
+                    LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
+                    SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
+                )
+              )</code></pre>
 
 </dd>
 <dt id="sil-n---starting-indentation-level-n"><b>-sil=n</b> <b>--starting-indentation-level=n</b></dt>
 
 <p>Related issues arise with other binary operator symbols, such as + and -, and in older versions of perl there could be problems with ternary operators. So to avoid changing program behavior, perltidy has the simple rule that whitespace around possible filehandles is left unchanged. Likewise, whitespace around barewords is left unchanged. The reason is that if the barewords are defined in other modules, or in code that has not even been written yet, perltidy will not have seen their prototypes and must treat them cautiously.</p>
 
+<p>In perltidy this is implemented in the tokenizer by marking token following a <b>print</b> keyword as a special type <b>Z</b>. When formatting is being done, whitespace following this token type is generally left unchanged as a precaution against changing program behavior. This is excessively conservative but simple and easy to implement. Keywords which are treated similarly to <b>print</b> include <b>printf</b>, <b>sort</b>, <b>exec</b>, <b>system</b>. Changes in spacing around parameters following these keywords may have to be made manually. For example, the space, or lack of space, after the parameter $foo in the following line will be unchanged in formatting.</p>
+
+<pre><code>   system($foo );
+   system($foo);</code></pre>
+
+<p>To find if a token is of type <b>Z</b> you can use <b>perltidy -DEBUG</b>. For the first line above the result is</p>
+
+<pre><code>   1: system($foo );
+   1: kkkkkk{ZZZZb};</code></pre>
+
+<p>which shows that <b>system</b> is type <b>k</b> (keyword) and $foo is type <b>Z</b>.</p>
+
 </dd>
 <dt id="Note2:-Perltidys-whitespace-rules-are-not-perfect">Note2: Perltidy&#39;s whitespace rules are not perfect</dt>
 <dd>
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents perltidy version 20201207</p>
+<p>This man page documents perltidy version 20210111</p>
 
 <h1 id="BUG-REPORTS">BUG REPORTS</h1>
 
index d2184f17834324523544de32421293380a257304..828f20c4335c44efcdc9007c0560d0ec75f141a7 100644 (file)
@@ -110,7 +110,7 @@ BEGIN {
     # Release version must be bumped, and it is probably past time for a
     # release anyway.
 
-    $VERSION = '20201207';
+    $VERSION = '20210111';
 }
 
 sub DESTROY {
@@ -2801,7 +2801,7 @@ sub generate_options {
               blank-lines-before-subs=0
               blank-lines-before-packages=0
               notabs
-              )
+            )
         ],
 
         # 'extrude' originally deleted pod and comments, but to keep it
@@ -2833,7 +2833,7 @@ sub generate_options {
               nofuzzy-line-length
               notabs
               norecombine
-              )
+            )
         ],
 
         # this style tries to follow the GNU Coding Standards (which do
@@ -2842,7 +2842,7 @@ sub generate_options {
         'gnu-style' => [
             qw(
               lp bl noll pt=2 bt=2 sbt=2 cpi=1 csbi=1 cbi=1
-              )
+            )
         ],
 
         # Style suggested in Damian Conway's Perl Best Practices
@@ -3612,7 +3612,7 @@ sub Win_OS_Type {
             90 => "Me"
         },
         2 => {
-            0  => "2000",          # or NT 4, see below
+            0  => "2000",      # or NT 4, see below
             1  => "XP/.Net",
             2  => "Win2003",
             51 => "NT3.51"
index 2895c5e44164243cb26ebbaa0bc7f9d0e58ad63a..e4c218a47dd2b789834e473ac32d54c849abbf83 100644 (file)
@@ -432,7 +432,7 @@ The module 'Perl::Tidy' comes with a binary 'perltidy' which is installed when t
 
 =head1 VERSION
 
-This man page documents Perl::Tidy version 20201207
+This man page documents Perl::Tidy version 20210111
 
 =head1 LICENSE
 
index 28a3b33aa3e077d1c9f4842093fdcfb7a1ed57f5..2a5fb2660d3e55f252f5430ffe136dc2c4130746 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::Debugger;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 sub new {
 
index 60449b587e69d9a80cae4c19f70542ce85b879ab..aee1966d30d045c1508b3ced4d26407d5f6d1306 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::DevNull;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 sub new   { my $self = shift; return bless {}, $self }
 sub print { return }
 sub close { return }
index ceadacbc9111cae33bf7fac8f37a29eaf5cf38c4..3bad18fea140bf940fe7070a5222f4cc2a6148b6 100644 (file)
@@ -20,7 +20,7 @@
 package Perl::Tidy::Diagnostics;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 sub AUTOLOAD {
 
index 47ddc8aafc39007dfa0c48025d180d2db663a333..d10bcae99fc8a9afe17b816550123dbbc5ae1563 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::FileWriter;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 use constant DEVEL_MODE => 0;
 
index 2e9bf525aa409d3e256d25ff9b008406dea5832c..6bc334129d56579118af08f20b1423f8aa4cd93c 100644 (file)
@@ -49,7 +49,7 @@ use constant DEVEL_MODE => 0;
 { #<<< A non-indenting brace to contain all lexical variables
 
 use Carp;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 # The Tokenizer will be loaded with the Formatter
 ##use Perl::Tidy::Tokenizer;    # for is_keyword()
@@ -19142,7 +19142,7 @@ sub make_paren_name {
                     #      qw<
                     #        far
                     #        farfar
-                    #        farfars far
+                    #        farfars-far
                     #      >,
                     #   );
                     if ( !defined($cti) && length($tok) == 1 ) {
index 9c85cc1591b6006988207fe8503c441ccdeeee86..4432f300532cfc3f6efe7983859597b15e82261f 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::HtmlWriter;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 use File::Basename;
 
index 68972bb185c329e3fa1a130f6788564cc1113da5..c38b68f7728abf9a38c1cc1f35b2a9a63988f2d5 100644 (file)
@@ -10,7 +10,7 @@ package Perl::Tidy::IOScalar;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 sub AUTOLOAD {
 
index bd71fbe687cb164b3e752333e9196deeb81864d8..5e496145e33fee127f981ff4b8ade53ac2073c6a 100644 (file)
@@ -14,7 +14,7 @@ package Perl::Tidy::IOScalarArray;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 sub AUTOLOAD {
 
index 5453c5839d10c0a9a23835da98dd611e5e48f3bd..b9ba6843bd5dd6293e287eac54bbc04e53a4ed2e 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::IndentationItem;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 BEGIN {
 
index f4f15f0c8235898b6758e231848fecf950c21edd..194b3562ad60450dd515698998d0940da20b3d41 100644 (file)
@@ -12,7 +12,7 @@
 package Perl::Tidy::LineBuffer;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 sub AUTOLOAD {
 
index d25080a3f5c661e7befc3461a456693740ecd226..dd8414025f6e52183761daa8da3f53ae99232638 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::LineSink;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 sub AUTOLOAD {
 
index 7c04c6088b0eca10cd75feb9fe9c81b0e818ba17..aed237c9ebedf6b7f949109c32b44890c07bab09 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::LineSource;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 sub AUTOLOAD {
 
index 9d2cce88415859fb557b964c9101032a83a1a470..60ea51ab58326d28a28f8e9aa7816b7e4abe6d88 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::Logger;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 sub AUTOLOAD {
 
index 932c88163d853791f91b0defec6db6aa4719fb70..30b2c30f0ceb5fb9b3515fd657ecbc51eec1d920 100644 (file)
@@ -21,7 +21,7 @@
 package Perl::Tidy::Tokenizer;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 use Perl::Tidy::LineBuffer;
 use Carp;
@@ -3990,7 +3990,7 @@ EOM
                           )
                         {
                             $statement_type = $tok;    # next '{' is block
-                            $type = 'k';    # for keyword syntax coloring
+                            $type           = 'k'; # for keyword syntax coloring
                         }
 
                         # patch for SWITCH/CASE if switch and given not keywords
index 26a090a2ab7e73281833d1b2de145bf6941ea61d..81d999f429d6f22945a853b97e73c0065c79aec6 100644 (file)
@@ -1,7 +1,7 @@
 package Perl::Tidy::VerticalAligner;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 use Perl::Tidy::VerticalAligner::Alignment;
 use Perl::Tidy::VerticalAligner::Line;
@@ -2436,7 +2436,7 @@ EOM
             return ( $max_lev_diff, $saw_side_comment );
         }
 
-        my $has_terminal_match  = $rlines->[-1]->get_j_terminal_match();
+        my $has_terminal_match = $rlines->[-1]->get_j_terminal_match();
 
         # ignore hanging side comments in these operations
         my @filtered   = grep { !$_->get_is_hanging_side_comment() } @{$rlines};
@@ -3936,7 +3936,7 @@ sub Dump_tree_groups {
                     $j0_eq_pad = $pad;
                     $j0_max_pad =
                       0.5 * ( $rfield_lengths_1->[0] + $rfield_lengths_0->[0] );
-                    $j0_max_pad = 4 if ($j0_max_pad < 4);
+                    $j0_max_pad = 4 if ( $j0_max_pad < 4 );
                 }
             }
 
@@ -4140,7 +4140,7 @@ sub Dump_tree_groups {
                     || TEST_MARGINAL_EQ_ALIGNMENT
                 )
                 && $j0_eq_pad >= -$j0_max_pad
-                && $j0_eq_pad <= $j0_max_pad 
+                && $j0_eq_pad <= $j0_max_pad
               )
             {
 
@@ -4332,8 +4332,8 @@ sub align_side_comments {
     # Given:
     #  $rlines  - the lines
     #  $rgroups - the partition of the lines into groups
-    # 
-    # We will be working group-by-group because all side comments 
+    #
+    # We will be working group-by-group because all side comments
     # (real or fake) in each group are already aligned. So we just have
     # to make alignments between groups wherever possible.
 
@@ -4375,7 +4375,7 @@ sub align_side_comments {
     return unless @todo;
 
     # Count $num5 = number of comments in the 5 lines after the first comment
-    # This is an important factor in a decision formula 
+    # This is an important factor in a decision formula
     my $num5 = 1;
     for ( my $jj = $j_sc_beg + 1 ; $jj < @{$rlines} ; $jj++ ) {
         my $ldiff = $jj - $j_sc_beg;
index e5a33df1f79b7ce79825c27e8060ea53eec00090..53a5896ffe1bcc5a828a725f842f0321be508cbe 100644 (file)
@@ -10,7 +10,7 @@ use warnings;
 
 { #<<< A non-indenting brace
 
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 #    _column_          # the current column number
 #    _saved_column_    # a place for temporary storage
index 2d5c0b5f7b52efe4c480ddef6ad08d680c889eb0..9aa4b007c11c6182c0c27c9085a0a5bdebfc6e41 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::VerticalAligner::Line;
 use strict;
 use warnings;
-our $VERSION = '20201207';
+our $VERSION = '20210111';
 
 BEGIN {
     my $i = 0;
index 7ed103a8a28706571e65dd24dfd95598569db462..b219fa22dd1ac5c8c2cc8e1d7f07f924d3052673 100644 (file)
@@ -44,7 +44,7 @@ given, so both old and new versions with -wn give
         pwexpire   pwgecos    pwpasswd   pwquota
     } )
 
-This update added 8 Jan 2021.
+This update added 8 Jan 2021, 474cfa8.
 
 =item B<Improve alignment of leading equals in rare situation>
 
@@ -59,7 +59,7 @@ lines 4 and 5 were not 'looking' backwards to align their leading equals.
     $port = 2345        unless ( $port = shift );
     $saddr = 'S n a4 x8';
     $SIG{'INT'} = 'dokill';
-    
+
     # NEW
     $them       = 'localhost' unless ( $them = shift );
     $cmd        = '!print'    unless ( $cmd  = shift );
@@ -67,7 +67,7 @@ lines 4 and 5 were not 'looking' backwards to align their leading equals.
     $saddr      = 'S n a4 x8';
     $SIG{'INT'} = 'dokill';
 
-Fixed 5 Jan 2021.
+Fixed 5 Jan 2021, 9244678.
 
 =item B<Moved previous patch to a better location>
 
@@ -277,7 +277,7 @@ quotes.  This update avoids this problem by not formatting such lists with the
           cplx cplxe
           ),
         @trig,
-              ); 
+              );
 
 
     # NEW, perltidy -gnu
@@ -666,7 +666,7 @@ two lines are processed separately because they do not match the comma
 in 'sprintf'.  The new rule allows the fat comma alignment to eventually
 get made later in the iteration. Update made 9 Dec 2020, ca0ddf4.
 
-    # OLD 
+    # OLD
     $template->param(
         classlist => $classlist,
         ...,