]> git.donarmstrong.com Git - perltidy.git/blobdiff - CHANGES
New upstream release (closes: #613417)
[perltidy.git] / CHANGES
diff --git a/CHANGES b/CHANGES
index 2182657737d36844b58649ad7195b646cc425833..1d8905b0488525e9b90cbebd2849c0abf88c6ece 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,238 @@
 Perltidy Change Log
+  2010 12 17
+     - added new flag -it=n or --iterations=n
+       This flag causes perltidy to do n complete iterations.  
+       For most purposes the default of n=1 should be satisfactory.  However n=2
+       can be useful when a major style change is being made, or when code is being
+       beautified on check-in to a source code control system.  The run time will be
+       approximately proportional to n, and it should seldom be necessary to use a
+       value greater than n=2.  Thanks to Jonathan Swartz
+
+     - A configuration file pathname begins with three dots, e.g.
+       ".../.perltidyrc", indicates that the file should be searched for starting
+       in the current directory and working upwards. This makes it easier to have
+       multiple projects each with their own .perltidyrc in their root directories.
+       Thanks to Jonathan Swartz for this patch.
+
+     - Added flag --notidy which disables all formatting and causes the input to be
+       copied unchanged.  This can be useful in conjunction with hierarchical
+       F<.perltidyrc> files to prevent unwanted tidying.
+       Thanks to Jonathan Swartz for this patch.
+
+     - Added prefilters and postfilters in the call to the Tidy.pm module.
+       Prefilters and postfilters. The prefilter is a code reference that 
+       will be applied to the source before tidying, and the postfilter 
+       is a code reference to the result before outputting.  
+
+       Thanks to Jonathan Swartz for this patch.  He writes:
+       This is useful for all manner of customizations. For example, I use
+       it to convert the 'method' keyword to 'sub' so that perltidy will work for
+       Method::Signature::Simple code:
+
+       Perl::Tidy::perltidy(
+          prefilter => sub { $_ = $_[0]; s/^method (.*)/sub $1 \#__METHOD/gm; return $_ },
+          postfilter => sub { $_ = $_[0]; s/^sub (.*?)\s* \#__METHOD/method $1/gm; return $_ }
+       );
+
+     - The starting indentation level of sections of code entabbed with -et=n
+       is correctly guessed if it was also produced with the same -et=n flag.  This
+       keeps the indentation stable on repeated formatting passes within an editor.
+       Thanks to Sam Kington and Glenn.
+
+     - Functions with prototype '&' had a space between the function and opening
+       peren.  This space now only occurs if the flag --space-function-paren (-sfp)
+       is set.  Thanks to Zrajm Akfohg.
+
+     - Patch to never put spaces around a bare word in braces beginning with ^ as in:
+         my $before = ${^PREMATCH};
+       even if requested with the -bt=0 flag because any spaces cause a syntax error in perl.
+       Thanks to Fabrice Dulanoy.
+
+  2009 06 16
+     - Allow configuration file to be 'perltidy.ini' for Windows systems.
+       i.e. C:\Documents and Settings\User\perltidy.ini
+       and added documentation for setting configuation file under Windows in man
+       page.  Thanks to Stuart Clark.
+
+     - Corrected problem of unwanted semicolons in hash ref within given/when code.
+      Thanks to Nelo Onyiah.
+
+     - added new flag -cscb or --closing-side-comments-balanced
+      When using closing-side-comments, and the closing-side-comment-maximum-text
+      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
+
+       } ## end foreach my $foo (sort { $b cmp $a ...
+       
+  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
+
+       } ## end foreach my $foo (sort { $b cmp $a ... })
+       
+  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.
+
+     - After an isolated closing eval block the continuation indentation will be
+       removed so that the braces line up more like other blocks.  Thanks to Yves Orton.
+
+     OLD:
+        eval {
+            #STUFF;
+            1;    # return true
+          }  
+          or do {
+            #handle error
+          };
+
+     NEW:
+        eval {
+            #STUFF;
+            1;    # return true
+        } or do {
+            #handle error
+        };
+
+     -A new flag -asbl (or --opening-anonymous-sub-brace-on-new-line) has
+      been added to put the opening brace of anonymous sub's on a new line,
+      as in the following snippet:
+
+        my $code = sub
+        {
+            my $arg = shift;
+            return $arg->(@_);
+        };
+
+      This was not possible before because the -sbl flag only applies to named
+      subs. Thanks to Benjamin Krupp.
+
+     -Fix tokenization bug with the following snippet
+       print 'hi' if { x => 1, }->{x};
+      which resulted in a semicolon being added after the comma.  The workaround
+      was to use -nasc, but this is no longer necessary.  Thanks to Brian Duggan. 
+
+     -Fixed problem in which an incorrect error message could be triggered
+     by the (unusual) combination of parameters  -lp -i=0 -l=2 -ci=0 for
+     example.  Thanks to Richard Jelinek.
+
+     -A new flag --keep-old-blank-lines=n has been added to
+     give more control over the treatment of old blank lines in
+     a script.  The manual has been revised to discuss the new
+     flag and clarify the treatment of old blank lines.  Thanks
+     to Oliver Schaefer.
+
+  2007 12 05
+     -Improved support for perl 5.10: New quote modifier 'p', new block type UNITCHECK, 
+     new keyword break, improved formatting of given/when.
+
+     -Corrected tokenization bug of something like $var{-q}.
+
+     -Numerous minor formatting improvements.
+
+     -Corrected list of operators controlled by -baao -bbao to include
+       . : ? && || and or err xor
+
+     -Corrected very minor error in log file involving incorrect comment
+     regarding need for upper case of labels.  
+
+     -Fixed problem where perltidy could run for a very long time
+     when given certain non-perl text files.
+
+     -Line breaks in un-parenthesized lists now try to follow
+     line breaks in the input file rather than trying to fill
+     lines.  This usually works better, but if this causes
+     trouble you can use -iob to ignore any old line breaks.
+     Example for the following input snippet:
+
+        print
+        "conformability (Not the same dimension)\n",
+        "\t", $have, " is ", text_unit($hu), "\n",
+        "\t", $want, " is ", text_unit($wu), "\n",
+        ;
+
+      OLD:
+        print "conformability (Not the same dimension)\n", "\t", $have, " is ",
+          text_unit($hu), "\n", "\t", $want, " is ", text_unit($wu), "\n",;
+
+      NEW:
+        print "conformability (Not the same dimension)\n",
+          "\t", $have, " is ", text_unit($hu), "\n",
+          "\t", $want, " is ", text_unit($wu), "\n",
+          ;
+
+  2007 08 01
+     -Added -fpsc option (--fixed-position-side-comment). Thanks to Ueli Hugenschmidt. 
+     For example -fpsc=40 tells perltidy to put side comments in column 40
+     if possible.  
+
+     -Added -bbao and -baao options (--break-before-all-operators and
+     --break-after-all-operators) to simplify command lines and configuration
+     files.  These define an initial preference for breaking at operators which can
+     be modified with -wba and -wbb flags.  For example to break before all operators
+     except an = one could use --bbao -wba='=' rather than listing every
+     single perl operator (except =) on a -wbb flag.
+
+     -Added -kis option (--keep-interior-semicolons).  Use the B<-kis> flag
+     to prevent breaking at a semicolon if there was no break there in the
+     input file.  To illustrate, consider the following input lines:
+
+        dbmclose(%verb_delim); undef %verb_delim;
+        dbmclose(%expanded); undef %expanded;
+        dbmclose(%global); undef %global;
+
+     Normally these would be broken into six lines, but 
+     perltidy -kis gives:
+
+        dbmclose(%verb_delim); undef %verb_delim;
+        dbmclose(%expanded);   undef %expanded;
+        dbmclose(%global);     undef %global;
+     
+ -Improved formatting of complex ternary statements, with indentation
+     of nested statements.  
+      OLD:
+        return defined( $cw->{Selected} )
+          ? (wantarray)
+          ? @{ $cw->{Selected} }
+          : $cw->{Selected}[0]
+          : undef;
+
+      NEW:
+        return defined( $cw->{Selected} )
+          ? (wantarray)
+              ? @{ $cw->{Selected} }
+              : $cw->{Selected}[0]
+          : undef;
+
+     -Text following un-parenthesized if/unless/while/until statements get a
+     full level of indentation.  Suggested by Jeff Armstorng and others. 
+     OLD:
+        return $ship->chargeWeapons("phaser-canon")
+          if $encounter->description eq 'klingon'
+          and $ship->firepower >= $encounter->firepower
+          and $location->status ne 'neutral';
+     NEW:
+        return $ship->chargeWeapons("phaser-canon")
+          if $encounter->description eq 'klingon'
+              and $ship->firepower >= $encounter->firepower
+              and $location->status ne 'neutral';
+
+  2007 05 08
+     -Fixed bug where #line directives were being indented.  Thanks to
+     Philippe Bruhat.
+
+  2007 05 04
+     -Fixed problem where an extra blank line was added after an =cut when either
+     (a) the =cut started (not stopped) a POD section, or (b) -mbl > 1. 
+     Thanks to J. Robert Ray and Bill Moseley.
+
   2007 04 24
      -ole (--output-line-ending) and -ple (--preserve-line-endings) should
      now work on all systems rather than just unix systems. Thanks to Dan
@@ -6,8 +240,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;
@@ -59,7 +293,7 @@ Perltidy Change Log
      replacement text (but does not reformat it).
 
      -improved vertical alignment of terminal else blocks and ternary statements.
-      thanks to chris for the suggestion. 
+      Thanks to Chris for the suggestion. 
 
       OLD:
         if    ( IsBitmap() ) { return GetBitmap(); }
@@ -193,7 +427,7 @@ Perltidy Change Log
      The default is not to do this.  Suggested by H.Merijn Brand.
 
      -Added patch to avoid breaking GetOpt::Long::Configure set by calling program. 
-     Thanks to BOOK at CPAN. 
+     Thanks to Philippe Bruhat.
 
      -An error was fixed in which certain parameters in a .perltidyrc file given
      without the equals sign were not recognized.  That is,
@@ -301,8 +535,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.
@@ -338,8 +572,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.
 
@@ -566,8 +800,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
@@ -690,8 +924,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
@@ -838,8 +1072,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
@@ -924,8 +1158,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.
@@ -1042,8 +1276,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
@@ -1054,8 +1288,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) {
@@ -1067,8 +1301,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.
 
@@ -1081,8 +1315,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;
         }
