]> git.donarmstrong.com Git - perltidy.git/commitdiff
update version to 20111111
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 7 Nov 2022 15:39:37 +0000 (07:39 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 7 Nov 2022 15:39:37 +0000 (07:39 -0800)
24 files changed:
CHANGES.md
bin/perltidy
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

index a26f46d54c11a140bdd0596fad2bf749152735e4..d6c8bf06f332b1ef4e71405217ad182ae5ea9528 100644 (file)
@@ -1,6 +1,6 @@
 # Perltidy Change Log
 
-## 2022 06 13.06
+## 2022 11 11
 
     - No significant bugs have been found since the last release to CPAN.
       Several minor issues have been fixed, and some new parameters have been
       combination -xlp -pt=2, mainly for two-line lists with short function
       names. One indentation space is removed to improve alignment:
 
-      # OLD: perltidy -xlp -pt=2
+        # OLD: perltidy -xlp -pt=2
         is($module->VERSION, $expected,
             "$main_module->VERSION matches $module->VERSION ($expected)");
 
-      # NEW: perltidy -xlp -pt=2
+        # NEW: perltidy -xlp -pt=2
         is($module->VERSION, $expected,
            "$main_module->VERSION matches $module->VERSION ($expected)");
 
index 0d6ac0578fd35531ba993e41130fd5c690324b6d..82060f0d00be65d653f44e98f8cb38345a2fba31 100755 (executable)
@@ -5426,7 +5426,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module
 
 =head1 VERSION
 
-This man page documents perltidy version 20220613.06
+This man page documents perltidy version 20221111
 
 =head1 BUG REPORTS
 
index 90acabb91760022156edbdd57c14fa8b6f44d017..f6f918a46a996901facfff2c63f06eb1cb93608a 100644 (file)
@@ -1,5 +1,133 @@
 <h1>Perltidy Change Log</h1>
 
+<h2>2022 11 11</h2>
+
+<pre><code>- No significant bugs have been found since the last release to CPAN.
+  Several minor issues have been fixed, and some new parameters have been
+  added, as follows:
+
+- Fixed rare problem with irregular indentation involving --cuddled-else,
+  usually also with the combination -xci and -lp.  Reported in rt #144979.
+
+- Add option --weld-fat-comma (-wfc) for issue git #108. When -wfc
+  is set, along with -wn, perltidy is allowed to weld an opening paren
+  to an inner opening container when they are separated by a hash key
+  and fat comma (=&gt;).  For example:
+
+    # perltidy -wn
+    elf-&gt;call_method(
+        method_name_foo =&gt; {
+            some_arg1       =&gt; $foo,
+            some_other_arg3 =&gt; $bar-&gt;{'baz'},
+        }
+    );
+
+    # perltidy -wn -wfc
+    elf-&gt;call_method( method_name_foo =&gt; {
+        some_arg1       =&gt; $foo,
+        some_other_arg3 =&gt; $bar-&gt;{'baz'},
+    } );
+
+  This flag is off by default.
+
+- Fix issue git #106. This fixes some edge cases of formatting with the
+  combination -xlp -pt=2, mainly for two-line lists with short function
+  names. One indentation space is removed to improve alignment:
+
+    # OLD: perltidy -xlp -pt=2
+    is($module-&gt;VERSION, $expected,
+        "$main_module-&gt;VERSION matches $module-&gt;VERSION ($expected)");
+
+    # NEW: perltidy -xlp -pt=2
+    is($module-&gt;VERSION, $expected,
+       "$main_module-&gt;VERSION matches $module-&gt;VERSION ($expected)");
+
+- Fix for issue git #105, incorrect formatting with 5.36 experimental
+  for_list feature.
+
+- Fix for issue git #103. For parameter -b, or --backup-and-modify-in-place,
+  the default backup method has been changed to preserve the inode value
+  of the file being formatted.  If this causes a problem, the previous
+  method is available and can be used by setting -backup-mode='move', or
+  -bm='move'.  The new default corresponds to -bm='copy'.  The difference
+  between the two methods is as follows.  For the older method,
+  -bm='move', the input file was moved to the backup, and a new file was
+  created for the formatted output.  This caused the inode to change.  For
+  the new default method, -bm='copy', the input is copied to the backup
+  and then the input file is reopened and rewritten. This preserves the
+  file inode.  Tests have not produced any problems with this change, but
+  before using the --backup-and-modify-in-place parameter please verify
+  that it works correctly in your environment and operating system. The
+  initial update for this had an error which was caught and fixed
+  in git #109.
+
+- Fix undefined value message when perltidy -D is used (git #104)
+
+- Fixed an inconsistency in html colors near pointers when -html is used.
+  Previously, a '-&gt;' at the end of a line got the 'punctuation color', black
+  by default but a '-&gt;' before an identifier got the color of the following
+  identifier. Now all pointers get the same color, which is black by default.
+  Also, previously a word following a '-&gt;' was given the color of a bareword,
+  black by default, but now it is given the color of an identifier.
+
+- Fixed incorrect indentation of any function named 'err'.  This was
+  due to some old code from when "use feature 'err'" was valid.
+
+        # OLD:
+        my ($curr) = current();
+          err (@_);
+
+        # NEW:
+        my ($curr) = current();
+        err(@_);
+
+- Added parameter --delete-repeated-commas (-drc) to delete repeated
+  commas. This is off by default. For example, given:
+
+        ignoreSpec( $file, "file",, \%spec, \%Rspec );
+
+  # perltidy -drc:
+        ignoreSpec( $file, "file", \%spec, \%Rspec );
+
+- Add continuation indentation to long C-style 'for' terms; i.e.
+
+        # OLD
+        for (
+            $j = $i - $shell ;
+            $j &gt;= 0
+            &amp;&amp; ++$ncomp
+            &amp;&amp; $array-&gt;[$j] gt $array-&gt;[ $j + $shell ] ;
+            $j -= $shell
+          )
+
+        # NEW
+        for (
+            $j = $i - $shell ;
+            $j &gt;= 0
+              &amp;&amp; ++$ncomp
+              &amp;&amp; $array-&gt;[$j] gt $array-&gt;[ $j + $shell ] ;
+            $j -= $shell
+          )
+
+  This will change some existing formatting.
+
+- The following new parameters are available for manipulating
+  trailing commas of lists. They are described in the manual.
+
+       --want-trailing-commas=s, -wtc=s
+       --add-trailing-commas,    -atc
+       --delete-trailing-commas, -dtc
+       --delete-weld-interfering-commas, -dwic
+
+- Files with errors due to missing, extra or misplaced parens, braces,
+  or square brackets are now written back out verbatim, without any
+  attempt at formatting.
+
+- This version runs 10 to 15 percent faster than the previous
+  release on large files due to optimizations made with the help of
+  Devel::NYTProf.
+</code></pre>
+
 <h2>2022 06 13</h2>
 
 <pre><code>- No significant bugs have been found since the last release but users
 - Added vertical alignment for qw quotes and empty parens in 'use'
   statements (see issue #git 93).  This new alignment is 'on' by default
   and will change formatting as shown below. If this is not wanted it can
-  be turned off with the parameter -vxl='q' (--valign-exclude-list='q').
+  be turned off with the parameter -vxl='q' (--valign-exclusion-list='q').
 
     # old default, or -vxl='q'
     use Getopt::Long qw(GetOptions);
index ae33f1d7eb6c96a96db0aefbe109e5f89ea3a2d4..06eea5706ce0079ab77a9e26fd62378c925c5084 100644 (file)
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents Perl::Tidy version 20220613</p>
+<p>This man page documents Perl::Tidy version 20221111</p>
 
 <h1 id="LICENSE">LICENSE</h1>
 
index 8087a23f82acdf0a49277f696bbc58116dc38ff8..6bcea4687e5baacf297ff4e7d4c817aebbe94645 100644 (file)
@@ -18,7 +18,7 @@
   <li><a href="#EXAMPLES">EXAMPLES</a></li>
   <li><a href="#OPTIONS---OVERVIEW">OPTIONS - OVERVIEW</a>
     <ul>
-      <li><a href="#I-O-control">I/O control</a></li>
+      <li><a href="#I-O-Control">I/O Control</a></li>
     </ul>
   </li>
   <li><a href="#FORMATTING-OPTIONS">FORMATTING OPTIONS</a>
       <li><a href="#Comment-Controls">Comment Controls</a></li>
       <li><a href="#Skipping-Selected-Sections-of-Code">Skipping Selected Sections of Code</a></li>
       <li><a href="#Line-Break-Control">Line Break Control</a></li>
+      <li><a href="#Controlling-Breaks-at-Braces-Parens-and-Square-Brackets">Controlling Breaks at Braces, Parens, and Square Brackets</a></li>
+      <li><a href="#Welding">Welding</a></li>
+      <li><a href="#Breaking-Before-or-After-Operators">Breaking Before or After Operators</a></li>
       <li><a href="#Controlling-List-Formatting">Controlling List Formatting</a></li>
+      <li><a href="#Adding-and-Deleting-Commas">Adding and Deleting Commas</a></li>
       <li><a href="#Retaining-or-Ignoring-Existing-Line-Breaks">Retaining or Ignoring Existing Line Breaks</a></li>
       <li><a href="#Blank-Line-Control">Blank Line Control</a></li>
       <li><a href="#Styles">Styles</a></li>
 
 <p>Option names may be terminated early as long as they are uniquely identified. For example, instead of <b>--dump-token-types</b>, it would be sufficient to enter <b>--dump-tok</b>, or even <b>--dump-t</b>, to uniquely identify this command.</p>
 
-<h2 id="I-O-control">I/O control</h2>
+<h2 id="I-O-Control">I/O Control</h2>
 
 <p>The following parameters concern the files which are read and written.</p>
 
 
 <p>Modify the input file or files in-place and save the original with the extension <i>.bak</i>. Any existing <i>.bak</i> file will be deleted. See next item for changing the default backup extension, and for eliminating the backup file altogether.</p>
 
+<p><b>Please Note</b>: Writing back to the input file increases the risk of data loss or corruption in the event of a software or hardware malfunction. Before using the <b>-b</b> parameter please be sure to have backups and verify that it works correctly in your environment and operating system.</p>
+
 <p>A <b>-b</b> flag will be ignored if input is from standard input or goes to standard output, or if the <b>-html</b> flag is set.</p>
 
 <p>In particular, if you want to use both the <b>-b</b> flag and the <b>-pbp</b> (--perl-best-practices) flag, then you must put a <b>-nst</b> flag after the <b>-pbp</b> flag because it contains a <b>-st</b> flag as one of its components, which means that output will go to the standard output stream.</p>
   &lt;-bext=&#39;/backup&#39;&gt;   F&lt;.backup&gt;         Delete if no errors
   &lt;-bext=&#39;original/&#39;&gt; F&lt;.original&gt;       Delete if no errors</code></pre>
 
+</dd>
+<dt id="bm-s---backup-method-s"><b>-bm=s</b>, <b>--backup-method=s</b></dt>
+<dd>
+
+<p>This parameter should not normally be used but is available in the event that problems arise as a transition is made from an older implementation of the backup logic to a newer implementation. The newer implementation is the default and is specified with <b>-bm=&#39;copy&#39;</b>. The older implementation is specified with <b>-bm=&#39;move&#39;</b>. The difference is that the older implementation made the backup by moving the input file to the backup file, and the newer implementation makes the backup by copying the input file. The newer implementation preserves the file system <b>inode</b> value. This may avoid problems with other software running simultaneously. This change was made as part of issue <b>git #103</b> at github.</p>
+
 </dd>
 <dt id="w---warning-output"><b>-w</b>, <b>--warning-output</b></dt>
 <dd>
             fixit($i);
         }</code></pre>
 
-<p>Use <b>-nola</b> to not outdent labels. To control line breaks after labels see <a href="#bal-n---break-after-labels-n">&quot;bal=n, --break-after-labels=n&quot;</a>.</p>
+<p>Use <b>-nola</b> to not outdent labels. To control line breaks after labels see <a href="#bal-n---break-after-labels-n">&quot;-bal=n, --break-after-labels=n&quot;</a>.</p>
 
 </dd>
 <dt id="Outdenting-Keywords"><b>Outdenting Keywords</b></dt>
 
 <h2 id="Line-Break-Control">Line Break Control</h2>
 
-<p>The parameters in this section control breaks after non-blank lines of code. Blank lines are controlled separately by parameters in the section <a href="#Blank-Line-Control">&quot;Blank Line Control&quot;</a>.</p>
+<p>The parameters in this and the next sections control breaks after non-blank lines of code. Blank lines are controlled separately by parameters in the section <a href="#Blank-Line-Control">&quot;Blank Line Control&quot;</a>.</p>
 
 <dl>
 
+<dt id="dnl---delete-old-newlines"><b>-dnl</b>, <b>--delete-old-newlines</b></dt>
+<dd>
+
+<p>By default, perltidy first deletes all old line break locations, and then it looks for good break points to match the desired line length. Use <b>-ndnl</b> or <b>--nodelete-old-newlines</b> to force perltidy to retain all old line break points.</p>
+
+</dd>
+<dt id="anl---add-newlines"><b>-anl</b>, <b>--add-newlines</b></dt>
+<dd>
+
+<p>By default, perltidy will add line breaks when necessary to create continuations of long lines and to improve the script appearance. Use <b>-nanl</b> or <b>--noadd-newlines</b> to prevent any new line breaks.</p>
+
+<p>This flag does not prevent perltidy from eliminating existing line breaks; see <b>--freeze-newlines</b> to completely prevent changes to line break points.</p>
+
+</dd>
 <dt id="fnl---freeze-newlines"><b>-fnl</b>, <b>--freeze-newlines</b></dt>
 <dd>
 
 <p>Note: If you also want to keep your blank lines exactly as they are, you can use the <b>-fbl</b> flag which is described in the section <a href="#Blank-Line-Control">&quot;Blank Line Control&quot;</a>.</p>
 
 </dd>
+</dl>
+
+<h2 id="Controlling-Breaks-at-Braces-Parens-and-Square-Brackets">Controlling Breaks at Braces, Parens, and Square Brackets</h2>
+
+<dl>
+
 <dt id="ce---cuddled-else"><b>-ce</b>, <b>--cuddled-else</b></dt>
 <dd>
 
 <dt id="cblx---cuddled-block-list-exclusive"><b>-cblx</b>, <b>--cuddled-block-list-exclusive</b></dt>
 <dd>
 
-<p>When cuddled else formatting is selected with <b>-ce</b>, setting this flag causes perltidy to ignore its built-in defaults and rely exclusively on the block types specified on the <b>-cbl</b> flag described in the previous section. For example, to avoid using cuddled <b>catch</b> and <b>finally</b>, which among in the defaults, the following set of parameters could be used:</p>
+<p>When cuddled else formatting is selected with <b>-ce</b>, setting this flag causes perltidy to ignore its built-in defaults and rely exclusively on the block types specified on the <b>-cbl</b> flag described in the previous section. For example, to avoid using cuddled <b>catch</b> and <b>finally</b>, which are among the defaults, the following set of parameters could be used:</p>
 
 <pre><code>  perltidy -ce -cbl=&#39;else elsif continue&#39; -cblx</code></pre>
 
   -bbpi=2 indent one full indentation level</code></pre>
 
 </dd>
+</dl>
+
+<h2 id="Welding">Welding</h2>
+
+<dl>
+
 <dt id="wn---weld-nested-containers"><b>-wn</b>, <b>--weld-nested-containers</b></dt>
 <dd>
 
             next if $x == $y;
         } } until $x++ &gt; $z;</code></pre>
 
