]> git.donarmstrong.com Git - perltidy.git/blobdiff - CHANGES
switch debhelper to compatibility 10
[perltidy.git] / CHANGES
diff --git a/CHANGES b/CHANGES
index 1d8905b0488525e9b90cbebd2849c0abf88c6ece..1f6a50a900718be9444e00c9ede2c572f0f5fd07 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,678 @@
 Perltidy Change Log
+  2017 05 21
+      - Fixed debian #862667: failure to check for perltidy.ERR deletion can lead 
+        to overwriting abritrary files by symlink attack. Perltidy was continuing 
+        to write files after an unlink failure.  Thanks to Don Armstrong 
+        for a patch.
+
+      - Fixed RT #116344, perltidy fails on certain anonymous hash references:
+        in the following code snippet the '?' was misparsed as a pattern 
+        delimiter rather than a ternary operator.
+            return ref {} ? 1 : 0;
+
+      - Fixed RT #113792: misparsing of a fat comma (=>) right after 
+        the __END__ or __DATA__ tokens.  These keywords were getting
+        incorrectly quoted by the following => operator.
+
+      - Fixed RT #118558. Custom Getopt::Long configuration breaks parsing 
+        of perltidyrc.  Perltidy was resetting the users configuration too soon.
+
+      - Fixed RT #119140, failure to parse double diamond operator.  Code to
+        handle this new operator has been added.
+
+      - Fixed RT #120968.  Fixed problem where -enc=utf8 didn't work 
+        with --backup-and-modify-in-place. Thanks to Heinz Knutzen for this patch.
+
+      - Fixed minor formatting issue where one-line blocks for subs with signatures 
+        were unnecesarily broken
+
+      - RT #32905, patch to fix utf-8 error when output was STDOUT. 
+
+      - RT #79947, improved spacing of try/catch/finally blocks. Thanks to qsimpleq
+        for a patch.
+
+      - Fixed #114909, Anonymous subs with signatures and prototypes misparsed as
+        broken ternaries, in which a statement such as this was not being parsed
+        correctly:
+            return sub ( $fh, $out ) : prototype(*$) { ... }
+
+      - Implemented RT #113689, option to introduces spaces after an opening block
+        brace and before a closing block brace. Four new optional controls are
+        added. The first two define the minimum number of blank lines to be
+        inserted 
+
+         -blao=i or --blank-lines-after-opening-block=i
+         -blbc=i or --blank-lines-before-closing-block=i
+
+        where i is an integer, the number of lines (the default is 0).  
+
+        The second two define the types of blocks to which the first two apply 
+
+         -blaol=s or --blank-lines-after-opening-block-list=s
+         -blbcl=s or --blank-lines-before-closing-block-list=s
+    
+        where s is a string of possible block keywords (default is just 'sub',
+        meaning a named subroutine).
+
+        For more information please see the documentation.
+
+      - The method for specifying block types for certain input parameters has
+        been generalized to distinguish between normal named subroutines and
+        anonymous subs.  The keyword for normal subroutines remains 'sub', and
+        the new keyword for anonymous subs is 'asub'. 
+
+      - Minor documentation changes. The BUGS sections now have a link
+        to CPAN where most open bugs and issues can be reviewed and bug reports
+        can be submitted.  The information in the AUTHOR and CREDITS sections of
+        the man pages have been removed from the man pages to streamline the
+        documentation. This information is still in the source code.
+
+  2016 03 02
+      - RT #112534. Corrected a minor problem in which an unwanted newline
+        was placed before the closing brace of an anonymous sub with 
+        a signature, if it was in a list.  Thanks to Dmytro Zagashev.
+
+      - Corrected a minor problem in which occasional extra indentation was
+        given to the closing brace of an anonymous sub in a list when the -lp 
+        parameter was set.
+
+  2016 03 01
+      - RT #104427. Added support for signatures.
+
+      - RT #111512.  Changed global warning flag $^W = 1 to use warnings;
+        Thanks to Dmytro Zagashev.
+
+      - RT #110297, added support for new regexp modifier /n
+        Thanks to Dmytro Zagashev.
+
+      - RT #111519.  The -io (--indent-only) and -dac (--delete-all-comments)
+        can now both be used in one pass. Thanks to Dmitry Veltishev.
+
+      - Patch to avoid error message with 'catch' used by TryCatch, as in
+           catch($err){
+              # do something
+           }
+        Thanks to Nick Tonkin.
+
+      - RT #32905, UTF-8 coding is now more robust. Thanks to qsimpleq
+        and Dmytro for patches.
+
+      - RT #106885. Added string bitwise operators ^. &. |. ~. ^.= &.= |.=
+      - Fixed RT #107832 and #106492, lack of vertical alignment of two lines
+        when -boc flag (break at old commas) is set.  This bug was 
+        inadvertantly introduced in previous bug fix RT #98902. 
+
+      - Some common extensions to Perl syntax are handled better.
+        In particular, the following snippet is now foratted cleanly:
+
+          method deposit( Num $amount) {
+              $self->balance( $self->balance + $amount );
+          }
+
+        A new flag -xs (--extended-syntax) was added to enable this, and the default
+        is to use -xs. 
+
+        In previous versions, and now only when -nxs is set, this snippet of code
+        generates the following error message:
+
+        "syntax error at ') {', didn't see one of: case elsif for foreach given if switch unless until when while"
+
+  2015 08 15
+      - Fixed RT# 105484, Invalid warning about 'else' in 'switch' statement.  The
+        warning happened if a 'case' statement did not use parens.
+
+      - Fixed RT# 101547, misparse of // caused error message.  Also..
+
+      - Fixed RT# 102371, misparse of // caused unwated space in //=
+
+      - Fixed RT# 100871, "silent failure of HTML Output on Windows". 
+        Changed calls to tempfile() from:
+          my ( $fh_tmp, $tmpfile ) = tempfile();
+        to have the full path name:
+          my ( $fh_tmp, $tmpfile ) = File::Temp::tempfile()
+        because of problems in the Windows version reported by Dean Pearce.
+
+      - Fixed RT# 99514, calling the perltidy module multiple times with 
+        a .perltidyrc file containing the parameter --output-line-ending 
+        caused a crash.  This was a glitch in the memoization logic. 
+
+      - Fixed RT#99961, multiple lines inside a cast block caused unwanted
+        continuation indentation.  
+
+      - RT# 32905, broken handling of UTF-8 strings. 
+        A new flag -utf8 causes perltidy assume UTF-8 encoding for input and 
+        output of an io stream.  Thanks to Sebastian Podjasek for a patch.  
+        This feature may not work correctly in older versions of Perl. 
+        It worked in a linux version 5.10.1 but not in a Windows version 5.8.3 (but
+        otherwise perltidy ran correctly).
+
+      - Warning files now report perltidy VERSION. Suggested by John Karr.
+      - Fixed long flag --nostack-closing-tokens (-nsct has always worked though). 
+        This was due to a typo.  This also fixed --nostack-opening-tokens to 
+        behave correctly.  Thanks to Rob Dixon.
+
+  2014 07 11
+      - Fixed RT #94902: abbreviation parsing in .perltidyrc files was not
+        working for multi-line abbreviations.  Thanks to Eric Fung for 
+        supplying a patch. 
+  
+      - Fixed RT #95708, misparsing of a hash when the first key was a perl
+        keyword, causing a semicolon to be incorrectly added.
+
+      - Fixed RT #94338 for-loop in a parenthesized block-map.  A code block within
+        parentheses of a map, sort, or grep function was being mistokenized.  In 
+        rare cases this could produce in an incorrect error message.  The fix will
+        produce some minor formatting changes.  Thanks to Daniel Trizen 
+        discovering and documenting this.
+
+      - Fixed RT #94354, excess indentation for stacked tokens.  Thanks to 
+        Colin Williams for supplying a patch.
+
+      - Added support for experimental postfix dereferencing notation introduced in
+        perl 5.20. RT #96021.
+
+      - Updated documentation to clarify the behavior of the -io flag
+        in response to RT #95709.  You can add -noll or -l=0 to prevent 
+        long comments from being outdented when -io is used.
+
+      - Added a check to prevent a problem reported in RT #81866, where large
+        scripts which had been compressed to a single line could not be formatted
+        because of a check for VERSION for MakeMaker. The workaround was to 
+        use -nvpl, but this shouldn't be necessary now.
+
+      - Fixed RT #96101; Closing brace of anonymous sub in a list was being
+        indented.  For example, the closing brace of the anonymous sub below 
+        will now be lined up with the word 'callback'.  This problem 
+        occured if there was no comma after the closing brace of the anonymous sub.  
+        This update may cause minor changes to formatting of code with lists 
+        of anonymous subs, especially TK code.
+    
+        # OLD
+        my @menu_items = (
+
+            #...
+            {
+                path     => '/_Operate/Transcode and split',
+                callback => sub {
+                    return 1 if not $self->project_opened;
+                    $self->comp('project')->transcode( split => 1 );
+                  }
+            }
+        );
+
+        # NEW
+        my @menu_items = (
+
+            #...
+            {
+                path     => '/_Operate/Transcode and split',
+                callback => sub {
+                    return 1 if not $self->project_opened;
+                    $self->comp('project')->transcode( split => 1 );
+                }
+            }
+        );
+
+  2014 03 28
+      - Fixed RT #94190 and debian Bug #742004: perltidy.LOG file left behind.
+        Thanks to George Hartzell for debugging this.  The problem was
+        caused by the memoization speedup patch in version 20121207.  An
+        unwanted flag was being set which caused a LOG to be written if 
+        perltidy was called multiple times.
+
+      - New default behavior for LOG files: If the source is from an array or 
+        string (through a call to the perltidy module) then a LOG output is only
+        possible if a logfile stream is specified.  This is to prevent 
+        unexpected perltidy.LOG files. 
+
+      - Fixed debian Bug #740670, insecure temporary file usage.  File::Temp is now
+        used to get a temporary file.  Thanks to Don Anderson for a patch.
+  
+      - Any -b (--backup-and-modify-in-place) flag is silently ignored when a 
+        source stream, destination stream, or standard output is used.  
+        This is because the -b flag may have been in a .perltidyrc file and 
+        warnings break Test::NoWarnings.  Thanks to Marijn Brand.
+
+  2013 09 22
+      - Fixed RT #88020. --converge was not working with wide characters.
+
+      - Fixed RT #78156. package NAMESPACE VERSION syntax not accepted.
+
+      - First attempt to fix RT #88588.  INDEX END tag change in pod2html breaks 
+        perltidy -html. I put in a patch which should work but I don't yet have
+        a way of testing it.
+
+  2013 08 06
+      - Fixed RT #87107, spelling
+
+  2013 08 05
+      - Fixed RT #87502, incorrect of parsing of smartmatch before hash brace
+  
+      - Added feature request RT #87330, trim whitespace after POD.
+        The flag -trp (--trim-pod) will trim trailing whitespace from lines of POD
+
+  2013 07 17
+      - Fixed RT #86929, #86930, missing lhs of assignment.
+
+      - Fixed RT #84922, moved pod from Tidy.pm into Tidy.pod
+
+  2012 12 07
+     - The flag -cab=n or --comma-arrow-breakpoints=n has been generalized
+       to give better control over breaking open short containers.  The
+       possible values are now:
+
+         n=0 break at all commas after =>  
+         n=1 stable: break at all commas after => if container is open,
+             EXCEPT FOR one-line containers
+         n=2 break at all commas after =>, BUT try to form the maximum
+             maximum one-line container lengths
+         n=3 do not treat commas after => specially at all 
+         n=4 break everything: like n=0 but also break a short container with
+             a => not followed by a comma
+         n=5 stable: like n=1 but ALSO break at open one-line containers (default)
+
+       New values n=4 and n=5 have been added to allow short blocks to be
+       broken open.  The new default is n=5, stable.  It should more closely
+       follow the breaks in the input file, and previously formatted code
+       should remain unchanged.  If this causes problems use -cab=1 to recover 
+       the former behavior.  Thanks to Tony Maszeroski for the suggestion.
+
+       To illustrate the need for the new options, if perltidy is given
+       the following code, then the old default (-cab=1) was to close up 
+       the 'index' container even if it was open in the source.  The new 
+       default (-cab=5) will keep it open if it was open in the source.
+
+        our $fancypkg = {
+            'ALL' => {
+                'index' => {
+                    'key' => 'value',
+                },
+                'alpine' => {
+                    'one'   => '+',
+                    'two'   => '+',
+                    'three' => '+',
+                },
+            }
+        };
+
+     - New debug flag --memoize (-mem).  This version contains a 
+       patch supplied by Jonathan Swartz which can significantly speed up
+       repeated calls to Perl::Tidy::perltidy in a single process by caching
+       the result of parsing the formatting parameters.  A factor of up to 10
+       speedup was achieved for masontidy (https://metacpan.org/module/masontidy).
+       The memoization patch is on by default but can be deactivated for 
+       testing with -nmem (or --no-memoize).
+
+     - New flag -tso (--tight-secret-operators) causes certain perl operator
+       sequences (secret operators) to be formatted "tightly" (without spaces).  
+       The most common of these are 0 +  and + 0 which become 0+ and +0.  The
+       operators currently modified by this flag are: 
+            =( )=  0+  +0  ()x!! ~~<>  ,=>
+       Suggested by by Philippe Bruhat. See https://metacpan.org/module/perlsecret
+       This flag is off by default.
+   
+     - New flag -vmll (--variable-maximum-line-length) makes the maximum
+       line length increase with the nesting depth of a line of code.  
+       Basically, it causes the length of leading whitespace to be ignored when
+       setting line breaks, so the formatting of a block of code is independent
+       of its nesting depth.  Try this option if you have deeply nested 
+       code or data structures, perhaps in conjunction with the -wc flag
+       described next.  The default is not todo this.
+     - New flag -wc=n (--whitespace-cycle=n) also addresses problems with
+       very deeply nested code and data structures.  When this parameter is
+       used and the nesting depth exceeds the value n, the leading whitespace 
+       will be reduced and start at 1 again.  The result is that deeply
+       nested blocks of code will shift back to the left. This occurs cyclically 
+       to any nesting depth.  This flag may be used either with or without -vmll.
+       The default is not to use this (-wc=0).
+
+     - Fixed RT #78764, error parsing smartmatch operator followed by anonymous
+       hash or array and then a ternary operator; two examples:
+
+        qr/3/ ~~ ['1234'] ? 1 : 0;
+        map { $_ ~~ [ '0', '1' ] ? 'x' : 'o' } @a;
+
+     - Fixed problem with specifying spaces around arrows using -wls='->'
+       and -wrs='->'.  Thanks to Alain Valleton for documenting this problem. 
+
+     - Implemented RT #53183, wishlist, lines of code with the same indentation
+       level which are contained with multiple stacked opening and closing tokens
+       (requested with flags -sot -sct) now have reduced indentation.  
+
+        # Default
+        $sender->MailMsg(
+            {
+                to      => $addr,
+                subject => $subject,
+                msg     => $body
+            }
+        );
+
+        # OLD: perltidy -sot -sct 
+        $sender->MailMsg( {
+                to      => $addr,
+                subject => $subject,
+                msg     => $body
+        } );
+
+        # NEW: perltidy -sot -sct 
+        $sender->MailMsg( {
+            to      => $addr,
+            subject => $subject,
+            msg     => $body
+        } );
+
+     - New flag -act=n (--all-containers-tightness=n) is an abbreviation for
+       -pt=n -sbt=n -bt=n -bbt=n, where n=0,1, or 2.  It simplifies input when all
+       containers have the same tightness. Using the same example:
+
+        # NEW: perltidy -sot -sct -act=2
+        $sender->MailMsg({
+            to      => $addr,
+            subject => $subject,
+            msg     => $body
+        });
+
+     - New flag -sac (--stack-all-containers) is an abbreviation for -sot -sct
+       This is part of wishlist item RT #53183. Using the same example again:
+
+        # NEW: perltidy -sac -act=2
+        $sender->MailMsg({
+            to      => $addr,
+            subject => $subject,
+            msg     => $body
+        });
+
+      - new flag -scbb (--stack-closing-block-brace) causes isolated closing 
+        block braces to stack as in the following example. (Wishlist item RT#73788)
+
+        DEFAULT:
+        for $w1 (@w1) {
+            for $w2 (@w2) {
+                for $w3 (@w3) {
+                    for $w4 (@w4) {
+                        push( @lines, "$w1 $w2 $w3 $w4\n" );
+                    }
+                }
+            }
+        }
+
+        perltidy -scbb:
+        for $w1 (@w1) {
+            for $w2 (@w2) {
+                for $w3 (@w3) {
+                    for $w4 (@w4) {
+                        push( @lines, "$w1 $w2 $w3 $w4\n" );
+                    } } } }
+
+       There is, at present, no flag to place these closing braces at the end
+       of the previous line. It seems difficult to develop good rules for 
+       doing this for a wide variety of code and data structures.
+
+     - Parameters defining block types may use a wildcard '*' to indicate
+       all block types.  Previously it was not possible to include bare blocks.
+     - A flag -sobb (--stack-opening-block-brace) has been introduced as an
+       alias for -bbvt=2 -bbvtl='*'.  So for example the following test code:
+
+       {{{{{{{ $testing }}}}}}}
+
+       cannot be formatted as above but can at least be kept vertically compact 
+       using perltidy -sobb -scbb
+
+       {   {   {   {   {   {   {   $testing
+                               } } } } } } }
+
+       Or even, perltidy -sobb -scbb -i=1 -bbt=2
+       {{{{{{{$testing
+             }}}}}}}
+
+
+     - Error message improved for conflicts due to -pbp; thanks to Djun Kim.
+  
+     - Fixed RT #80645, error parsing special array name '@$' when used as 
+       @{$} or $#{$}
+     - Eliminated the -chk debug flag which was included in version 20010406 to
+       do a one-time check for a bug with multi-line quotes.  It has not been
+       needed since then.
+
+     - Numerous other minor formatting improvements.
+
+  2012 07 14
+     - Added flag -iscl (--ignore-side-comment-lengths) which causes perltidy 
+       to ignore the length of side comments when setting line breaks, 
+       RT #71848.  The default is to include the length of side comments when
+       breaking lines to stay within the length prescribed by the -l=n
+       maximum line length parameter.  For example,
+
+         Default behavior on a single line with long side comment:
+            $vmsfile =~ s/;[\d\-]*$//
+              ;    # Clip off version number; we can use a newer version as well
+   
+         perltidy -iscl leaves the line intact:
+
+            $vmsfile =~ s/;[\d\-]*$//; # Clip off version number; we can use a newer version as well
+
+     - Fixed RT #78182, side effects with STDERR.  Error handling has been
+       revised and the documentation has been updated.  STDERR can now be 
+       redirected to a string reference, and perltidy now returns an 
+       error flag instead of calling die when input errors are detected. 
+       If the error flag is set then no tidied output was produced.
+       See man Perl::Tidy for an example.
+
+     - Fixed RT #78156, erroneous warning message for package VERSION syntax.
+
+     - Added abbreviations -conv (--converge) to simplify iteration control.
+       -conv is equivalent to -it=4 and will insure that the tidied code is
+       converged to its final state with the minimum number of iterations.
+
+     - Minor formatting modifications have been made to insure convergence.
+
+     - Simplified and hopefully improved the method for guessing the starting 
+       indentation level of entabbed code.  Added flag -dt=n (--default_tabsize=n) 
+       which might be helpful if the guessing method does not work well for
+       some editors.
+
+     - Added support for stacked labels, upper case X/B in hex and binary, and
+       CORE:: namespace.
+
+     - Eliminated warning messages for using keyword names as constants.
+
+  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 becoming 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 +736,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 +868,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 +914,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 +1209,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 +1246,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 +1474,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 +1598,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 +1746,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 +1832,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 +1950,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 +1962,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 +1975,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 +1989,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 +2097,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 +2224,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 +2242,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 +2270,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 +2337,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 +2404,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 +2487,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 +2523,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 +2600,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 +2655,8 @@ Perltidy Change Log
                          lastName  => undef,
                          hireDay   => $hireDay
                          };
-        
-  new:  my $hireDay = new Date;
+    
+      new:  my $hireDay = new Date;
             my $self = {
                          firstName => undef,
                          lastName  => undef,
@@ -2021,7 +2695,7 @@ Perltidy Change Log
      -Corrected minor, uncommon bug found during routine testing, in which a
      blank got inserted between a function name and its opening paren after
      a file test operator, but only in the case that the function had not
-     been previously seen.  Perl uses the existance (or lack thereof) of 
+     been previously seen.  Perl uses the existence (or lack thereof) of 
      the blank to guess if it is a function call.  That is,
         if (-l pid_filename()) {
      became
@@ -2106,7 +2780,7 @@ Perltidy Change Log
      braces, while a new parameter -bbt (block-brace-tightness) applies to
      curly braces which contain code BLOCKS. The default value is -bbt=0.
 
-     -added flag -icp (--indent-closing-paren) which leaves a statment
+     -added flag -icp (--indent-closing-paren) which leaves a statement
      termination of the form );, };, or ]; indented with the same
      indentation as the previous line.  For example,
 
@@ -2155,8 +2829,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 +2860,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 +2929,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 +2962,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}