]> git.donarmstrong.com Git - perltidy.git/blobdiff - CHANGES
* New upstream release
[perltidy.git] / CHANGES
diff --git a/CHANGES b/CHANGES
index 1d8905b0488525e9b90cbebd2849c0abf88c6ece..80ad1d75e325fafbdcc44bdedcc6cf57e744fded 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,195 @@
 Perltidy Change Log
+  2012 07 01
+     - Corrected problem introduced by using a chomp on scalar references, RT #77978
+
+     - Added support for Perl 5.14 package block syntax, RT #78114.
+
+     - A convergence test is made if three or more iterations are requested with
+       the -it=n parameter to avoid wasting computer time.  Several hundred Mb of
+       code gleaned from the internet were searched with the results that: 
+        - It is unusual for two iterations to be required unless a major 
+          style change is being made. 
+        - Only one case has been found where three iterations were required.  
+        - No cases requiring four iterations have been found with this version.
+       For the previous version several cases where found the results could
+       oscillate between two semi-stable states. This version corrects this.
+
+       So if it is important that the code be converged it is okay to set -it=4
+       with this version and it will probably stop after the second iteration.
+
+     - Improved ability to identify and retain good line break points in the
+       input stream, such as at commas and equals. You can always tell 
+       perltidy to ignore old breakpoints with -iob.  
+
+     - Fixed glitch in which a terminal closing hash brace followed by semicolon
+       was not outdented back to the leading line depth like other closing
+       tokens.  Thanks to Keith Neargarder for noting this.
+
+         OLD:
+            my ( $pre, $post ) = @{
+                {
+                    "pp_anonlist" => [ "[", "]" ],
+                    "pp_anonhash" => [ "{", "}" ]
+                }->{ $kid->ppaddr }
+              };   # terminal brace
+
+         NEW:
+            my ( $pre, $post ) = @{
+                {
+                    "pp_anonlist" => [ "[", "]" ],
+                    "pp_anonhash" => [ "{", "}" ]
+                }->{ $kid->ppaddr }
+            };    # terminal brace
+
+     - Removed extra indentation given to trailing 'if' and 'unless' clauses 
+       without parentheses because this occasionally produced undesirable 
+       results.  This only applies where parens are not used after the if or
+       unless.
+
+        OLD:
+            return undef
+              unless my ( $who, $actions ) =
+                  $clause =~ /^($who_re)((?:$action_re)+)$/o; 
+    
+        NEW:
+            return undef
+              unless my ( $who, $actions ) =
+              $clause =~ /^($who_re)((?:$action_re)+)$/o;
+
+  2012 06 19
+     - Updated perltidy to handle all quote modifiers defined for perl 5 version 16.
+
+     - Side comment text in perltidyrc configuration files must now begin with
+       at least one space before the #.  Thus:
+
+       OK:
+         -l=78 # Max line width is 78 cols
+       BAD: 
+         -l=78# Max line width is 78 cols
+
+       This is probably true of almost all existing perltidyrc files, 
+       but if you get an error message about bad parameters
+       involving a '#' the first time you run this version, please check the side
+       comments in your perltidyrc file, and add a space before the # if necessary.
+       You can quickly see the contents your perltidyrc file, if any, with the
+       command:
+
+         perltidy -dpro
+
+       The reason for this change is that some parameters naturally involve
+       the # symbol, and this can get interpreted as a side comment unless the
+       parameter is quoted.  For example, to define -sphb=# it used to be necessary
+       to write
+         -sbcp='#'
+       to keep the # from becomming part of a comment.  This was causing 
+       trouble for new users.  Now it can also be written without quotes: 
+         -sbcp=#
+
+     - Fixed bug in processing some .perltidyrc files containing parameters with
+       an opening brace character, '{'.  For example the following was
+       incorrectly processed:
+          --static-block-comment-prefix="^#{2,}[^\s#]"
+       Thanks to pdagosto.
+
+     - Added flag -boa (--break-at-old-attribute-breakpoints) which retains
+       any existing line breaks at attribute separation ':'. This is now the
+       default, use -nboa to deactivate.  Thanks to Daphne Phister for the patch.  
+       For example, given the following code, the line breaks at the ':'s will be
+       retained:
+       
+                        my @field
+                          : field
+                          : Default(1)
+                          : Get('Name' => 'foo') : Set('Name');
+
+       whereas the previous version would have output a single line.  If
+       the attributes are on a single line then they will remain on a single line.
+     - Added new flags --blank-lines-before-subs=n (-blbs=n) and
+       --blank-lines-before-packages=n (-blbp=n) to put n blank lines before
+       subs and packages.  The old flag -bbs is now equivalent to -blbs=1 -blbp=1.
+       and -nbbs is equivalent to -blbs=0 -blbp=0. Requested by M. Schwern and
+       several others.
+
+     - Added feature -nsak='*' meaning no space between any keyword and opening 
+       paren.  This avoids listing entering a long list of keywords.  Requested
+       by M. Schwern.
+
+     - Added option to delete a backup of original file with in-place-modify (-b)
+       if there were no errors.  This can be requested with the flag -bext='/'.  
+       See documentation for details.  Requested by M. Schwern and others.
+
+     - Fixed bug where the module postfilter parameter was not applied when -b 
+       flag was used.  This was discovered during testing.
+
+     - Fixed in-place-modify (-b) to work with symbolic links to source files.
+       Thanks to Ted Johnson.
+
+     - Fixed bug where the Perl::Tidy module did not allow -b to be used 
+       in some cases.
+
+     - No extra blank line is added before a comment which follows
+       a short line ending in an opening token, for example like this:
+        OLD:
+                if (
+
+                    # unless we follow a blank or comment line
+                    $last_line_leading_type !~ /^[#b]$/
+                    ...
+
+        NEW:
+                if (
+                    # unless we follow a blank or comment line
+                    $last_line_leading_type !~ /^[#b]$/
+                    ...
+
+        The blank is not needed for readability in these cases because there
+        already is already space above the comment.  If a blank already 
+        exists there it will not be removed, so this change should not 
+        change code which has previously been formatted with perltidy. 
+        Thanks to R.W.Stauner.
+
+     - Likewise, no extra blank line is added above a comment consisting of a
+       single #, since nothing is gained in readability.
+
+     - Fixed error in which a blank line was removed after a #>>> directive. 
+       Thanks to Ricky Morse.
+
+     - Unnecessary semicolons after given/when/default blocks are now removed.
+
+     - Fixed bug where an unwanted blank line could be added before
+       pod text in __DATA__ or __END__ section.  Thanks to jidani.
+
+     - Changed exit flags from 1 to 0 to indicate success for -help, -version, 
+       and all -dump commands.  Also added -? as another way to dump the help.
+       Requested by Keith Neargarder.
+
+     - Fixed bug where .ERR and .LOG files were not written except for -it=2 or more
+
+     - Fixed bug where trailing blank lines at the end of a file were dropped when
+       -it>1.
+
+     - Fixed bug where a line occasionally ended with an extra space. This reduces
+       rhe number of instances where a second iteration gives a result different
+       from the first. 
+
+     - Updated documentation to note that the Tidy.pm module <stderr> parameter may
+       not be a reference to SCALAR or ARRAY; it must be a file.
+     - Syntax check with perl now work when the Tidy.pm module is processing
+       references to arrays and strings.  Thanks to Charles Alderman.
+
+     - Zero-length files are no longer processed due to concerns for data loss
+       due to side effects in some scenarios.
+
+     - block labels, if any, are now included in closing side comment text
+       when the -csc flag is used.  Suggested by Aaron.  For example, 
+       the label L102 in the following block is now included in the -csc text:
+
+          L102: for my $i ( 1 .. 10 ) {
+            ...
+          } ## end L102: for my $i ( 1 .. 10 )
+
   2010 12 17
      - added new flag -it=n or --iterations=n
        This flag causes perltidy to do n complete iterations.  
@@ -62,21 +253,21 @@ Perltidy Change Log
       limit is exceeded, then the comment text must be truncated.  Previous
       versions of perltidy terminate with three dots, and this can still be
       achieved with -ncscb:
-       
-   perltidy -csc -ncscb
+   
+       perltidy -csc -ncscb
 
        } ## end foreach my $foo (sort { $b cmp $a ...
-       
-  However this causes a problem with older editors which cannot recognize
+   
+      However this causes a problem with older editors which cannot recognize
       comments or are not configured to doso because they cannot "bounce" around in
       the text correctly.  The B<-cscb> flag tries to help them by 
       appending appropriate terminal balancing structure:
-       
-   perltidy -csc -cscb
+   
+       perltidy -csc -cscb
 
        } ## end foreach my $foo (sort { $b cmp $a ... })
-       
-  Since there is much to be gained and little to be lost by doing this,
+   
+      Since there is much to be gained and little to be lost by doing this,
       the default is B<-cscb>.  Use B<-ncscb> if you do not want this.
 
       Thanks to Daniel Becker for suggesting this option.
@@ -194,8 +385,8 @@ Perltidy Change Log
         dbmclose(%verb_delim); undef %verb_delim;
         dbmclose(%expanded);   undef %expanded;
         dbmclose(%global);     undef %global;
-     
- -Improved formatting of complex ternary statements, with indentation
    -Improved formatting of complex ternary statements, with indentation
      of nested statements.  
       OLD:
         return defined( $cw->{Selected} )
@@ -240,8 +431,8 @@ Perltidy Change Log
 
      -Fixed problem of a warning issued for multiple subs for BEGIN subs
      and other control subs. Thanks to Heiko Eissfeldt.
-     
- -Fixed problem where no space was introduced between a keyword or
    -Fixed problem where no space was introduced between a keyword or
      bareword and a colon, such as:
 
      ( ref($result) eq 'HASH' && !%$result ) ? undef: $result;
@@ -535,8 +726,8 @@ Perltidy Change Log
                            );
       This is backwards compatible with -icp. See revised manual for
       details.  Suggested by Mike Pennington.
-      
- -Added flag '--preserve-line-endings' or '-ple' to cause the output
+  
    -Added flag '--preserve-line-endings' or '-ple' to cause the output
       line ending to be the same as in the input file, for unix, dos, 
       or mac line endings.  Only works under unix. Suggested by 
       Rainer Hochschild.
@@ -572,8 +763,8 @@ Perltidy Change Log
      -Fixed bug where an __END__ statement would be mistaken for a label
      if it is immediately followed by a line with a leading colon. Thanks
      to John Bayes.
-     
- -Implemented guessing logic for brace types when it is ambiguous.  This
    -Implemented guessing logic for brace types when it is ambiguous.  This
      has been on the TODO list a long time.  Thanks to Boris Zentner for
      an example.
 
@@ -800,8 +991,8 @@ Perltidy Change Log
      -Outdenting labels (-ola) has been made the default, in order to follow the
       perlstyle guidelines better.  It's probably a good idea in general, but
       if you do not want this, use -nola in your .perltidyrc file.
-      
- -Updated rules for padding logical expressions to include more cases.
+  
    -Updated rules for padding logical expressions to include more cases.
       Thanks to Wolfgang Weisselberg for helpful discussions.
 
      -Added new flag -osbc (--outdent-static-block-comments) which will
@@ -924,8 +1115,8 @@ Perltidy Change Log
      -Pod file 'perltidy.pod' has been appended to the script 'perltidy', and
       Tidy.pod has been append to the module 'Tidy.pm'.  Older MakeMaker's
       were having trouble.
-     
- -A new flag -isbc has been added for more control on comments. This flag
    -A new flag -isbc has been added for more control on comments. This flag
       has the effect that if there is no leading space on the line, then the
       comment will not be indented, and otherwise it may be.  If both -ibc and
       -isbc are set, then -isbc takes priority.  Thanks to Frank Steinhauer
@@ -1072,8 +1263,8 @@ Perltidy Change Log
       but not otherwise:
 
             : print "Hello World\n";
-      
-  Also, perltidy will now mark a first line with leading ':' followed by
+  
+      Also, perltidy will now mark a first line with leading ':' followed by
       '#' as type SYSTEM (just as a #!  line), not to be formatted.
 
      -List formatting improved for certain lists with special
@@ -1158,8 +1349,8 @@ Perltidy Change Log
       and this has solved a lot of robustness problems.  These systems 
       cannot reliably handle backtick operators.  See man page for
       details.
-      
- -Merged VMS filename handling patch sent by Michael Cartmell.  (Invalid
+  
    -Merged VMS filename handling patch sent by Michael Cartmell.  (Invalid
       output filenames were being created in some cases). 
 
      -Numerous minor improvements have been made for -lp style indentation.
@@ -1276,8 +1467,8 @@ Perltidy Change Log
 
         Note how the closing ');' is lined up with the first line, even
         though it closes a paren in the 'pack' line.  That seems wrong.
-     
-    NEW:
+        NEW:
             $mw->Button(
                 -text    => "New Document",
                 -command => \&new_document
@@ -1288,8 +1479,8 @@ Perltidy Change Log
 
        This seems nicer: you can up-arrow with an editor and arrive at the
        opening 'pack' line.
-     
- -corrected minor glitch in which cuddled else (-ce) did not get applied
    -corrected minor glitch in which cuddled else (-ce) did not get applied
      to an 'unless' block, which should look like this:
 
             unless ($test) {
@@ -1301,8 +1492,8 @@ Perltidy Change Log
       Thanks to Jeremy Mates for reporting this.
 
      -The man page has been reorganized to parameters easier to find.
-     
- -Added check for multiple definitions of same subroutine.  It is easy
    -Added check for multiple definitions of same subroutine.  It is easy
       to introduce this problem when cutting and pasting. Perl does not
       complain about it, but it can lead to disaster.
 
@@ -1315,8 +1506,8 @@ Perltidy Change Log
      -Side comment alignment has been improved somewhat across frequent level
       changes, as in short if/else blocks.  Thanks to Wolfgang Weisselberg 
       for pointing out this problem.  For example:
-        
-    OLD:
+    
+        OLD:
         if ( ref $self ) {    # Called as a method
             $format = shift;
         }
@@ -1423,8 +1614,8 @@ Perltidy Change Log
         );
 
         The structure is clearer with the added indentation:
-        
-    NEW:
+    
+        NEW:
         %{ $self->{COMPONENTS} } = (
             fname =>
               { type => 'name', adj => 'yes', font => 'Helvetica', 'index' => 0 },
@@ -1550,8 +1741,8 @@ Perltidy Change Log
       -Corrected tokenization error for the following (highly non-recommended) 
        construct:
         $user = @vars[1] / 100;
-     
-  -Resolved cause of a difference between perltidy under perl v5.6.1 and
+      -Resolved cause of a difference between perltidy under perl v5.6.1 and
       5.005_03; the problem was different behavior of \G regex position
       marker(!)
 
@@ -1568,8 +1759,8 @@ Perltidy Change Log
 
      The formatter mistakenly thought that it had found the following 
      one-line block:
-     
-        eval {#open Socket to Dispatcher$sock = &OpenSocket; };
+            eval {#open Socket to Dispatcher$sock = &OpenSocket; };
 
      The patch fixes this. Many thanks to Henry Story for reporting this bug.
 
@@ -1596,20 +1787,20 @@ Perltidy Change Log
      -Fixed tokenization error in which a method call of the form
 
         Module::->new();
-     
-  got a space before the '::' like this:
+      got a space before the '::' like this:
 
         Module ::->new();
 
       Thanks to David Holden for reporting this.
-     
- -Added -html control over pod text, using a new abbreviation 'pd'.  See
    -Added -html control over pod text, using a new abbreviation 'pd'.  See
      updated perl2web man page. The default is to use the color of a comment,
      but italicized.  Old .css style sheets will need a new line for
      .pd to use this.  The old color was the color of a string, and there
      was no control.  
-     
- -.css lines are now printed in sorted order.
    -.css lines are now printed in sorted order.
 
      -Fixed interpolation problem where html files had '$input_file' as title
      instead of actual input file name.  Thanks to Simon Perreault for finding
@@ -1663,8 +1854,8 @@ Perltidy Change Log
               : $opts{"s"} ? 'subject'
               : $opts{"a"} ? 'author'
               : 'title';
-     
- You can use -wba=':' to recover the previous default which placed ':'
    You can use -wba=':' to recover the previous default which placed ':'
      at the end of a line.  Thanks to Michael Cartmell for helpful
      discussions and examples.  
 
@@ -1730,11 +1921,11 @@ Perltidy Change Log
      nevertheless broken in the input file at a 'good' location (see below), 
      perltidy will try to retain a break.  For example, the following line
      will be formatted as:
-     
-    open SUM, "<$file"
+        open SUM, "<$file"
           or die "Cannot open $file ($!)";
-     
- if it was broken in the input file, and like this if not:
    if it was broken in the input file, and like this if not:
 
         open SUM, "<$file" or die "Cannot open $file ($!)";
 
@@ -1813,8 +2004,8 @@ Perltidy Change Log
                     print "Bye, bye baby!\n";
                     unlink $0;
             }
-            
- The new version will not let that happen.
+        
    The new version will not let that happen.
 
      -I am contemplating (but have not yet implemented) making '-lp' the
      default indentation, because it is stable now and may be closer to how
@@ -1849,8 +2040,8 @@ Perltidy Change Log
       -Improved syntax checking and corrected tokenization of functions such
       as rand, srand, sqrt, ...  These can accept either an operator or a term
       to their right.  This has been corrected.
-     
- -Corrected tokenization of semicolon: testing of the previous update showed 
    -Corrected tokenization of semicolon: testing of the previous update showed 
      that the semicolon in the following statement was being mis-tokenized.  That
      did no harm, other than adding an extra blank space, but has been corrected.
 
@@ -1926,8 +2117,8 @@ Perltidy Change Log
                             $biblionumber, $constraint,
                             $bibitems
                             );
-     
- The updated version doesn't do this unless the space is really needed:
    The updated version doesn't do this unless the space is really needed:
 
      new: my $fee = CalcReserveFee(
                                    $env,          $borrnum,
@@ -1981,8 +2172,8 @@ Perltidy Change Log
                          lastName  => undef,
                          hireDay   => $hireDay
                          };
-        
-  new:  my $hireDay = new Date;
+    
+      new:  my $hireDay = new Date;
             my $self = {
                          firstName => undef,
                          lastName  => undef,
@@ -2155,8 +2346,8 @@ Perltidy Change Log
      $^W =1 to BEGIN {$^W=1} to use warnings in compile phase, and corrected
      several unnecessary 'my' declarations. Many thanks to Wolfgang Weisselberg,
      2001-06-12, for catching these errors.
-     
- -A '-bar' flag has been added to require braces to always be on the
    -A '-bar' flag has been added to require braces to always be on the
      right, even for multi-line if and foreach statements.  For example,
      the default formatting of a long if statement would be:
 
@@ -2186,8 +2377,8 @@ Perltidy Change Log
      calls.  This will also cause full indentation ('-i=n, default n= 4) of
      continued parameter list lines rather than just the number of spaces
      given with -ci=n, default n=2.
-     
- -Added support for hanging side comments.  Perltidy identifies a hanging
    -Added support for hanging side comments.  Perltidy identifies a hanging
      side comment as a comment immediately following a line with a side
      comment or another hanging side comment.  This should work in most
      cases.  It can be deactivated with --no-hanging-side-comments (-nhsc).
@@ -2255,8 +2446,8 @@ Perltidy Change Log
             $mw->Label(
               -text   => "perltidy",
               -relief => 'ridge')->pack;
-     
-  the current default is:
+      the current default is:
 
             $mw->Label(
               -text   => "perltidy",
@@ -2288,8 +2479,8 @@ Perltidy Change Log
      -fixed another cuddled-else formatting bug (Reported by Craig Bourne)
 
      -added several diagnostic --dump routines
-     
- -added token-level whitespace controls (suggested by Hans Ecke)
    -added token-level whitespace controls (suggested by Hans Ecke)
 
   2001 03 23:
      -added support for special variables of the form ${^WANT_BITS}