-<p>When this flag is set perltidy makes a preliminary pass through the file and identifies all nested pairs of containers. To qualify as a nested pair, the closing container symbols must be immediately adjacent and the opening symbols must either (1) be adjacent as in the above example, or (2) have an anonymous sub declaration following an outer opening container symbol which is not a code block brace, or (3) have an outer opening paren separated from the inner opening symbol by any single non-container symbol or something that looks like a function evaluation, as illustrated in the next examples.</p>
+<p>When this flag is set perltidy makes a preliminary pass through the file and identifies all nested pairs of containers. To qualify as a nested pair, the closing container symbols must be immediately adjacent and the opening symbols must either (1) be adjacent as in the above example, or (2) have an anonymous sub declaration following an outer opening container symbol which is not a code block brace, or (3) have an outer opening paren separated from the inner opening symbol by any single non-container symbol or something that looks like a function evaluation, as illustrated in the next examples. An additonal option (4) which can be turned on with the flag <b>--weld-fat-comma</b> is when the opening container symbols are separated by a hash key and fat comma (=&gt;).</p>
 
 <p>Any container symbol may serve as both the inner container of one pair and as the outer container of an adjacent pair. Consequently, any number of adjacent opening or closing symbols may join together in weld. For example, here are three levels of wrapped function calls:</p>
 
 
 <p>Finally, the stacking of containers defined by this flag have priority over any other container stacking flags. This is because any welding is done first.</p>
 
