]> git.donarmstrong.com Git - perltidy.git/commitdiff
changes preparing for next release, v20200822 20200822
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 22 Aug 2020 13:15:50 +0000 (06:15 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 22 Aug 2020 13:15:50 +0000 (06:15 -0700)
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 b6ca55c62ae7153762e7ef4244d850239149cc04..a6f86debb5f41fc50c71f77a1c7b88d56c3486a4 100644 (file)
@@ -1,14 +1,20 @@
 # Perltidy Change Log
 
-## 2020 06 19.02
+## 2020 08 22
 
-    - Fix RT #133166, encoding not set for -st
+    - Fix RT #133166, encoding not set for -st.  Also reported as RT #133171
+      and git #35. 
+
+      This is a significant bug in version 20200616 which can corrupt data if
+      perltidy is run as a filter on encoded text.
+**Please upgrade**
 
     - Fix issue RT #133161, perltidy -html was not working on pod
 
     - Fix issue git #33, allow control of space after '->'
 
-    - Vertical alignment has been improved.
+    - Vertical alignment has been improved. Numerous minor issues have
+      been fixed.
 
     - Formatting with the -lp option is improved. 
 
index ac6be0c6011d6a0c05579c9516d92b627cae2af3..8d345f49b959e13e08065f1c6bde4f364fdb7fa8 100755 (executable)
@@ -4054,7 +4054,7 @@ The perltidy binary uses the Perl::Tidy module and is installed when that module
 
 =head1 VERSION
 
-This man page documents perltidy version 20200619.02
+This man page documents perltidy version 20200822
 
 =head1 BUG REPORTS
 
index 4149d5f95717156ccd0e65a8047894b80e861f95..609978cc48fd14105a634ea5b1d4e9e33310908c 100644 (file)
@@ -1,5 +1,32 @@
 <h1>Perltidy Change Log</h1>
 
+<h2>2020 08 22</h2>
+
+<pre><code>- Fix RT #133166, encoding not set for -st.  Also reported as RT #133171
+  and git #35. 
+
+  This is a significant bug in version 20200616 which can corrupt data if
+  perltidy is run as a filter on encoded text.
+</code></pre>
+
+<p><strong>Please upgrade</strong></p>
+
+<pre><code>- Fix issue RT #133161, perltidy -html was not working on pod
+
+- Fix issue git #33, allow control of space after '-&gt;'
+
+- Vertical alignment has been improved. Numerous minor issues have
+  been fixed.
+
+- Formatting with the -lp option is improved. 
+
+- Fixed issue git #32, misparse of bare 'ref' in ternary
+
+- When --assert-tidy is used and triggers an error, the first difference
+  between input and output files is shown in the error output. This is
+  a partial response to issue git #30.
+</code></pre>
+
 <h2>2020 06 19</h2>
 
 <pre><code>- Added support for Switch::Plain syntax, issue git #31.
index c3501382f55eb33fd0d1d6d007899fe85ba81076..b6cf9995c4ddcc02577c2f9b3c7dcdcab2bfd0e9 100644 (file)
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents Perl::Tidy version 20200619</p>
+<p>This man page documents Perl::Tidy version 20200822</p>
 
 <h1 id="LICENSE">LICENSE</h1>
 
index 91e6b0f1844364951db2418d388acfdb66dde265..4e33e25f741b7de8dc3b6784b997989f15734f24 100644 (file)
 
 <p>will cause the perltidy to treate the words &#39;method&#39;, &#39;fun&#39;, &#39;_sub&#39; and &#39;M4&#39; to be treated the same as if they were &#39;sub&#39;. Note that if the alias words are separated by spaces then the string of words should be placed in quotes.</p>
 
+<p>Note that several other parameters accept a list of keywords, including &#39;sub&#39; (see <a href="#Specifying-Block-Types">&quot;Specifying Block Types&quot;</a>). You do not need to include any sub aliases in these lists. Just include keyword &#39;sub&#39; if you wish, and all aliases are automatically included.</p>
+
 </dd>
 </dl>
 
        print $x /$y;
    }</code></pre>
 