@@ -1189,8 +1423,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 },
@@ -1316,8 +1550,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(!)
 
@@ -1334,8 +1568,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.
 
@@ -1362,20 +1596,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
@@ -1429,8 +1663,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.  
 
@@ -1496,11 +1730,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 ($!)";
 
@@ -1579,8 +1813,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
@@ -1588,7 +1822,7 @@ Perltidy Change Log
      reason that '-lp' was not the original default is that the coding for
      it was complex and not ready for the initial release of perltidy.  If
      anyone has any strong feelings about this, I'd like to hear.  The
-     current default could always be recovered with the '-nlp' flag.  
+     current default could always be recovered with the '-nlp' flag.
 
   2001 09 03
      -html updates:
@@ -1615,8 +1849,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.
 
@@ -1692,8 +1926,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,
@@ -1747,8 +1981,8 @@ Perltidy Change Log
                          lastName  => undef,
                          hireDay   => $hireDay
                          };
-    
-      new:  my $hireDay = new Date;
+        
+  new:  my $hireDay = new Date;
             my $self = {
                          firstName => undef,
                          lastName  => undef,
@@ -1921,8 +2155,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:
 
@@ -1952,8 +2186,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).
@@ -2021,8 +2255,8 @@ Perltidy Change Log
             $mw->Label(
               -text   => "perltidy",
               -relief => 'ridge')->pack;
-      the current default is:
+     
+  the current default is:
 
             $mw->Label(
               -text   => "perltidy",
@@ -2054,8 +2288,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}
@@ -2096,3 +2330,4 @@ Perltidy Change Log
   2001 03 03:
      -Initial announcement at freshmeat.net; started Change Log
      (Unfortunately this version was DOA, but it was fixed the next day)
+