+</dd>
+<dt id="wfc---weld-fat-comma"><b>-wfc</b>, <b>--weld-fat-comma </b></dt>
+<dd>
+
+<p>When the <b>-wfc</b> flag is set, along with <b>-wn</b>, perltidy is allowed to weld an opening paren to an inner opening container when they are separated by a hash key and fat comma (=&gt;). for example</p>
+
+<pre><code>    # perltidy -wn -wfc
+    elf-&gt;call_method( method_name_foo =&gt; {
+        some_arg1       =&gt; $foo,
+        some_other_arg3 =&gt; $bar-&gt;{&#39;baz&#39;},
+    } );</code></pre>
+
+<p>This option is off by default.</p>
+
 </dd>
 <dt id="wnxl-s---weld-nested-exclusion-list"><b>-wnxl=s</b>, <b>--weld-nested-exclusion-list</b></dt>
 <dd>
 <p>Please note that if both opening and closing tokens are to be stacked, then the newer flag <b>-weld-nested-containers</b> may be preferable because it insures that stacking is always done symmetrically. It also removes an extra level of unnecessary indentation within welded containers. It is able to do this because it works on formatting globally rather than locally, as the <b>-sot</b> and <b>-sct</b> flags do.</p>
 
 </dd>
-<dt id="dnl---delete-old-newlines"><b>-dnl</b>, <b>--delete-old-newlines</b></dt>
-<dd>
-
-<p>By default, perltidy first deletes all old line break locations, and then it looks for good break points to match the desired line length. Use <b>-ndnl</b> or <b>--nodelete-old-newlines</b> to force perltidy to retain all old line break points.</p>
-
-</dd>
-<dt id="anl---add-newlines"><b>-anl</b>, <b>--add-newlines</b></dt>
-<dd>
-
-<p>By default, perltidy will add line breaks when necessary to create continuations of long lines and to improve the script appearance. Use <b>-nanl</b> or <b>--noadd-newlines</b> to prevent any new line breaks.</p>
-
-<p>This flag does not prevent perltidy from eliminating existing line breaks; see <b>--freeze-newlines</b> to completely prevent changes to line break points.</p>
+</dl>
 
-</dd>
-<dt id="Controlling-whether-perltidy-breaks-before-or-after-operators"><b>Controlling whether perltidy breaks before or after operators</b></dt>
-<dd>
+<h2 id="Breaking-Before-or-After-Operators">Breaking Before or After Operators</h2>
 
 <p>Four command line parameters provide some control over whether a line break should be before or after specific token types. Two parameters give detailed control:</p>
 
 
 <p>and the <b>-bbao</b> flag sets the default to break before all of these operators. These can be used to define an initial break preference which can be fine-tuned with the <b>-wba</b> and <b>-wbb</b> flags. For example, to break before all operators except an <b>=</b> one could use --bbao -wba=&#39;=&#39; rather than listing every single perl operator except <b>=</b> on a -wbb flag.</p>
 
-</dd>
-<dt id="bal-n---break-after-labels-n"><b>bal=n, --break-after-labels=n</b></dt>
+<dl>
+
+<dt id="bal-n---break-after-labels-n"><b>-bal=n, --break-after-labels=n</b></dt>
 <dd>
 
 <p>This flag controls whether or not a line break occurs after a label. There are three possible values for <b>n</b>:</p>
 </dd>
 </dl>
 
+<h2 id="Adding-and-Deleting-Commas">Adding and Deleting Commas</h2>
+
+<dl>
+
+<dt id="drc---delete-repeated-commas"><b>-drc</b>, <b>--delete-repeated-commas</b></dt>
+<dd>
+
+<p>Repeated commas in a list are undesirable and can be removed with this flag. For example, given this list with a repeated comma</p>
+
+<pre><code>      ignoreSpec( $file, &quot;file&quot;,, \%spec, \%Rspec );</code></pre>
+
+<p>we can remove it with -drc</p>
+
+<pre><code>      # perltidy -drc:
+      ignoreSpec( $file, &quot;file&quot;, \%spec, \%Rspec );</code></pre>
+
+<p>Since the default is not to add or delete commas, this feature is off by default and must be requested.</p>
+
+</dd>
+<dt id="want-trailing-commas-s-or--wtc-s---add-trailing-commas-or--atc-and---delete-trailing-commas-or--dtc"><b>--want-trailing-commas=s</b> or <b>-wtc=s</b>, <b>--add-trailing-commas</b> or <b>-atc</b>, and <b>--delete-trailing-commas</b> or <b>-dtc</b></dt>
+<dd>
+
+<p>A trailing comma is a comma following the last item of a list. Perl allows trailing commas but they are not required. By default, perltidy does not add or delete trailing commas, but it is possible to manipulate them with the following set of three related parameters:</p>
+
+<pre><code>  --want-trailing-commas=s, -wtc=s - defines where trailing commas are wanted
+  --add-trailing-commas,    -atc   - gives permission to add trailing commas to match the style wanted
+  --delete-trailing-commas, -dtc   - gives permission to delete trailing commas which do not match the style wanted</code></pre>
+
+<p>The parameter <b>--want-trailing-commas=s</b>, or <b>-wtc=s</b>, defines a preferred style. The string <b>s</b> indicates which lists should get trailing commas, as follows:</p>
+
+<pre><code>  s=0 : no list should have a trailing comma
+  s=1 or * : every list should have a trailing comma
+  s=m a multi-line list should have a trailing commas
+  s=b trailing commas should be &#39;bare&#39; (comma followed by newline)
+  s=h lists of key=&gt;value pairs, with about one one &#39;=&gt;&#39; and one &#39;,&#39; per line,
+      with a bare trailing comma
+  s=i lists with about one comma per line, with a bare trailing comma
+  s=&#39; &#39; or -wtc not defined : leave trailing commas unchanged [DEFAULT].</code></pre>
+
+<p>This parameter by itself only indicates the where trailing commas are wanted. Perltidy only adds these trailing commas if the flag <b>--add-trailing-commas</b>, or <b>-atc</b> is set. And perltidy only removes unwanted trailing commas if the flag <b>--delete-trailing-commas</b>, or <b>-dtc</b> is set.</p>
+
+<p>Here are some example parameter combinations and their meanings</p>
+
+<pre><code>  -wtc=0 -dtc   : delete all trailing commas
+  -wtc=1 -atc   : all lists get trailing commas
+  -wtc=m -atc   : all multi-line lists get trailing commas, but
+                  single line lists remain unchanged.
+  -wtc=m -dtc   : multi-line lists remain unchanged, but
+                  any trailing commas on single line lists are removed.
+  -wtc=m -atc -dtc  : all multi-line lists get trailing commas, and
+                      any trailing commas on single line lists are removed.</code></pre>
+
+<p>For example, given the following input without a trailing comma</p>
+
+<pre><code>    bless {
+        B    =&gt; $B,
+        Root =&gt; $Root
+    } =&gt; $package;</code></pre>
+
+<p>we can add a trailing comma after the variable <code>$Root</code> using</p>
+
+<pre><code>    # perltidy -wtc=m -atc
+    bless {
+        B    =&gt; $B,
+        Root =&gt; $Root,
+    } =&gt; $package;</code></pre>
+
+<p>This could also be achieved in this case with <b>-wtc=b</b> instead of <b>-wtc=m</b> because the trailing comma here is bare (separated from its closing brace by a newline). And it could also be achieved with <b>-wtc=h</b> because this particular list is a list of key=&gt;value pairs.</p>
+
+<p>The above styles should cover the main of situations of interest, but it is possible to apply a different style to each type of container token by including an opening token ahead of the style character in the above table. For example</p>
+
+<pre><code>    -wtc=&#39;(m [b&#39;</code></pre>
+
+<p>means that lists within parens should have multi-line trailing commas, and that lists within square brackets have bare trailing commas. Since there is no specification for curly braces in this example, their trailing commas would remain unchanged.</p>
+
+<p>For parentheses, an additional item of information which can be given is an alphanumeric letter which is used to limit the selection further depending on the type of token immediately before the opening paren. The possible letters are currently &#39;k&#39;, &#39;K&#39;, &#39;f&#39;, &#39;F&#39;, &#39;w&#39;, and &#39;W&#39;, with these meanings for matching whatever precedes an opening paren:</p>
+
+<pre><code> &#39;k&#39; matches if the previous nonblank token is a perl built-in keyword (such as &#39;if&#39;, &#39;while&#39;),
+ &#39;K&#39; matches if &#39;k&#39; does not, meaning that the previous token is not a keyword.
+ &#39;f&#39; matches if the previous token is a function other than a keyword.
+ &#39;F&#39; matches if &#39;f&#39; does not.
+ &#39;w&#39; matches if either &#39;k&#39; or &#39;f&#39; match.
+ &#39;W&#39; matches if &#39;w&#39; does not.</code></pre>
+
+<p>These are the same codes used for <b>--line-up-parentheses-inclusion-list</b>. For example,</p>
+
+<pre><code>  -wtc = &#39;w(m&#39;</code></pre>
+
+<p>means that trailing commas are wanted for multi-line parenthesized lists following a function call or keyword.</p>
+
+<p>Here are some points to note regarding adding and deleting trailing commas:</p>
+
+<ul>
+
+<li><p>For the implementation of these parameters, a <b>list</b> is basically taken to be a container of items (parens, square brackets, or braces), which is not a code block, with one or more commas. These parameters only apply to something that fits this definition of a list.</p>
+
+<p>Note that a paren-less list of parameters is not a list by this definition, so these parameters have no effect on a peren-less list.</p>
+
+<p>Another consequence is that if the only comma in a list is deleted, then it cannot later be added back with these parameters because the container no longer fits this definition of a list. For example, given</p>
+
+<pre><code>    my ( $self, ) = @_;</code></pre>
+
+<p>and if we remove the comma with</p>
+
+<pre><code>    # perltidy -wtc=m -dtc
+    my ( $self ) = @_;</code></pre>
+
+<p>then we cannot use these trailing comma controls to add this comma back.</p>
+
+</li>
+<li><p>By <b>multiline</b> list is meant a list for which the first comma and trailing comma are on different lines.</p>
+
+</li>
+<li><p>A <b>bare</b> trailing comma is a comma which is at the end of a line. That is, the closing container token follows on a different line. So a list with a bare trailing comma is a special case of a multi-line list.</p>
+
+</li>
+<li><p>The decision regarding whether or not a list is multi-line or bare is made based on the <b>input</b> stream. In some cases it may take an iteration or two to reach a final state.</p>
+
+</li>
+<li><p>When using these parameters for the first time it is a good idea to practice on some test scripts and verify that the results are as expected.</p>
+
+</li>
+<li><p>Since the default behavior is not to add or delete commas, these parameters can be useful on a temporary basis for reformatting a script.</p>
+
+</li>
+</ul>
+
+</dd>
+<dt id="dwic---delete-weld-interfering-commas"><b>-dwic</b>, <b>--delete-weld-interfering-commas</b></dt>
+<dd>
+
+<p>If the closing tokens of two nested containers are separated by a comma, then welding requested with <b>--weld-nested-containers</b> cannot occur. Any commas in this situation are optional trailing commas and can be removed with <b>-dwic</b>. For example, a comma in this scipt prevents welding:</p>
+
+<pre><code>    # perltidy -wn
+    skip_symbols(
+        [ qw(
+            Perl_dump_fds
+            Perl_ErrorNo
+            Perl_GetVars
+            PL_sys_intern
+        ) ],
+    );</code></pre>
+
+<p>Using <b>-dwic</b> removes the comma and allows welding:</p>
+
+<pre><code>    # perltidy -wn -dwic
+    skip_symbols( [ qw(
+        Perl_dump_fds
+        Perl_ErrorNo
+        Perl_GetVars
+        PL_sys_intern
+    ) ] );</code></pre>
+
+<p>Since the default is not to add or delete commas, this feature is off by default. Here are some points to note about the <b>-dwic</b> parameter</p>
+
+<ul>
+
+<li><p>This operation is not reversible, so please check results of using this parameter carefully.</p>
+
+</li>
+<li><p>Removing this type of isolated trailing comma is necessary for welding to be possible, but not sufficient. So welding will not always occur where these commas are removed.</p>
+
+</li>
+</ul>
+
+</dd>
+</dl>
+
 <h2 id="Retaining-or-Ignoring-Existing-Line-Breaks">Retaining or Ignoring Existing Line Breaks</h2>
 
 <p>Several additional parameters are available for controlling the extent to which line breaks in the input script influence the output script. In most cases, the default parameter values are set so that, if a choice is possible, the output style follows the input style. For example, if a short logical container is broken in the input script, then the default behavior is for it to remain broken in the output script.</p>
 <dt id="bom---break-at-old-method-breakpoints"><b>-bom</b>, <b>--break-at-old-method-breakpoints</b></dt>
 <dd>
 
-<p>By default, a method call arrow <code>-&gt;</code> is considered a candidate for a breakpoint, but method chains will fill to the line width before a break is considered. With <b>-bom</b>, breaks before the arrow are preserved, so if you have preformatted a method chain:</p>
+<p>By default, a method call arrow <code>-&gt;</code> is considered a candidate for a breakpoint, but method chains will fill to the line width before a break is considered. With <b>-bom</b>, breaks before the arrow are preserved, so if you have pre-formatted a method chain:</p>
 
 <pre><code>  my $q = $rs
     -&gt;related_resultset(&#39;CDs&#39;)
 
 <p>The following list shows all short parameter names which allow a prefix &#39;n&#39; to produce the negated form:</p>
 
-<pre><code> D      anl    asbl   asc    ast    asu    atnl   aws    b      baa
- baao   bar    bbao   bbb    bbc    bbs    bl     bli    boa    boc
- bok    bol    bom    bos    bot    cblx   ce     conv   cs     csc
- cscb   cscw   dac    dbc    dcbl   dcsc   ddf    dln    dnl    dop
- dp     dpro   dsc    dsm    dsn    dtt    dwls   dwrs   dws    eos
- f      fll    fpva   frm    fs     fso    gcs    hbc    hbcm   hbco
- hbh    hbhh   hbi    hbj    hbk    hbm    hbn    hbp    hbpd   hbpu
- hbq    hbs    hbsc   hbv    hbw    hent   hic    hicm   hico   hih
- hihh   hii    hij    hik    him    hin    hip    hipd   hipu   hiq
- his    hisc   hiv    hiw    hsc    html   ibc    icb    icp    iob
- isbc   iscl   kgb    kgbd   kgbi   kis    lal    log    lop    lp
- lsl    mem    nib    ohbr   okw    ola    olc    oll    olq    opr
- opt    osbc   osbr   otr    ple    pod    pvl    q      sac    sbc
- sbl    scbb   schb   scp    scsb   sct    se     sfp    sfs    skp
- sob    sobb   sohb   sop    sosb   sot    ssc    st     sts    t
- tac    tbc    toc    tp     tqw    trp    ts     tsc    tso    vbc
- vc     vmll   vsc    w      wn     x      xci    xlp    xs</code></pre>
+<pre><code> D      anl    asbl   asc    ast    asu    atc    atnl   aws    b
+ baa    baao   bar    bbao   bbb    bbc    bbs    bl     bli    boa
+ boc    bok    bol    bom    bos    bot    cblx   ce     conv   cs
+ csc    cscb   cscw   dac    dbc    dcbl   dcsc   ddf    dln    dnl
+ dop    dp     dpro   drc    dsc    dsm    dsn    dtc    dtt    dwic
+ dwls   dwrs   dws    eos    f      fll    fpva   frm    fs     fso
+ gcs    hbc    hbcm   hbco   hbh    hbhh   hbi    hbj    hbk    hbm
+ hbn    hbp    hbpd   hbpu   hbq    hbs    hbsc   hbv    hbw    hent
+ hic    hicm   hico   hih    hihh   hii    hij    hik    him    hin
+ hip    hipd   hipu   hiq    his    hisc   hiv    hiw    hsc    html
+ ibc    icb    icp    iob    isbc   iscl   kgb    kgbd   kgbi   kis
+ lal    log    lop    lp     lsl    mem    nib    ohbr   okw    ola
+ olc    oll    olq    opr    opt    osbc   osbr   otr    ple    pod
+ pvl    q      sac    sbc    sbl    scbb   schb   scp    scsb   sct
+ se     sfp    sfs    skp    sob    sobb   sohb   sop    sosb   sot
+ ssc    st     sts    t      tac    tbc    toc    tp     tqw    trp
+ ts     tsc    tso    vbc    vc     vmll   vsc    w      wfc    wn
+ x      xci    xlp    xs</code></pre>
 
 <p>Equivalently, the prefix &#39;no&#39; or &#39;no-&#39; on the corresponding long names may be used.</p>
 
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents perltidy version 20220613</p>
+<p>This man page documents perltidy version 20221111</p>
 
 <h1 id="BUG-REPORTS">BUG REPORTS</h1>
 
index e21e21471531add982384590631148376f497aa0..1bc9778569fb09cb1208008c7521e5d0b757fbf3 100644 (file)
@@ -113,7 +113,7 @@ BEGIN {
     # then the Release version must be bumped, and it is probably past time for
     # a release anyway.
 
-    $VERSION = '20220613.06';
+    $VERSION = '20221111';
 }
 
 sub DESTROY {
index c418fa0b95f7facd6497bde8ad676eeb6f90a3e9..a09d1d804415d1455d09670a2f4713dc86b592c0 100644 (file)
@@ -475,7 +475,7 @@ The module 'Perl::Tidy' comes with a binary 'perltidy' which is installed when t
 
 =head1 VERSION
 
-This man page documents Perl::Tidy version 20220613.06
+This man page documents Perl::Tidy version 20221111
 
 =head1 LICENSE
 
index f821bae73d8a1f5721efa6785ed42f9a859f5f6a..8e29a9926ab1d0c17a1e7450f150eafcbe29b114 100644 (file)
@@ -8,7 +8,7 @@ package Perl::Tidy::Debugger;
 use strict;
 use warnings;
 use English qw( -no_match_vars );
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 use constant EMPTY_STRING => q{};
 use constant SPACE        => q{ };
index 79cb3de9220df4dad2b0d78ab826c665dea3cc9a..660f4230f6dff264133016d93fe95c23f3c1201c 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::DevNull;
 use strict;
 use warnings;
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 sub new   { my $self = shift; return bless {}, $self }
 sub print { return }
 sub close { return }
index 4a4eaa139cac2bd18618bbea385b8c002bd6c944..b1bbd7ae0fa79e1eec386f88c5badcf1bdfa39d9 100644 (file)
@@ -21,7 +21,7 @@ package Perl::Tidy::Diagnostics;
 use strict;
 use warnings;
 use English qw( -no_match_vars );
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 use constant EMPTY_STRING => q{};
 
index bc9def4e5366de55e214eedda84fabe6f1cc6e26..c76455812193af28a66c22da567893fc33819ed6 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::FileWriter;
 use strict;
 use warnings;
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 use constant DEVEL_MODE   => 0;
 use constant EMPTY_STRING => q{};
index 9643e6983ff9ce305d34316ef1d0f29ff5589589..e485156e07ae6cc66eb17ffd15845304597adba3 100644 (file)
@@ -53,7 +53,7 @@ use constant SPACE        => q{ };
 use Carp;
 use English    qw( -no_match_vars );
 use List::Util qw( min max );          # min, max are in Perl 5.8
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 # The Tokenizer will be loaded with the Formatter
 ##use Perl::Tidy::Tokenizer;    # for is_keyword()
@@ -9835,7 +9835,7 @@ sub weld_nested_containers {
     # FIXME: this block is deactivated.  It will be retained for a while for
     # use in testing, but can eventually be removed.  It is no longer necessary
     # because the test c161 below handles this issue.
-    if (0 && $rOpts_line_up_parentheses) {
+    if ( 0 && $rOpts_line_up_parentheses ) {
 
         # NOTE: this has only been found to be necessary for parens, but this
         # could be applied to all types if necessary.
index de0ad978c69a62ec1c0a4dfa92d7b8f500feead0..ae287e1dbbd5603214663c8e6c4dcff8f0daa48e 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::HtmlWriter;
 use strict;
 use warnings;
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 use English qw( -no_match_vars );
 use File::Basename;
index 7cd551a2f9e2032012740c8f3fe717db12cc8f08..e8d5f8bb484d7f9906c155668638015883dba1ac 100644 (file)
@@ -10,7 +10,7 @@ package Perl::Tidy::IOScalar;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 use constant EMPTY_STRING => q{};
 
index 212a815029189f9e57631d44273039f53c0f3600..01c2555d285e3822f969099d37d7043077fae32e 100644 (file)
@@ -14,7 +14,7 @@ package Perl::Tidy::IOScalarArray;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 sub AUTOLOAD {
 
index 9728f8b61a54fad53a0f2be58db7d25695806378..d5fb34be0104f2c08c387238adff83921a9bb60c 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::IndentationItem;
 use strict;
 use warnings;
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 BEGIN {
 
index 1fc45edb648a22b1ca2327cb1ea6fa61aac381bd..00d1357b32a64ace0ab15dcdf04a00dbc88e9d7e 100644 (file)
@@ -12,7 +12,7 @@
 package Perl::Tidy::LineBuffer;
 use strict;
 use warnings;
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 sub AUTOLOAD {
 
index 683761bb42f85c74172455d9c4ef08416a68a4dc..4d8f8702c8ce9e921ecce249274738782e01f20b 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::LineSink;
 use strict;
 use warnings;
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 sub AUTOLOAD {
 
index 41cf5b2e99bd73f82433fa6abbaa02ff297c9a26..9ef8c51d531ac9ba5fb8eababcddccebb2b91a8f 100644 (file)
@@ -9,7 +9,7 @@ package Perl::Tidy::LineSource;
 use strict;
 use warnings;
 use English qw( -no_match_vars );
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 use constant DEVEL_MODE => 0;
 
index aa7ae9a5d6471d03754a16dcd251405b19b89000..7ca91b7e19e3266109fc7f3b305b0bd04f2689dd 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::Logger;
 use strict;
 use warnings;
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 use English qw( -no_match_vars );
 
 use constant DEVEL_MODE   => 0;
index fe6d02309af8db8ef6bc1e2efc093af4b7dc4fcc..4857b6e41d4246fd0620c4e6a5309633d75acbe3 100644 (file)
@@ -23,7 +23,7 @@ use strict;
 use warnings;
 use English qw( -no_match_vars );
 
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 use Perl::Tidy::LineBuffer;
 use Carp;
index e6181528fa8e533c60f54126fe03c385eef61584..62c96bdadbae5f3239a6addfa032ec1099d5dff3 100644 (file)
@@ -3,7 +3,7 @@ use strict;
 use warnings;
 use Carp;
 use English qw( -no_match_vars );
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 use Perl::Tidy::VerticalAligner::Alignment;
 use Perl::Tidy::VerticalAligner::Line;
 
index 05d632eee8b48ed3ef7c880be0b04a15b7aaf938..23097df05347dfe4ab312397cd7b290796e287e1 100644 (file)
@@ -10,7 +10,7 @@ use warnings;
 
 { #<<< A non-indenting brace
 
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 sub new {
     my ( $class, $rarg ) = @_;
index ec705feecc36cffda5f088378accc80ae1105c7f..1dc696b7074855cc15e6b597efea8e75dfc6b430 100644 (file)
@@ -10,7 +10,7 @@ package Perl::Tidy::VerticalAligner::Line;
 use strict;
 use warnings;
 use English qw( -no_match_vars );
-our $VERSION = '20220613.06';
+our $VERSION = '20221111';
 
 sub AUTOLOAD {