-<p>If formatted in this way, the program will not run (at least with recent versions of perl) because the $x is taken to be a filehandle and / is assumed to start a quote. In a complex program, there might happen to be a / which terminates the multiline quote without a syntax error, allowing the program to run, but incorrectly.</p>
+<p>If formatted in this way, the program will not run (at least with recent versions of perl) because the $x is taken to be a filehandle and / is assumed to start a quote. In a complex program, there might happen to be a / which terminates the multiline quote without a syntax error, allowing the program to run, but not as intended.</p>
 
 <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>
 
 
 <h2 id="Controlling-Vertical-Alignment">Controlling Vertical Alignment</h2>
 
-<p>Vertical alignment refers to lining up certain symbols in list of consecutive similar lines to improve readability. For example, the &quot;fat commas&quot; are aligned in the following statement:</p>
+<p>Vertical alignment refers to lining up certain symbols in list of consecutive similar lines to improve readability. For example, the &quot;fat commas&quot; are aligned in the following statement:</p>
 
 <pre><code>        $data = $pkg-&gt;new(
             PeerAddr =&gt; join( &quot;.&quot;, @port[ 0 .. 3 ] ),   
 
 <h1 id="VERSION">VERSION</h1>
 
-<p>This man page documents perltidy version 20200619</p>
+<p>This man page documents perltidy version 20200822</p>
 
 <h1 id="BUG-REPORTS">BUG REPORTS</h1>
 
index d4c6b254353981e1cfd7257407c9ca0e92730ebd..50a8eab36c937dd1f32881f98e23361a3481e426 100644 (file)
@@ -110,7 +110,7 @@ BEGIN {
     # Release version must be bumped, and it is probably past time for a
     # release anyway.
 
-    $VERSION = '20200619.02';
+    $VERSION = '20200822';
 }
 
 sub streamhandle {
@@ -221,8 +221,8 @@ EOM
         # Case 1: handle encoded data
         if ($is_encoded_data) {
             if ( ref($fh) eq 'IO::File' ) {
-                ## binmode object call not available in older perl versions 
-                ## $fh->binmode(":raw:encoding(UTF-8)");  
+                ## binmode object call not available in older perl versions
+                ## $fh->binmode(":raw:encoding(UTF-8)");
                 binmode $fh, ":raw:encoding(UTF-8)";
             }
             elsif ( $filename eq '-' ) {
@@ -1753,7 +1753,7 @@ sub compare_string_buffers {
     my ( $fho, $fnameo ) = streamhandle( \$bufo, 'r', $is_encoded_data );
     return $msg unless ( $fho && $fhi );    # for safety, shouldn't happen
     my ( $linei,              $lineo );
-    my ( $counti,             $counto ) = ( 0, 0 );
+    my ( $counti,             $counto )              = ( 0,  0 );
     my ( $last_nonblank_line, $last_nonblank_count ) = ( "", 0 );
     my $truncate = sub {
         my ( $str, $lenmax ) = @_;
@@ -2358,14 +2358,14 @@ sub generate_options {
     #   if max is undefined, there is no upper limit
     # Parameters not listed here have defaults
     %option_range = (
-        'format'             => [ 'tidy', 'html', 'user' ],
-        'output-line-ending' => [ 'dos',  'win',  'mac', 'unix' ],
-        'space-backslash-quote'         => [ 0, 2 ],
-        'block-brace-tightness'         => [ 0, 2 ],
-        'keyword-paren-inner-tightness' => [ 0, 2 ],
-        'brace-tightness'               => [ 0, 2 ],
-        'paren-tightness'               => [ 0, 2 ],
-        'square-bracket-tightness'      => [ 0, 2 ],
+        'format'                        => [ 'tidy', 'html', 'user' ],
+        'output-line-ending'            => [ 'dos',  'win',  'mac', 'unix' ],
+        'space-backslash-quote'         => [ 0,      2 ],
+        'block-brace-tightness'         => [ 0,      2 ],
+        'keyword-paren-inner-tightness' => [ 0,      2 ],
+        'brace-tightness'               => [ 0,      2 ],
+        'paren-tightness'               => [ 0,      2 ],
+        'square-bracket-tightness'      => [ 0,      2 ],
 
         'block-brace-vertical-tightness'            => [ 0, 2 ],
         'brace-vertical-tightness'                  => [ 0, 2 ],
@@ -4030,7 +4030,7 @@ sub show_version {
     print STDOUT <<"EOM";
 This is perltidy, v$VERSION 
 
-Copyright 2000-2019, Steve Hancock
+Copyright 2000-2020, Steve Hancock
 
 Perltidy is free software and may be copied under the terms of the GNU
 General Public License, which is included in the distribution files.
index 87d1619475a9bc54e434c596d81560dd56cb1beb..16577ca6f3865b549db8d109b798919e68f63898 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 20200619.02
+This man page documents Perl::Tidy version 20200822
 
 =head1 LICENSE
 
index e27870d1a05c12ad0afb8a49daa6ecbfc5080402..e2f210210fc570031f618000775a36ec73f2c092 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::Debugger;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 sub new {
 
index 8f3d27f5eaacb3d62a20a58ffcbb7fe9f1bf3803..9a10a3c25542c56d9177e349965f81e57aad0289 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::DevNull;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 sub new   { my $self = shift; return bless {}, $self }
 sub print { return }
 sub close { return }
index 0f5b463daa9a69a6b8ac0d0eac7d010c13fe0d7e..518fc1af9d01b887745963dda5a81686de93f6a2 100644 (file)
@@ -20,7 +20,7 @@
 package Perl::Tidy::Diagnostics;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 sub new {
 
index fd4d71f4a57d6b31ff5b434acf579c686812b45f..e596bcfec031d481258fcca18d3e07a279e6b25a 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::FileWriter;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 # Maximum number of little messages; probably need not be changed.
 my $MAX_NAG_MESSAGES = 6;
index 1466d94896fc1a2158322f87ca9b0774ea5229a9..2b882a9bb970d0e881cb53a559c6117c6b7065ce 100644 (file)
@@ -12,7 +12,7 @@ package Perl::Tidy::Formatter;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 # The Tokenizer will be loaded with the Formatter
 ##use Perl::Tidy::Tokenizer;    # for is_keyword()
index bf4a82d186b3437ff8b3312f8062df2301fa09d2..f422f637bfa4aa9af6c05c780ad9a6ef36d9262c 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::HtmlWriter;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 use File::Basename;
 
@@ -695,7 +695,7 @@ sub pod_to_html {
         # "header!", "index!", "recurse!", "quiet!", "verbose!"
         foreach my $kw (qw(podheader podindex podrecurse podquiet podverbose)) {
             my $kwd = $kw;    # allows us to strip 'pod'
-            if ( $rOpts->{$kw} ) { $kwd =~ s/^pod//; push @args, "--$kwd" }
+            if    ( $rOpts->{$kw} ) { $kwd =~ s/^pod//; push @args, "--$kwd" }
             elsif ( defined( $rOpts->{$kw} ) ) {
                 $kwd =~ s/^pod//;
                 push @args, "--no$kwd";
index 49264e7f43bfcd93211ceb53eba90dad9999a066..97b3e8fc0a178afda1d9b4908d2f255d189626cb 100644 (file)
@@ -10,7 +10,7 @@ package Perl::Tidy::IOScalar;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 sub new {
     my ( $package, $rscalar, $mode ) = @_;
index 41e9f9e733783583362f94d758830e9e01067baa..079faf196b622c9ae98fb78929de8f2f42b9622b 100644 (file)
@@ -14,7 +14,7 @@ package Perl::Tidy::IOScalarArray;
 use strict;
 use warnings;
 use Carp;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 sub new {
     my ( $package, $rarray, $mode ) = @_;
index aa3dc6994dfda7e29c9d8386b66129a11ace1456..09a28ce39265ec76ad05e42348e093380eaccf79 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::IndentationItem;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 sub new {
 
index 6f04bf1e31e2acc2aee90ae98c135ae7a93c691f..07ceae28e00b2f0b77eabb235dec9a64e054b233 100644 (file)
@@ -12,7 +12,7 @@
 package Perl::Tidy::LineBuffer;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 sub new {
 
index 0e312a919ad947a6148793278a68c640df3f9359..e2f6ad8b7de04558cc175a80491a0221da71a3b8 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::LineSink;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 sub new {
 
index f315ecd76cbda4ba02de23761fb2e2d927efac0c..e5b6e45888a1b13ec99f947985dfcc4e95411f12 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::LineSource;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 sub new {
 
index 23f966586549f4b0de72f764c2877ccade9f1dfa..01002e6ec005c3314f27218902a44250a2951e6f 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::Logger;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 sub new {
 
index d329620ff146e6a7c5a9301763d1189917a6c47e..d32cae6e5f1e1f2e3c743c242e3e5c8429283971 100644 (file)
@@ -21,7 +21,7 @@
 package Perl::Tidy::Tokenizer;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 use Perl::Tidy::LineBuffer;
 
@@ -1826,8 +1826,9 @@ sub prepare_for_a_new_file {
 
             # a pattern cannot follow certain keywords which take optional
             # arguments, like 'shift' and 'pop'. See also '?'.
-            if (   $last_nonblank_type eq 'k'
-                && $is_keyword_rejecting_slash_as_pattern_delimiter{$last_nonblank_token} )
+            if ( $last_nonblank_type eq 'k'
+                && $is_keyword_rejecting_slash_as_pattern_delimiter{
+                    $last_nonblank_token} )
             {
                 $is_pattern = 0;
             }
@@ -2063,8 +2064,9 @@ sub prepare_for_a_new_file {
             # Patch for rt #126965
             # a pattern cannot follow certain keywords which take optional
             # arguments, like 'shift' and 'pop'. See also '/'.
-            if (   $last_nonblank_type eq 'k'
-                && $is_keyword_rejecting_question_as_pattern_delimiter{$last_nonblank_token} )
+            if ( $last_nonblank_type eq 'k'
+                && $is_keyword_rejecting_question_as_pattern_delimiter{
+                    $last_nonblank_token} )
             {
                 $is_pattern = 0;
             }
@@ -2418,7 +2420,7 @@ sub prepare_for_a_new_file {
 
         # type = 'pp' for pre-increment, '++' for post-increment
         '++' => sub {
-            if ( $expecting == TERM ) { $type = 'pp' }
+            if    ( $expecting == TERM ) { $type = 'pp' }
             elsif ( $expecting == UNKNOWN ) {
                 my ( $next_nonblank_token, $i_next ) =
                   find_next_nonblank_token( $i, $rtokens, $max_token_index );
@@ -2439,7 +2441,7 @@ sub prepare_for_a_new_file {
         # type = 'mm' for pre-decrement, '--' for post-decrement
         '--' => sub {
 
-            if ( $expecting == TERM ) { $type = 'mm' }
+            if    ( $expecting == TERM ) { $type = 'mm' }
             elsif ( $expecting == UNKNOWN ) {
                 my ( $next_nonblank_token, $i_next ) =
                   find_next_nonblank_token( $i, $rtokens, $max_token_index );
@@ -2915,8 +2917,8 @@ EOM
             }
             my $pre_tok  = $rtokens->[$i];        # get the next pre-token
             my $pre_type = $rtoken_type->[$i];    # and type
-            $tok  = $pre_tok;
-            $type = $pre_type;                    # to be modified as necessary
+            $tok        = $pre_tok;
+            $type       = $pre_type;              # to be modified as necessary
             $block_type = "";    # blank for all tokens except code block braces
             $container_type = "";    # blank for all tokens except some parens
             $type_sequence  = "";    # blank for all tokens except ?/:
@@ -4414,15 +4416,16 @@ sub operator_expected {
         if (   $tok eq '/'
             && $next_type eq '/'
             && $last_nonblank_type eq 'k'
-            && $is_keyword_rejecting_slash_as_pattern_delimiter{$last_nonblank_token} )
+            && $is_keyword_rejecting_slash_as_pattern_delimiter{
+                $last_nonblank_token} )
         {
             $op_expected = OPERATOR;
         }
 
-       # Patch to allow a ? following 'split' to be a depricated pattern
-       # delimiter.  This patch is coordinated with the omission of split from
-       # the list %is_keyword_rejecting_question_as_pattern_delimiter. This
-       # patch will force perltidy to guess.
+        # Patch to allow a ? following 'split' to be a depricated pattern
+        # delimiter.  This patch is coordinated with the omission of split from
+        # the list %is_keyword_rejecting_question_as_pattern_delimiter. This
+        # patch will force perltidy to guess.
         elsif ($tok eq '?'
             && $last_nonblank_type eq 'k'
             && $last_nonblank_token eq 'split' )
@@ -5135,7 +5138,7 @@ sub peek_ahead_for_n_nonblank_pre_tokens {
 
     while ( $line = $tokenizer_self->{_line_buffer_object}->peek_ahead( $i++ ) )
     {
-        $line =~ s/^\s*//;    # trim leading blanks
+        $line =~ s/^\s*//;                 # trim leading blanks
         next if ( length($line) <= 0 );    # skip blank
         next if ( $line =~ /^#/ );         # skip comment
         ( $rpre_tokens, $rmap, $rpre_types ) =
@@ -5155,7 +5158,7 @@ sub peek_ahead_for_nonblank_token {
 
     while ( $line = $tokenizer_self->{_line_buffer_object}->peek_ahead( $i++ ) )
     {
-        $line =~ s/^\s*//;    # trim leading blanks
+        $line =~ s/^\s*//;                 # trim leading blanks
         next if ( length($line) <= 0 );    # skip blank
         next if ( $line =~ /^#/ );         # skip comment
         my ( $rtok, $rmap, $rtype ) =
@@ -8057,9 +8060,9 @@ BEGIN {
     # perl functions which may be unary operators.
 
     # This list is used to decide if a pattern delimited by slashes, /pattern/,
-    # can follow one of these keywords.  
+    # can follow one of these keywords.
     @q = qw(
-       chomp eof eval fc lc pop shift uc undef
+      chomp eof eval fc lc pop shift uc undef
     );
 
     @is_keyword_rejecting_slash_as_pattern_delimiter{@q} =
index fba89490f6f57e32bd6d393ee13b4e3421ee30a8..c68c26139384a898cb16f84e61986c7d636bf583 100644 (file)
@@ -1,7 +1,7 @@
 package Perl::Tidy::VerticalAligner;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 use Perl::Tidy::VerticalAligner::Alignment;
 use Perl::Tidy::VerticalAligner::Line;
index f7e1e4e92bad9cf857acd995e0f5033f349351d8..1076c68ed3568cc16c11df88d314bd078b7cbfd3 100644 (file)
@@ -7,7 +7,7 @@
 package Perl::Tidy::VerticalAligner::Alignment;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 {
 
@@ -34,13 +34,13 @@ our $VERSION = '20200619.02';
         my ( $caller, %arg ) = @_;
         my $caller_is_obj = ref($caller);
         my $class         = $caller_is_obj || $caller;
-        my $self = bless {}, $class;
+        my $self          = bless {}, $class;
 
         foreach my $key ( keys %default_data ) {
             my $_key = '_' . $key;
             if    ( exists $arg{$key} ) { $self->{$_key} = $arg{$key} }
             elsif ($caller_is_obj)      { $self->{$_key} = $caller->{$_key} }
-            else  { $self->{$_key} = $default_data{$_key} }
+            else { $self->{$_key} = $default_data{$_key} }
         }
         if ( !defined( $self->{_starting_column} ) ) {
             $self->{_starting_column} = $self->{_column};
index d80620a41eef753eca0027bff159ed9ce1739e30..539c13afc50785afeb38869a7d6f10b4efa2904a 100644 (file)
@@ -8,7 +8,7 @@
 package Perl::Tidy::VerticalAligner::Line;
 use strict;
 use warnings;
-our $VERSION = '20200619.02';
+our $VERSION = '20200822';
 
 {