]> git.donarmstrong.com Git - perltidy.git/commitdiff
New upstream release
authordon <don@8f7917da-ec0b-0410-a553-b9b0e350d17e>
Wed, 24 Jun 2009 05:32:19 +0000 (05:32 +0000)
committerdon <don@8f7917da-ec0b-0410-a553-b9b0e350d17e>
Wed, 24 Jun 2009 05:32:19 +0000 (05:32 +0000)
CHANGES
META.yml
TODO
bin/perltidy
debian/changelog
docs/perltidy.1
lib/Perl/Tidy.pm

diff --git a/CHANGES b/CHANGES
index 859f9f269f7738396437b3e95dd2b669439550aa..b04607e79381ddf9f93520fc176fa2ed6f019540 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,85 @@
 Perltidy Change Log
+  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.
@@ -64,8 +145,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} )
@@ -110,8 +191,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;
@@ -405,8 +486,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.
@@ -442,8 +523,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.
 
@@ -670,8 +751,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
@@ -794,8 +875,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
@@ -942,8 +1023,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
@@ -1028,8 +1109,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.
@@ -1146,8 +1227,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
@@ -1158,8 +1239,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) {
@@ -1171,8 +1252,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.
 
@@ -1185,8 +1266,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;
         }
@@ -1293,8 +1374,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 },
@@ -1420,8 +1501,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(!)
 
@@ -1438,8 +1519,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.
 
@@ -1466,20 +1547,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
@@ -1533,8 +1614,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.  
 
@@ -1600,11 +1681,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 ($!)";
 
@@ -1683,8 +1764,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
@@ -1692,7 +1773,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:
@@ -1719,8 +1800,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.
 
@@ -1796,8 +1877,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,
@@ -1851,8 +1932,8 @@ Perltidy Change Log
                          lastName  => undef,
                          hireDay   => $hireDay
                          };
-    
-      new:  my $hireDay = new Date;
+        
+  new:  my $hireDay = new Date;
             my $self = {
                          firstName => undef,
                          lastName  => undef,
@@ -2025,8 +2106,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:
 
@@ -2056,8 +2137,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).
@@ -2125,8 +2206,8 @@ Perltidy Change Log
             $mw->Label(
               -text   => "perltidy",
               -relief => 'ridge')->pack;
-      the current default is:
+     
+  the current default is:
 
             $mw->Label(
               -text   => "perltidy",
@@ -2158,8 +2239,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}
@@ -2200,3 +2281,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)
+
index 4cae087ba17aee469db5862d4be454e707067276..b6a84607392a66fef62c13b782ca65f04ff71761 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -1,10 +1,13 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Perl-Tidy
-version:      20071205
-version_from: lib/Perl/Tidy.pm
-installdirs:  site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30_01
+--- #YAML:1.0
+name:                Perl-Tidy
+version:             20090616
+abstract:            indent and reformat perl scripts
+license:             ~
+author:              
+    - Steve Hancock <perltidy@perltidy.sourceforge.net>
+generated_by:        ExtUtils::MakeMaker version 6.42
+distribution_type:   module
+requires:     
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3
diff --git a/TODO b/TODO
index 3d8882647ae4b537d928b80a592a2c860786a832..8b0aa0fd57eb74a414805063cb9f1fea3a1fb7d5 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,10 +1,51 @@
 Perltidy TODO List
-    This is a partial "wish-list" of features to add and things to do. All
-    of these are of interest, but there is no particular schedule for
-    implementing them.
+    This is a partial "wish-list" of features to add and things to do.
+
+  Perltidy not idempotent
+    Perltidy does a single pass but iterates locally to try to satisfy the
+    various constraints and formatting parameters, but in some cases it can
+    take a second pass to reach a stable format, particularly when major
+    format style changes are made. It would be useful to have a flag to
+    force a second pass, say --passes=2.
+
+    For now, a workaround for a single file is
+
+      perltidy file.pl -st | perltidy -o file.tdy
+
+  The starting indentation level is not correctly guessed when tabs are used
+    When formatting a snippet which does not begin at zero indentation,
+    perltidy must guess the starting indentation. The -sil flag can be used
+    to specify this, but this is tedious. In general we cannot know the
+    indentation and can only guess, but we can at least require that if
+    perltidy is run twice on the same snippet, with the same parameters,
+    that the indentation be correctly guessed on the second pass. Currently,
+    this is only true if there are no tabs in the leading whitespace. A
+    patch has been submitted to fix this but it needs a little work still.
+
+  -b does not work through the Tidy module
+    The use of -b in the following does not work:
+
+       use Perl::Tidy ();
+       use File::Spec;
+
+       my $file = File::Spec->catfile( $dir,
+          $filename );
+
+       Perl::Tidy::perltidy(
+          source     => $file,
+          argv        => '-b',
+          perltidyrc => $perltidyrc,
+       );
+
+    A temporary workaround is:
+
+       Perl::Tidy::perltidy(
+          argv        => "-b $file",
+          perltidyrc => $perltidyrc,
+       );
 
   Improved Vertical Alignment
-    There are many opportunities for improving vertical alignment.
+    There are still many opportunities for improving vertical alignment.
 
   Documentation
     A FAQ is needed to explain some of the more subtle formatting issues,
@@ -19,12 +60,8 @@ Perltidy TODO List
     multi-line quotes. Then code needs to be written to scan for and markup
     identifiers.
 
-  Automatic style detection
-    It would be nice to write a program to read a sample of perl code and
-    write an approximate .perltidyrc file for that style.
-
 Things which have been suggested but will not be done
   Recursive file processing
-    A -r flag might be nice, but this is probably best handled by an
-    exterior shell script.
+    A -r flag might be nice, but this is best handled by an exterior shell
+    script.
 
index 1f1529f00b9529c5c31c32bec8e679f1cfce4c46..c9c8ffc676b087b1ae2a3e6db71590d65de31abe 100755 (executable)
@@ -68,7 +68,7 @@ F<.ERR>.
 
   perltidy -b file1.pl file2.pl
 
-Modify F<file1.pl> and F<file1.pl> in place, and backup the originals to
+Modify F<file1.pl> and F<file2.pl> in place, and backup the originals to
 F<file1.pl.bak> and F<file2.pl.bak>.  If F<file1.pl.bak> and/or F<file2.pl.bak>
 already exist, they will be overwritten.
 
@@ -401,8 +401,10 @@ exactly what flags were passed to perl.
 
 =item B<-io>,   B<--indent-only>       
 
-This flag is used to deactivate all formatting and line break changes.
-When it is in effect, the only change to the script will be indentation.
+This flag is used to deactivate all formatting and line break changes
+within non-blank lines of code.
+When it is in effect, the only change to the script will be
+to the indentation and blank lines.
 And any flags controlling whitespace and newlines will be ignored.  You
 might want to use this if you are perfectly happy with your whitespace
 and line breaks, and merely want perltidy to handle the indentation.
@@ -411,7 +413,10 @@ useful when perltidy is merely being used to help find a brace error in
 a large script).
 
 Setting this flag is equivalent to setting B<--freeze-newlines> and
-B<--freeze-whitespace>.
+B<--freeze-whitespace>.  
+
+If you also want to keep your existing blank lines exactly
+as they are, you can add B<--freeze-blank-lines>. 
 
 =item B<-ole=s>,  B<--output-line-ending=s>
 
@@ -1003,7 +1008,28 @@ characters.  Omitted text is indicated with C<...>.  (Tokens, including
 sub names, are never truncated, however, so actual lengths may exceed
 this).  To illustrate, in the above example, the appended text of the
 first block is C< ( !defined( $_[0] )...>.  The existing limit of
-C<n=20> caused this text to be truncated, as indicated by the C<...>.
+C<n=20> caused this text to be truncated, as indicated by the C<...>.  See
+the next flag for additional control of the abbreviated text.
+
+=item B<-cscb>, or B<--closing-side-comments-balanced> 
+
+As discussed in the previous item, when the
+closing-side-comment-maximum-text limit is exceeded the comment text must
+be truncated.  Older versions of perltidy terminated 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 editors editors which cannot recognize
+comments or are not configured to do so because they cannot "bounce" around in
+the text correctly.  The B<-cscb> flag has been added to
+help them by appending appropriate balancing structure:
+
+  perltidy -csc -cscb
+  } ## end foreach my $foo (sort { $b cmp $a ... })
+
+The default is B<-cscb>.
 
 =item B<-csce=n>, or B<--closing-side-comment-else-flag=n> 
 
@@ -1017,6 +1043,24 @@ side comments.
 
 If B<n=1> is used, the results will be the same as B<n=2> whenever the
 resulting line length is less than the maximum allowed.
+=item B<-cscb>, or B<--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 abbreviated.  
+It is terminated with three dots if the B<-cscb> flag is negated:
+
+  perltidy -csc -ncscb
+  } ## end foreach my $foo (sort { $b cmp $a ...
+
+This causes a problem with older editors which do not recognize comments
+because they cannot "bounce" around in the text correctly.  The B<-cscb>
+flag tries to help them by appending appropriate terminal balancing structures:
+
+  perltidy -csc -cscb
+  } ## end foreach my $foo (sort { $b cmp $a ... })
+
+The default is B<-cscb>.  
+
 
 =item B<-cscw>, or B<--closing-side-comment-warnings> 
 
@@ -1265,17 +1309,26 @@ ending marker for format skipping.  The default is equivalent to
 
 =head2 Line Break Control
 
+The parameters in this section control breaks after
+non-blank lines of code.  Blank lines are controlled
+separately by parameters in the section L<Blank Line
+Control>.
+
 =over 4
 
 =item B<-fnl>,  B<--freeze-newlines>
 
-If you do not want any changes to the line breaks in your script, set
+If you do not want any changes to the line breaks within
+lines of code in your script, set
 B<-fnl>, and they will remain fixed, and the rest of the commands in
 this section and sections 
 L<Controlling List Formatting>,
-L<Retaining or Ignoring Existing Line Breaks>, and
-L<Blank Line Control> will be ignored.  You may want to use B<-noll>
-with this.
+L<Retaining or Ignoring Existing Line Breaks>. 
+You may want to use B<-noll> with this.
+
+Note: If you also want to keep your blank lines exactly
+as they are, you can use the B<-fbl> flag which is described
+in the section L<Blank Line Control>.
 
 =item B<-ce>,   B<--cuddled-else>
 
@@ -1307,7 +1360,7 @@ Use the flag B<-bl> to place the opening brace on a new line:
       important_function();
   }
 
-This flag applies to all structural blocks, including sub's (unless
+This flag applies to all structural blocks, including named sub's (unless
 the B<-sbl> flag is set -- see next item).
 
 The default style, B<-nbl>, places an opening brace on the same line as
@@ -1318,7 +1371,7 @@ the keyword introducing it.  For example,
 =item B<-sbl>,    B<--opening-sub-brace-on-new-line>     
 
 The flag B<-sbl> can be used to override the value of B<-bl> for
-opening sub braces.  For example, 
+the opening braces of named sub's.  For example, 
 
  perltidy -sbl
 
@@ -1337,6 +1390,27 @@ produces this result:
 This flag is negated with B<-nsbl>.  If B<-sbl> is not specified,
 the value of B<-bl> is used.
 
+=item B<-asbl>,    B<--opening-anonymous-sub-brace-on-new-line>     
+
+The flag B<-asbl> is like the B<-sbl> flag except that it applies
+to anonymous sub's instead of named subs. For example
+
+ perltidy -asbl
+
+produces this result:
+
+ $a = sub
+ {
+     if ( !defined( $_[0] ) ) {
+         print("Hello, World\n");
+     }
+     else {
+         print( $_[0], "\n" );
+     }
+ };
+
+This flag is negated with B<-nasbl>, and the default is B<-nasbl>.
+
 =item B<-bli>,    B<--brace-left-and-indent>     
 
 The flag B<-bli> is the same as B<-bl> but in addition it causes one 
@@ -1939,10 +2013,17 @@ maximum is exceeed.
 
 Blank lines can improve the readability of a script if they are carefully
 placed.  Perltidy has several commands for controlling the insertion,
-retention, and removal of blank lines.
+retention, and removal of blank lines.  
 
 =over 4
 
+=item B<-fbl>,  B<--freeze-blank-lines>
+
+Set B<-fbl> if you want to the blank lines in your script to
+remain exactly as they are.  The rest of the parameters in
+this section may then be ignored.  (Note: setting the B<-fbl> flag
+is equivalent to setting B<-mbl=0> and B<-kbl=2>).
+
 =item B<-bbc>,  B<--blanks-before-comments>
 
 A blank line will be introduced before a full-line comment.  This is the
@@ -1993,23 +2074,39 @@ a value of B<0> is equivalent to entering a very large number.
 
 =item B<-mbl=n> B<--maximum-consecutive-blank-lines=n>   
 
-This parameter specifies the maximum number of consecutive blank lines
-in the output script.  The default is n=1.  If the input file has more
-than n consecutive blank lines, the number will be reduced to n.
-(This obviously does not apply to pod sections, here-documents, and quotes).
+This parameter specifies the maximum number of consecutive
+blank lines which will be output within code sections of a
+script.  The default is n=1.  If the input file has more
+than n consecutive blank lines, the number will be reduced
+to n.  If B<n=0> then no blank lines will be output (unless
+all old blank lines are retained with the B<-kbl=2> flag of
+the next section).
+
+This flag obviously does not apply to pod sections,
+here-documents, and quotes.  
+
+=item B<-kbl=n>,  B<--keep-old-blank-lines=n>
+
+The B<-kbl=n> flag gives you control over how your existing blank lines are
+treated.  
+
+The possible values of B<n> are:
+
+ n=0 ignore all old blank lines
+ n=1 stable: keep old blanks, but limited by the value of the B<-mbl=n> flag
+ n=2 keep all old blank lines, regardless of the value of the B<-mbl=n> flag
+
+The default is B<n=1>.  
 
 =item B<-sob>,  B<--swallow-optional-blank-lines>
 
-All blank lines not required by the above flags, B<-bbb>, B<-bbs>, and B<-bbc>,
-will be deleted.  (But essential blank lines above pod documents will be
-retained).  This is NOT the default.
+This is equivalent to B<kbl=0> and is included for compatability with
+previous versions.
 
 =item B<-nsob>,  B<--noswallow-optional-blank-lines>
 
-Retain blank lines, including those which do not corresponding to flags
-B<-bbb>, B<-bbs>, and B<-bbc>.  This is the default.  The number of
-blanks retained is subject to the limit imposed by
-B<--maximum-consecutive-blank-lines>, however.
+This is equivalent to B<kbl=1> and is included for compatability with
+previous versions.
 
 =back
 
@@ -2099,11 +2196,28 @@ F</etc/perltidyrc>.  Note that these last two system-wide files do not
 have a leading dot.  Further system-dependent information will be found
 in the INSTALL file distributed with perltidy.
 
-This file is free format, and simply a list of parameters, just as they
-would be entered on a command line.  Any number of lines may be used,
-with any number of parameters per line, although it may be easiest to
-read with one parameter per line.  Blank lines are ignored, and text
-after a '#' is ignored to the end of a line.
+Under Windows, perltidy will also search for a configuration file named perltidy.ini since Windows does not allow files with a leading period (.).
+Use C<perltidy -dpro> to see the possbile locations for your system.
+An example might be F<C:\Documents and Settings\All Users\perltidy.ini>.
+
+Another option is the use of the PERLTIDY environment variable.
+The method for setting environment variables depends upon the version of
+Windows that you are using.  Instructions for Windows 95 and later versions can
+be found here:
+
+http://www.netmanage.com/000/20021101_005_tcm21-6336.pdf
+
+Under Windows NT / 2000 / XP the PERLTIDY environment variable can be placed in
+either the user section or the system section.  The later makes the
+configuration file common to all users on the machine.  Be sure to enter the
+full path of the configuration file in the value of the environment variable.
+Ex.  PERLTIDY=C:\Documents and Settings\perltidy.ini
+
+The configuation file is free format, and simply a list of parameters, just as
+they would be entered on a command line.  Any number of lines may be used, with
+any number of parameters per line, although it may be easiest to read with one
+parameter per line.  Blank lines are ignored, and text after a '#' is ignored
+to the end of a line.
 
 Here is an example of a F<.perltidyrc> file:
 
@@ -2680,7 +2794,7 @@ perlstyle(1), Perl::Tidy(3)
 
 =head1 VERSION
 
-This man page documents perltidy version 20071205.
+This man page documents perltidy version 20090616.
 
 =head1 CREDITS
 
@@ -2705,7 +2819,7 @@ see the CHANGES file.
 
 =head1 COPYRIGHT
 
-Copyright (c) 2000-2006 by Steve Hancock
+Copyright (c) 2000-2008 by Steve Hancock
 
 =head1 LICENSE
 
index 56902d83854245b5eadd05a2ecdbc080de3eb66d..fe07adb87a386a0ad2da9da57848a65367bbc71a 100644 (file)
@@ -1,3 +1,9 @@
+perltidy (20090616-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Don Armstrong <don@debian.org>  Tue, 23 Jun 2009 22:28:04 -0700
+
 perltidy (20071205-2) unstable; urgency=low
 
   * Fix FTBFS on perl 5.10
index 3244abd0aa9562a62c42c7cc3c4efccdfd4f214f..d7941da92f738b6a12ce07c5d7ed1d15b9266e69 100644 (file)
@@ -1,15 +1,7 @@
-.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
-.de Sh \" Subsection heading
-.br
-.if t .Sp
-.ne 5
-.PP
-\fB\\$1\fR
-.PP
-..
 .de Sp \" Vertical space (when we can't use .PP)
 .if t .sp .5v
 .if n .sp
 .    ds R" ''
 'br\}
 .\"
+.\" Escape single quotes in literal strings from groff's Unicode transform.
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
+.\"
 .\" If the F register is turned on, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
 .\" entries marked with X<> in POD.  Of course, you'll have to process the
 .\" output yourself in some meaningful fashion.
-.if \nF \{\
+.ie \nF \{\
 .    de IX
 .    tm Index:\\$1\t\\n%\t"\\$2"
 ..
 .    nr % 0
 .    rr F
 .\}
-.\"
-.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.hy 0
-.if n .na
+.el \{\
+.    de IX
+..
+.\}
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
 .\" ========================================================================
 .\"
 .IX Title "PERLTIDY 1"
-.TH PERLTIDY 1 "2007-12-05" "perl v5.8.8" "User Contributed Perl Documentation"
+.TH PERLTIDY 1 "2009-06-16" "perl v5.10.0" "User Contributed Perl Documentation"
+.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.if n .ad l
+.nh
 .SH "NAME"
 perltidy \- a perl script indenter and reformatter
 .SH "SYNOPSIS"
@@ -158,10 +157,11 @@ Perltidy can produce output on either of two modes, depending on the
 existence of an \fB\-html\fR flag.  Without this flag, the output is passed
 through a formatter.  The default formatting tries to follow the
 recommendations in \fIperlstyle\fR\|(1), but it can be controlled in detail with
-numerous input parameters, which are described in \*(L"\s-1FORMATTING\s0 \s-1OPTIONS\s0\*(R".  
+numerous input parameters, which are described in \*(L"\s-1FORMATTING\s0
+\&\s-1OPTIONS\s0\*(R".
 .PP
 When the \fB\-html\fR flag is given, the output is passed through an \s-1HTML\s0
-formatter which is described in \*(L"\s-1HTML\s0 \s-1OPTIONS\s0\*(R".  
+formatter which is described in \*(L"\s-1HTML\s0 \s-1OPTIONS\s0\*(R".
 .SH "EXAMPLES"
 .IX Header "EXAMPLES"
 .Vb 1
@@ -185,7 +185,7 @@ extension.  For any file with an error, there will be a file with extension
 \&  perltidy \-b file1.pl file2.pl
 .Ve
 .PP
-Modify \fIfile1.pl\fR and \fIfile1.pl\fR in place, and backup the originals to
+Modify \fIfile1.pl\fR and \fIfile2.pl\fR in place, and backup the originals to
 \&\fIfile1.pl.bak\fR and \fIfile2.pl.bak\fR.  If \fIfile1.pl.bak\fR and/or \fIfile2.pl.bak\fR
 already exist, they will be overwritten.
 .PP
@@ -203,7 +203,7 @@ Execute perltidy on file \fIsomefile.pl\fR with a style which approximates the
 Execute perltidy on file \fIsomefile.pl\fR, with 3 columns for each level of
 indentation (\fB\-i=3\fR) instead of the default 4 columns.  There will not be any
 tabs in the reformatted script, except for any which already exist in comments,
-pod documents, quotes, and here documents.  Output will be \fIsomefile.pl.tdy\fR. 
+pod documents, quotes, and here documents.  Output will be \fIsomefile.pl.tdy\fR.
 .PP
 .Vb 1
 \&  perltidy \-i=3 \-et=8 somefile.pl
@@ -218,7 +218,7 @@ be entabbed with one tab character per 8 spaces.
 .PP
 Execute perltidy on file \fIsomefile.pl\fR with all defaults except use \*(L"cuddled
 elses\*(R" (\fB\-ce\fR) and a maximum line length of 72 columns (\fB\-l=72\fR) instead of
-the default 80 columns.  
+the default 80 columns.
 .PP
 .Vb 1
 \&  perltidy \-g somefile.pl
@@ -251,7 +251,7 @@ it will be created.  If it exists, it will not be overwritten.
 .PP
 Write an html snippet with only the \s-1PRE\s0 section to \fIsomefile.pl.html\fR.
 This is useful when code snippets are being formatted for inclusion in a
-larger web page.  No style sheet will be written in this case.  
+larger web page.  No style sheet will be written in this case.
 .PP
 .Vb 1
 \&  perltidy \-html \-ss >mystyle.css
@@ -291,7 +291,7 @@ Options may not be bundled together.  In other words, options \fB\-q\fR and
 Option names may be terminated early as long as they are uniquely identified.
 For example, instead of \fB\-\-dump\-token\-types\fR, it would be sufficient to enter
 \&\fB\-\-dump\-tok\fR, or even \fB\-\-dump\-t\fR, to uniquely identify this command.
-.Sh "I/O control"
+.SS "I/O control"
 .IX Subsection "I/O control"
 The following parameters concern the files which are read and written.
 .IP "\fB\-h\fR,    \fB\-\-help\fR" 4
@@ -355,10 +355,10 @@ or if it is being specified explicitly with the \fB\-o=s\fR parameter.
 .IX Item "-b,    --backup-and-modify-in-place"
 Modify the input file or files in-place and save the original with the
 extension \fI.bak\fR.  Any existing \fI.bak\fR file will be deleted.  See next item
-for changing the default backup extension.  
+for changing the default backup extension.
 .Sp
 A \fB\-b\fR flag will be ignored if input is from standard input, or
-if the \fB\-html\fR flag is set. 
+if the \fB\-html\fR flag is set.
 .IP "\fB\-bext\fR=ext,    \fB\-\-backup\-file\-extension\fR=ext" 4
 .IX Item "-bext=ext,    --backup-file-extension=ext"
 Change the extension of the backup file to be something other than the
@@ -373,7 +373,7 @@ and cautions about indirect object usage.  The default, \fB\-nw\fR or
 .IP "\fB\-q\fR,    \fB\-\-quiet\fR" 4
 .IX Item "-q,    --quiet"
 Deactivate error messages and syntax checking (for running under
-an editor). 
+an editor).
 .Sp
 For example, if you use a vi-style editor, such as vim, you may execute
 perltidy as a filter from within the editor using something like
@@ -396,14 +396,14 @@ Set maximum interval between input code lines in the logfile.  This purpose of
 this flag is to assist in debugging nesting errors.  The value of \f(CW\*(C`n\*(C'\fR is
 optional.  If you set the flag \fB\-g\fR without the value of \f(CW\*(C`n\*(C'\fR, it will be
 taken to be 1, meaning that every line will be written to the log file.  This
-can be helpful if you are looking for a brace, paren, or bracket nesting error. 
+can be helpful if you are looking for a brace, paren, or bracket nesting error.
 .Sp
 Setting \fB\-g\fR also causes the logfile to be saved, so it is not necessary to
-also include \fB\-log\fR. 
+also include \fB\-log\fR.
 .Sp
 If no \fB\-g\fR flag is given, a value of 50 will be used, meaning that at least
 every 50th line will be recorded in the logfile.  This helps prevent
-excessively long log files.  
+excessively long log files.
 .Sp
 Setting a negative value of \f(CW\*(C`n\*(C'\fR is the same as not setting \fB\-g\fR at all.
 .IP "\fB\-npro\fR  \fB\-\-noprofile\fR" 4
@@ -436,19 +436,19 @@ Please see \fB\-\-dump\-options\fR for a simpler way to do this.
 .IP "\fB\-f\fR,   \fB\-\-force\-read\-binary\fR" 4
 .IX Item "-f,   --force-read-binary"
 Force perltidy to process binary files.  To avoid producing excessive
-error messages, perltidy skips files identified by the system as non\-text.
+error messages, perltidy skips files identified by the system as non-text.
 However, valid perl scripts containing binary data may sometimes be identified
-as non\-text, and this flag forces perltidy to process them.
+as non-text, and this flag forces perltidy to process them.
 .SH "FORMATTING OPTIONS"
 .IX Header "FORMATTING OPTIONS"
-.Sh "Basic Options"
+.SS "Basic Options"
 .IX Subsection "Basic Options"
 .IP "\fB\-l=n\fR, \fB\-\-maximum\-line\-length=n\fR" 4
 .IX Item "-l=n, --maximum-line-length=n"
 The default maximum line length is n=80 characters.  Perltidy will try
 to find line break points to keep lines below this length. However, long
 quotes and side comments may cause lines to exceed this length. 
-Setting \fB\-l=0\fR is equivalent to setting \fB\-l=(a large number)\fR. 
+Setting \fB\-l=0\fR is equivalent to setting \fB\-l=(a large number)\fR.
 .IP "\fB\-i=n\fR,  \fB\-\-indent\-columns=n\fR" 4
 .IX Item "-i=n,  --indent-columns=n"
 Use n columns per indentation level (default n=4).
@@ -457,13 +457,13 @@ Use n columns per indentation level (default n=4).
 Using tab characters will almost certainly lead to future portability
 and maintenance problems, so the default and recommendation is not to
 use them.  For those who prefer tabs, however, there are two different
-options.  
+options.
 .Sp
 Except for possibly introducing tab indentation characters, as outlined
 below, perltidy does not introduce any tab characters into your file,
 and it removes any tabs from the code (unless requested not to do so
 with \fB\-fws\fR).  If you have any tabs in your comments, quotes, or
-here\-documents, they will remain.
+here-documents, they will remain.
 .RS 4
 .IP "\fB\-et=n\fR,   \fB\-\-entab\-leading\-whitespace\fR" 4
 .IX Item "-et=n,   --entab-leading-whitespace"
@@ -491,7 +491,7 @@ does its own checking, but this option employs perl to get a \*(L"second
 opinion\*(R".
 .Sp
 If perl reports errors in the input file, they will not be reported in
-the error output unless the \fB\-\-warning\-output\fR flag is given. 
+the error output unless the \fB\-\-warning\-output\fR flag is given.
 .Sp
 The default is \fBnot\fR to do this type of syntax checking (although
 perltidy will still do as much self-checking as possible).  The reason
@@ -505,15 +505,17 @@ addition, if the \fB\-x\fR flag is given to perltidy, then perl will also be
 passed a \fB\-x\fR flag.  It should not normally be necessary to change
 these flags, but it can be done with the \fB\-pscf=s\fR flag.  For example,
 if the taint flag, \f(CW\*(C`\-T\*(C'\fR, is not wanted, the flag could be set to be just
-\&\fB\-pscf=\-c\fR.  
+\&\fB\-pscf=\-c\fR.
 .Sp
 Perltidy will pass your string to perl with the exception that it will
 add a \fB\-c\fR and \fB\-x\fR if appropriate.  The \fI.LOG\fR file will show
 exactly what flags were passed to perl.
 .IP "\fB\-io\fR,   \fB\-\-indent\-only\fR" 4
 .IX Item "-io,   --indent-only"
-This flag is used to deactivate all formatting and line break changes.
-When it is in effect, the only change to the script will be indentation.
+This flag is used to deactivate all formatting and line break changes
+within non-blank lines of code.
+When it is in effect, the only change to the script will be
+to the indentation and blank lines.
 And any flags controlling whitespace and newlines will be ignored.  You
 might want to use this if you are perfectly happy with your whitespace
 and line breaks, and merely want perltidy to handle the indentation.
@@ -523,6 +525,9 @@ a large script).
 .Sp
 Setting this flag is equivalent to setting \fB\-\-freeze\-newlines\fR and
 \&\fB\-\-freeze\-whitespace\fR.
+.Sp
+If you also want to keep your existing blank lines exactly
+as they are, you can add \fB\-\-freeze\-blank\-lines\fR.
 .IP "\fB\-ole=s\fR,  \fB\-\-output\-line\-ending=s\fR" 4
 .IX Item "-ole=s,  --output-line-ending=s"
 where s=\f(CW\*(C`win\*(C'\fR, \f(CW\*(C`dos\*(C'\fR, \f(CW\*(C`unix\*(C'\fR, or \f(CW\*(C`mac\*(C'\fR.  This flag tells perltidy
@@ -537,7 +542,7 @@ endings as the input file, if possible.  It should work for
 input comes from a filename (rather than stdin, for example).  If
 perltidy has trouble determining the input file line ending, it will
 revert to the default behavior of using the line ending of the host system.
-.Sh "Code Indentation Control"
+.SS "Code Indentation Control"
 .IX Subsection "Code Indentation Control"
 .IP "\fB\-ci=n\fR, \fB\-\-continuation\-indentation=n\fR" 4
 .IX Item "-ci=n, --continuation-indentation=n"
@@ -558,7 +563,7 @@ The same example, with n=0, is a little harder to read:
 .Sp
 The value given to \fB\-ci\fR is also used by some commands when a small
 space is required.  Examples are commands for outdenting labels,
-\&\fB\-ola\fR, and control keywords, \fB\-okw\fR.  
+\&\fB\-ola\fR, and control keywords, \fB\-okw\fR.
 .Sp
 When default values are not used, it is suggested that the value \fBn\fR
 given with \fB\-ci=n\fR be no more than about one-half of the number of
@@ -578,8 +583,8 @@ is specified with \fB\-i=n\fR.  Here is a small list formatted in this way:
 .Vb 5
 \&    # perltidy (default)
 \&    @month_of_year = (
-\&        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
-\&        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
+\&        \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq,
+\&        \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq, \*(AqNov\*(Aq, \*(AqDec\*(Aq
 \&    );
 .Ve
 .Sp
@@ -591,8 +596,8 @@ hash.  With this option, the above list would become:
 .Vb 5
 \&    # perltidy \-lp
 \&    @month_of_year = (
-\&                       'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
-\&                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
+\&                       \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq,
+\&                       \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq, \*(AqNov\*(Aq, \*(AqDec\*(Aq
 \&    );
 .Ve
 .Sp
@@ -635,16 +640,14 @@ section).
 .Vb 5
 \&    # perltidy \-lp \-cti=1
 \&    @month_of_year = (
-\&                       'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
-\&                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
+\&                       \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq,
+\&                       \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq, \*(AqNov\*(Aq, \*(AqDec\*(Aq
 \&                     );
-.Ve
-.Sp
-.Vb 5
+\&
 \&    # perltidy \-lp \-cti=2
 \&    @month_of_year = (
-\&                       'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
-\&                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
+\&                       \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq,
+\&                       \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq, \*(AqNov\*(Aq, \*(AqDec\*(Aq
 \&                       );
 .Ve
 .Sp
@@ -657,7 +660,7 @@ closing container token types.  In fact, \fB\-cti=n\fR is merely an
 abbreviation for \fB\-cpi=n \-csbi=n \-cbi=n\fR, where:  
 \&\fB\-cpi\fR or \fB\-\-closing\-paren\-indentation\fR controls \fB)\fR's,
 \&\fB\-csbi\fR or \fB\-\-closing\-square\-bracket\-indentation\fR controls \fB]\fR's, 
-\&\fB\-cbi\fR or \fB\-\-closing\-brace\-indentation\fR controls non-block \fB}\fR's. 
+\&\fB\-cbi\fR or \fB\-\-closing\-brace\-indentation\fR controls non-block \fB}\fR's.
 .IP "\fB\-icp\fR, \fB\-\-indent\-closing\-paren\fR" 4
 .IX Item "-icp, --indent-closing-paren"
 The \fB\-icp\fR flag is equivalent to
@@ -682,7 +685,7 @@ The default is not to do this, indicated by \fB\-nicb\fR.
 .IX Item "-olq, --outdent-long-quotes"
 When \fB\-olq\fR is set, lines which is a quoted string longer than the
 value \fBmaximum-line-length\fR will have their indentation removed to make
-them more readable.  This is the default.  To prevent such out\-denting,
+them more readable.  This is the default.  To prevent such out-denting,
 use \fB\-nolq\fR or \fB\-\-nooutdent\-long\-lines\fR.
 .IP "\fB\-oll\fR, \fB\-\-outdent\-long\-lines\fR" 4
 .IX Item "-oll, --outdent-long-lines"
@@ -704,7 +707,7 @@ has been set to), if possible.  This is the default.  For example:
 \&        }
 .Ve
 .Sp
-Use \fB\-nola\fR to not outdent labels. 
+Use \fB\-nola\fR to not outdent labels.
 .IP "Outdenting Keywords" 4
 .IX Item "Outdenting Keywords"
 .RS 4
@@ -730,7 +733,7 @@ For example, using \f(CW\*(C`perltidy \-okw\*(C'\fR on the previous example give
 \&        }
 .Ve
 .Sp
-The default is not to do this.  
+The default is not to do this.
 .IP "Specifying Outdented Keywords: \fB\-okwl=string\fR,  \fB\-\-outdent\-keyword\-list=string\fR" 4
 .IX Item "Specifying Outdented Keywords: -okwl=string,  --outdent-keyword-list=string"
 This command can be used to change the keywords which are outdented with
@@ -745,7 +748,7 @@ any \fB\-okwl\fR command in a \fI.perltidyrc\fR file.
 .RE
 .RS 4
 .RE
-.Sh "Whitespace Control"
+.SS "Whitespace Control"
 .IX Subsection "Whitespace Control"
 Whitespace refers to the blank space between variables, operators,
 and other code tokens.
@@ -777,7 +780,7 @@ values, 0, 1, and 2:
 When n is 0, there is always a space to the right of a '(' and to the left
 of a ')'.  For n=2 there is never a space.  For n=1, the default, there
 is a space unless the quantity within the parens is a single token, such
-as an identifier or quoted string.  
+as an identifier or quoted string.
 .Sp
 Likewise, the parameter \fB\-sbt=n\fR or \fB\-\-square\-bracket\-tightness=n\fR
 controls the space within square brackets, as illustrated below.
@@ -789,22 +792,22 @@ controls the space within square brackets, as illustrated below.
 .Ve
 .Sp
 Curly braces which do not contain code blocks are controlled by
-the parameter \fB\-bt=n\fR or \fB\-\-brace\-tightness=n\fR. 
+the parameter \fB\-bt=n\fR or \fB\-\-brace\-tightness=n\fR.
 .Sp
 .Vb 3
-\& $obj\->{ $parsed_sql\->{ 'table' }[0] };    # \-bt=0
-\& $obj\->{ $parsed_sql\->{'table'}[0] };      # \-bt=1 (default)
-\& $obj\->{$parsed_sql\->{'table'}[0]};        # \-bt=2
+\& $obj\->{ $parsed_sql\->{ \*(Aqtable\*(Aq }[0] };    # \-bt=0
+\& $obj\->{ $parsed_sql\->{\*(Aqtable\*(Aq}[0] };      # \-bt=1 (default)
+\& $obj\->{$parsed_sql\->{\*(Aqtable\*(Aq}[0]};        # \-bt=2
 .Ve
 .Sp
 And finally, curly braces which contain blocks of code are controlled by the
 parameter \fB\-bbt=n\fR or \fB\-\-block\-brace\-tightness=n\fR as illustrated in the
-example below.   
+example below.
 .Sp
 .Vb 3
-\& %bf = map { $_ => \-M $_ } grep { /\e.deb$/ } dirents '.'; # \-bbt=0 (default)
-\& %bf = map { $_ => \-M $_ } grep {/\e.deb$/} dirents '.';   # \-bbt=1
-\& %bf = map {$_ => \-M $_} grep {/\e.deb$/} dirents '.';     # \-bbt=2
+\& %bf = map { $_ => \-M $_ } grep { /\e.deb$/ } dirents \*(Aq.\*(Aq; # \-bbt=0 (default)
+\& %bf = map { $_ => \-M $_ } grep {/\e.deb$/} dirents \*(Aq.\*(Aq;   # \-bbt=1
+\& %bf = map {$_ => \-M $_} grep {/\e.deb$/} dirents \*(Aq.\*(Aq;     # \-bbt=2
 .Ve
 .IP "\fB\-sts\fR,   \fB\-\-space\-terminal\-semicolon\fR" 4
 .IX Item "-sts,   --space-terminal-semicolon"
@@ -896,12 +899,12 @@ than fixed rules, because perltidy must try to resolve conflicts that
 arise between them and all of the other rules that it uses.  One
 conflict that can arise is if, between two tokens, the left token wants
 a space and the right one doesn't.  In this case, the token not wanting
-a space takes priority.  
+a space takes priority.
 .Sp
 It is necessary to have a list of all token types in order to create
 this type of input.  Such a list can be obtained by the command
 \&\fB\-\-dump\-token\-types\fR.  Also try the \fB\-D\fR flag on a short snippet of code
-and look at the .DEBUG file to see the tokenization. 
+and look at the .DEBUG file to see the tokenization.
 .Sp
 \&\fB\s-1WARNING\s0\fR Be sure to put these tokens in quotes to avoid having them
 misinterpreted by your command shell.
@@ -921,7 +924,7 @@ These defaults can be modified with two commands:
 .Sp
 \&\fB\-nsak=s\fR  or \fB\-\-nospace\-after\-keyword=s\fR  removes keywords.
 .Sp
-where \fBs\fR is a list of keywords (in quotes if necessary).  For example, 
+where \fBs\fR is a list of keywords (in quotes if necessary).  For example,
 .Sp
 .Vb 2
 \&  my ( $a, $b, $c ) = @_;    # default
@@ -962,7 +965,7 @@ spaces around multi-line \f(CW\*(C`qw\*(C'\fR quotes and indenting them appropri
 multi-line \f(CW\*(C`qw\*(C'\fR quotes to be left unchanged.  This option will not
 normally be necessary, but was added for testing purposes, because in
 some versions of perl, trimming \f(CW\*(C`qw\*(C'\fR quotes changes the syntax tree.
-.Sh "Comment Controls"
+.SS "Comment Controls"
 .IX Subsection "Comment Controls"
 Perltidy has a number of ways to control the appearance of both block comments
 and side comments.  The term \fBblock comment\fR here refers to a full-line
@@ -972,7 +975,7 @@ line to the right of some code.
 .IX Item "-ibc,  --indent-block-comments"
 Block comments normally look best when they are indented to the same
 level as the code which follows them.  This is the default behavior, but
-you may use \fB\-nibc\fR to keep block comments left\-justified.  Here is an
+you may use \fB\-nibc\fR to keep block comments left-justified.  Here is an
 example:
 .Sp
 .Vb 2
@@ -1123,7 +1126,31 @@ characters.  Omitted text is indicated with \f(CW\*(C`...\*(C'\fR.  (Tokens, inc
 sub names, are never truncated, however, so actual lengths may exceed
 this).  To illustrate, in the above example, the appended text of the
 first block is \f(CW\*(C` ( !defined( $_[0] )...\*(C'\fR.  The existing limit of
-\&\f(CW\*(C`n=20\*(C'\fR caused this text to be truncated, as indicated by the \f(CW\*(C`...\*(C'\fR.
+\&\f(CW\*(C`n=20\*(C'\fR caused this text to be truncated, as indicated by the \f(CW\*(C`...\*(C'\fR.  See
+the next flag for additional control of the abbreviated text.
+.IP "\fB\-cscb\fR, or \fB\-\-closing\-side\-comments\-balanced\fR" 4
+.IX Item "-cscb, or --closing-side-comments-balanced"
+As discussed in the previous item, when the
+closing-side-comment-maximum-text limit is exceeded the comment text must
+be truncated.  Older versions of perltidy terminated with three dots, and this
+can still be achieved with \-ncscb:
+.Sp
+.Vb 2
+\&  perltidy \-csc \-ncscb
+\&  } ## end foreach my $foo (sort { $b cmp $a ...
+.Ve
+.Sp
+However this causes a problem with editors editors which cannot recognize
+comments or are not configured to do so because they cannot \*(L"bounce\*(R" around in
+the text correctly.  The \fB\-cscb\fR flag has been added to
+help them by appending appropriate balancing structure:
+.Sp
+.Vb 2
+\&  perltidy \-csc \-cscb
+\&  } ## end foreach my $foo (sort { $b cmp $a ... })
+.Ve
+.Sp
+The default is \fB\-cscb\fR.
 .IP "\fB\-csce=n\fR, or \fB\-\-closing\-side\-comment\-else\-flag=n\fR" 4
 .IX Item "-csce=n, or --closing-side-comment-else-flag=n"
 The default, \fBn=0\fR, places the text of the opening \f(CW\*(C`if\*(C'\fR statement after any
@@ -1136,6 +1163,27 @@ side comments.
 .Sp
 If \fBn=1\fR is used, the results will be the same as \fBn=2\fR whenever the
 resulting line length is less than the maximum allowed.
+=item \fB\-cscb\fR, or \fB\-\-closing\-side\-comments\-balanced\fR
+.Sp
+When using closing-side-comments, and the closing-side-comment-maximum-text
+limit is exceeded, then the comment text must be abbreviated.  
+It is terminated with three dots if the \fB\-cscb\fR flag is negated:
+.Sp
+.Vb 2
+\&  perltidy \-csc \-ncscb
+\&  } ## end foreach my $foo (sort { $b cmp $a ...
+.Ve
+.Sp
+This causes a problem with older editors which do not recognize comments
+because they cannot \*(L"bounce\*(R" around in the text correctly.  The \fB\-cscb\fR
+flag tries to help them by appending appropriate terminal balancing structures:
+.Sp
+.Vb 2
+\&  perltidy \-csc \-cscb
+\&  } ## end foreach my $foo (sort { $b cmp $a ... })
+.Ve
+.Sp
+The default is \fB\-cscb\fR.
 .IP "\fB\-cscw\fR, or \fB\-\-closing\-side\-comment\-warnings\fR" 4
 .IX Item "-cscw, or --closing-side-comment-warnings"
 This parameter is intended to help make the initial transition to the use of
@@ -1144,7 +1192,7 @@ It causes two
 things to happen if a closing side comment replaces an existing, different
 closing side comment:  first, an error message will be issued, and second, the
 original side comment will be placed alone on a new specially marked comment
-line for later attention. 
+line for later attention.
 .Sp
 The intent is to avoid clobbering existing hand-written side comments
 which happen to match the pattern of closing side comments. This flag
@@ -1152,31 +1200,31 @@ should only be needed on the first run with \fB\-csc\fR.
 .RE
 .RS 4
 .Sp
-\&\fBImportant Notes on Closing Side Comments:\fR 
-.IP "*" 4
+\&\fBImportant Notes on Closing Side Comments:\fR
+.IP "\(bu" 4
 Closing side comments are only placed on lines terminated with a closing
 brace.  Certain closing styles, such as the use of cuddled elses
 (\fB\-ce\fR), preclude the generation of some closing side comments.
-.IP "*" 4
+.IP "\(bu" 4
 Please note that adding or deleting of closing side comments takes
 place only through the commands \fB\-csc\fR or \fB\-dcsc\fR.  The other commands,
-if used, merely modify the behavior of these two commands.  
-.IP "*" 4
+if used, merely modify the behavior of these two commands.
+.IP "\(bu" 4
 It is recommended that the \fB\-cscw\fR flag be used along with \fB\-csc\fR on
 the first use of perltidy on a given file.  This will prevent loss of
 any existing side comment data which happens to have the csc prefix.
-.IP "*" 4
+.IP "\(bu" 4
 Once you use \fB\-csc\fR, you should continue to use it so that any
 closing side comments remain correct as code changes.  Otherwise, these
 comments will become incorrect as the code is updated.
-.IP "*" 4
+.IP "\(bu" 4
 If you edit the closing side comments generated by perltidy, you must also
 change the prefix to be different from the closing side comment prefix.
 Otherwise, your edits will be lost when you rerun perltidy with \fB\-csc\fR.   For
 example, you could simply change \f(CW\*(C`## end\*(C'\fR to be \f(CW\*(C`## End\*(C'\fR, since the test is
 case sensitive.  You may also want to use the \fB\-ssc\fR flag to keep these
 modified closing side comments spaced the same as actual closing side comments.
-.IP "*" 4
+.IP "\(bu" 4
 Temporarily generating closing side comments is a useful technique for
 exploring and/or debugging a perl script, especially one written by someone
 else.  You can always remove them with \fB\-dcsc\fR.
@@ -1195,42 +1243,40 @@ particularly useful for controlling how commented code is displayed.
 .IP "\fB\-sbc\fR, \fB\-\-static\-block\-comments\fR" 4
 .IX Item "-sbc, --static-block-comments"
 When \fB\-sbc\fR is used, a block comment with a special leading pattern, \f(CW\*(C`##\*(C'\fR by
-default, will be treated specially. 
+default, will be treated specially.
 .Sp
-Comments so identified  are treated as follows: 
+Comments so identified  are treated as follows:
 .RS 4
-.IP "*" 4
+.IP "\(bu" 4
 If there is no leading space on the line, then the comment will not
 be indented, and otherwise it may be,
-.IP "*" 4
+.IP "\(bu" 4
 no new blank line will be
-inserted before such a comment, and 
-.IP "*" 4
+inserted before such a comment, and
+.IP "\(bu" 4
 such a comment will never become
-a hanging side comment.  
+a hanging side comment.
 .RE
 .RS 4
 .Sp
 For example, assuming \f(CW@month_of_year\fR is
-left\-adjusted:
+left-adjusted:
 .Sp
 .Vb 4
 \&    @month_of_year = (    # \-sbc (default)
-\&        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
-\&    ##  'Dec', 'Nov'
-\&        'Nov', 'Dec');
+\&        \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq, \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq,
+\&    ##  \*(AqDec\*(Aq, \*(AqNov\*(Aq
+\&        \*(AqNov\*(Aq, \*(AqDec\*(Aq);
 .Ve
 .Sp
 Without this convention, the above code would become
 .Sp
 .Vb 2
 \&    @month_of_year = (   # \-nsbc
-\&        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
-.Ve
-.Sp
-.Vb 3
-\&        ##  'Dec', 'Nov'
-\&        'Nov', 'Dec'
+\&        \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq, \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq,
+\&  
+\&        ##  \*(AqDec\*(Aq, \*(AqNov\*(Aq
+\&        \*(AqNov\*(Aq, \*(AqDec\*(Aq
 \&    );
 .Ve
 .Sp
@@ -1247,7 +1293,7 @@ In the first case a prefix ^\es* will be added to match any leading
 whitespace, while in the second case the pattern will match only
 comments with no leading whitespace.  For example, to
 identify all comments as static block comments, one would use \f(CW\*(C`\-sbcp=#\*(C'\fR.
-To identify all left-adjusted comments as static block comments, use \f(CW\*(C`\-sbcp='^#'\*(C'\fR.
+To identify all left-adjusted comments as static block comments, use \f(CW\*(C`\-sbcp=\*(Aq^#\*(Aq\*(C'\fR.
 .Sp
 Please note that \fB\-sbcp\fR merely defines the pattern used to identify static
 block comments; it will not be used unless the switch \fB\-sbc\fR is set.  Also,
@@ -1291,7 +1337,7 @@ The default is \fB\-nssc\fR.
 .IX Item "-sscp=string, --static-side-comment-prefix=string"
 This parameter defines the prefix used to identify static side comments
 when the \fB\-ssc\fR parameter is set.  The default prefix is \f(CW\*(C`##\*(C'\fR,
-corresponding to \f(CW\*(C`\-sscp=##\*(C'\fR.  
+corresponding to \f(CW\*(C`\-sscp=##\*(C'\fR.
 .Sp
 Please note that \fB\-sscp\fR merely defines the pattern used to identify
 static side comments; it will not be used unless the switch \fB\-ssc\fR is
@@ -1301,7 +1347,7 @@ expression to be formed.
 .RE
 .RS 4
 .RE
-.Sh "Skipping Selected Sections of Code"
+.SS "Skipping Selected Sections of Code"
 .IX Subsection "Skipping Selected Sections of Code"
 Selected lines of code may be passed verbatim to the output without any
 formatting.  This feature is enabled by default but can be disabled with
@@ -1341,31 +1387,39 @@ format skipping.  The default is equivalent to \-fsb='#<<<'.  The string that
 you enter must begin with a # and should be in quotes as necessary to get past
 the command shell of your system.  It is actually the leading text of a pattern
 that is constructed by appending a '\es', so you must also include backslashes
-for characters to be taken literally rather than as patterns.  
+for characters to be taken literally rather than as patterns.
 .Sp
 Some examples show how example strings become patterns:
 .Sp
 .Vb 3
-\& \-fsb='#\e{\e{\e{' becomes /^#\e{\e{\e{\es/  which matches  #{{{ but not #{{{{
-\& \-fsb='#\e*\e*'   becomes /^#\e*\e*\es/    which matches  #** but not #***
-\& \-fsb='#\e*{2,}' becomes /^#\e*{2,}\es/  which matches  #** and #*****
+\& \-fsb=\*(Aq#\e{\e{\e{\*(Aq becomes /^#\e{\e{\e{\es/  which matches  #{{{ but not #{{{{
+\& \-fsb=\*(Aq#\e*\e*\*(Aq   becomes /^#\e*\e*\es/    which matches  #** but not #***
+\& \-fsb=\*(Aq#\e*{2,}\*(Aq becomes /^#\e*{2,}\es/  which matches  #** and #*****
 .Ve
 .IP "\fB\-fse=string\fR,  \fB\-\-format\-skipping\-end=string\fR" 4
 .IX Item "-fse=string,  --format-skipping-end=string"
 The \fB\-fsb=string\fR is the corresponding parameter used to change the
 ending marker for format skipping.  The default is equivalent to
-\&\-fse='#<<<'.  
-.Sh "Line Break Control"
+\&\-fse='#<<<'.
+.SS "Line Break Control"
 .IX Subsection "Line Break Control"
+The parameters in this section control breaks after
+non-blank lines of code.  Blank lines are controlled
+separately by parameters in the section \*(L"Blank Line
+Control\*(R".
 .IP "\fB\-fnl\fR,  \fB\-\-freeze\-newlines\fR" 4
 .IX Item "-fnl,  --freeze-newlines"
-If you do not want any changes to the line breaks in your script, set
+If you do not want any changes to the line breaks within
+lines of code in your script, set
 \&\fB\-fnl\fR, and they will remain fixed, and the rest of the commands in
 this section and sections 
 \&\*(L"Controlling List Formatting\*(R",
-\&\*(L"Retaining or Ignoring Existing Line Breaks\*(R", and
-\&\*(L"Blank Line Control\*(R" will be ignored.  You may want to use \fB\-noll\fR
-with this.
+\&\*(L"Retaining or Ignoring Existing Line Breaks\*(R". 
+You may want to use \fB\-noll\fR with this.
+.Sp
+Note: If you also want to keep your blank lines exactly
+as they are, you can use the \fB\-fbl\fR flag which is described
+in the section \*(L"Blank Line Control\*(R".
 .IP "\fB\-ce\fR,   \fB\-\-cuddled\-else\fR" 4
 .IX Item "-ce,   --cuddled-else"
 Enable the \*(L"cuddled else\*(R" style, in which \f(CW\*(C`else\*(C'\fR and \f(CW\*(C`elsif\*(C'\fR are
@@ -1380,9 +1434,7 @@ alternatives:
 \&  } else {    # \-ce
 \&      zzz();
 \&  }
-.Ve
-.Sp
-.Vb 6
+\&
 \&  if ($task) {
 \&        yyy();
 \&  }
@@ -1395,25 +1447,25 @@ alternatives:
 Use the flag \fB\-bl\fR to place the opening brace on a new line:
 .Sp
 .Vb 4
-\&  if ( $input_file eq '\-' )    # \-bl 
+\&  if ( $input_file eq \*(Aq\-\*(Aq )    # \-bl 
 \&  {                          
 \&      important_function();
 \&  }
 .Ve
 .Sp
-This flag applies to all structural blocks, including sub's (unless
+This flag applies to all structural blocks, including named sub's (unless
 the \fB\-sbl\fR flag is set \*(-- see next item).
 .Sp
 The default style, \fB\-nbl\fR, places an opening brace on the same line as
 the keyword introducing it.  For example,
 .Sp
 .Vb 1
-\&  if ( $input_file eq '\-' ) {   # \-nbl (default)
+\&  if ( $input_file eq \*(Aq\-\*(Aq ) {   # \-nbl (default)
 .Ve
 .IP "\fB\-sbl\fR,    \fB\-\-opening\-sub\-brace\-on\-new\-line\fR" 4
 .IX Item "-sbl,    --opening-sub-brace-on-new-line"
 The flag \fB\-sbl\fR can be used to override the value of \fB\-bl\fR for
-opening sub braces.  For example, 
+the opening braces of named sub's.  For example,
 .Sp
 .Vb 1
 \& perltidy \-sbl
@@ -1435,6 +1487,30 @@ produces this result:
 .Sp
 This flag is negated with \fB\-nsbl\fR.  If \fB\-sbl\fR is not specified,
 the value of \fB\-bl\fR is used.
+.IP "\fB\-asbl\fR,    \fB\-\-opening\-anonymous\-sub\-brace\-on\-new\-line\fR" 4
+.IX Item "-asbl,    --opening-anonymous-sub-brace-on-new-line"
+The flag \fB\-asbl\fR is like the \fB\-sbl\fR flag except that it applies
+to anonymous sub's instead of named subs. For example
+.Sp
+.Vb 1
+\& perltidy \-asbl
+.Ve
+.Sp
+produces this result:
+.Sp
+.Vb 9
+\& $a = sub
+\& {
+\&     if ( !defined( $_[0] ) ) {
+\&         print("Hello, World\en");
+\&     }
+\&     else {
+\&         print( $_[0], "\en" );
+\&     }
+\& };
+.Ve
+.Sp
+This flag is negated with \fB\-nasbl\fR, and the default is \fB\-nasbl\fR.
 .IP "\fB\-bli\fR,    \fB\-\-brace\-left\-and\-indent\fR" 4
 .IX Item "-bli,    --brace-left-and-indent"
 The flag \fB\-bli\fR is the same as \fB\-bl\fR but in addition it causes one 
@@ -1444,7 +1520,7 @@ an opening and closing block braces.
 For example,
 .Sp
 .Vb 4
-\&        if ( $input_file eq '\-' )    # \-bli
+\&        if ( $input_file eq \*(Aq\-\*(Aq )    # \-bli
 \&          {
 \&            important_function();
 \&          }
@@ -1496,9 +1572,7 @@ comma and an opening token.  For example:
 \&        accno       => $ref\->{accno},
 \&        description => $ref\->{description}
 \&      };
-.Ve
-.Sp
-.Vb 5
+\&
 \&    # perltidy \-otr
 \&    push @{ $self\->{$module}{$key} }, {
 \&        accno       => $ref\->{accno},
@@ -1520,7 +1594,7 @@ separately if desired:
 These parameters control what shall be called vertical tightness.  Here are the
 main points:
 .RS 4
-.IP "*" 4
+.IP "\(bu" 4
 Opening tokens (except for block braces) are controlled by \fB\-vt=n\fR, or
 \&\fB\-\-vertical\-tightness=n\fR, where
 .Sp
@@ -1530,10 +1604,10 @@ Opening tokens (except for block braces) are controlled by \fB\-vt=n\fR, or
 \&         step in indentation in a line.
 \& \-vt=2 never break a line after opening token
 .Ve
-.IP "*" 4
+.IP "\(bu" 4
 You must also use the \fB\-lp\fR flag when you use the \fB\-vt\fR flag; the
 reason is explained below.
-.IP "*" 4
+.IP "\(bu" 4
 Closing tokens (except for block braces) are controlled by \fB\-vtc=n\fR, or
 \&\fB\-\-vertical\-tightness\-closing=n\fR, where
 .Sp
@@ -1547,10 +1621,10 @@ Closing tokens (except for block braces) are controlled by \fB\-vtc=n\fR, or
 .Sp
 The rules for \fB\-vtc=1\fR are designed to maintain a reasonable balance
 between tightness and readability in complex lists.
-.IP "*" 4
+.IP "\(bu" 4
 Different controls may be applied to to different token types,
 and it is also possible to control block braces; see below.
-.IP "*" 4
+.IP "\(bu" 4
 Finally, please note that these vertical tightness flags are merely
 hints to the formatter, and it cannot always follow them.  Things which
 make it difficult or impossible include comments, blank lines, blocks of
@@ -1560,33 +1634,29 @@ length).
 .RE
 .RS 4
 .Sp
-Here are some examples: 
+Here are some examples:
 .Sp
 .Vb 7
 \&    # perltidy \-lp \-vt=0 \-vtc=0
 \&    %romanNumerals = (
-\&                       one   => 'I',
-\&                       two   => 'II',
-\&                       three => 'III',
-\&                       four  => 'IV',
+\&                       one   => \*(AqI\*(Aq,
+\&                       two   => \*(AqII\*(Aq,
+\&                       three => \*(AqIII\*(Aq,
+\&                       four  => \*(AqIV\*(Aq,
 \&    );
-.Ve
-.Sp
-.Vb 6
+\&
 \&    # perltidy \-lp \-vt=1 \-vtc=0
-\&    %romanNumerals = ( one   => 'I',
-\&                       two   => 'II',
-\&                       three => 'III',
-\&                       four  => 'IV',
+\&    %romanNumerals = ( one   => \*(AqI\*(Aq,
+\&                       two   => \*(AqII\*(Aq,
+\&                       three => \*(AqIII\*(Aq,
+\&                       four  => \*(AqIV\*(Aq,
 \&    );
-.Ve
-.Sp
-.Vb 5
+\&
 \&    # perltidy \-lp \-vt=1 \-vtc=1
-\&    %romanNumerals = ( one   => 'I',
-\&                       two   => 'II',
-\&                       three => 'III',
-\&                       four  => 'IV', );
+\&    %romanNumerals = ( one   => \*(AqI\*(Aq,
+\&                       two   => \*(AqII\*(Aq,
+\&                       three => \*(AqIII\*(Aq,
+\&                       four  => \*(AqIV\*(Aq, );
 .Ve
 .Sp
 The difference between \fB\-vt=1\fR and \fB\-vt=2\fR is shown here:
@@ -1598,9 +1668,7 @@ The difference between \fB\-vt=1\fR and \fB\-vt=2\fR is shown here:
 \&                           cstring( $threadsv_names[ $op\->targ ] )
 \&                )
 \&    );
-.Ve
-.Sp
-.Vb 5
+\&
 \&    # perltidy \-lp \-vt=2 
 \&    $init\->add( mysprintf( "(void)find_threadsv(%s);",
 \&                           cstring( $threadsv_names[ $op\->targ ] )
@@ -1677,9 +1745,7 @@ subsequent line.  For example:
 \&          }
 \&        close(FILE);
 \&      }
-.Ve
-.Sp
-.Vb 8
+\&
 \&    # perltidy \-bli \-bbvt=1
 \&    if ( open( FILE, "< $File" ) )
 \&      { while ( $File = <FILE> )
@@ -1700,7 +1766,7 @@ possible values of this string, see \*(L"Specifying Block Types\*(R"
 .Sp
 For example, if we want to just apply this style to \f(CW\*(C`if\*(C'\fR,
 \&\f(CW\*(C`elsif\*(C'\fR, and \f(CW\*(C`else\*(C'\fR blocks, we could use 
-\&\f(CW\*(C`perltidy \-bli \-bbvt=1 \-bbvtl='if elsif else'\*(C'\fR.
+\&\f(CW\*(C`perltidy \-bli \-bbvt=1 \-bbvtl=\*(Aqif elsif else\*(Aq\*(C'\fR.
 .Sp
 There is no vertical tightness control for closing block braces; with
 the exception of one-line blocks, they will normally remain on a 
@@ -1721,9 +1787,7 @@ For example:
 \&            always_quote => 1,
 \&        }
 \&    );
-.Ve
-.Sp
-.Vb 7
+\&
 \&    # \-sot
 \&    $opt_c = Text::CSV_XS\->new( {
 \&            binary       => 1,
@@ -1759,9 +1823,7 @@ For example:
 \&            always_quote => 1,
 \&        }
 \&    );
-.Ve
-.Sp
-.Vb 7
+\&
 \&    # \-sct
 \&    $opt_c = Text::CSV_XS\->new(
 \&        {
@@ -1802,12 +1864,12 @@ The flag \fB\-sct\fR is a synonym for \fB\-scp \-schb \-scsb\fR.
 By default, perltidy first deletes all old line break locations, and then it
 looks for good break points to match the desired line length.  Use \fB\-ndnl\fR
 or  \fB\-\-nodelete\-old\-newlines\fR to force perltidy to retain all old line break
-points.  
+points.
 .IP "\fB\-anl\fR,  \fB\-\-add\-newlines\fR" 4
 .IX Item "-anl,  --add-newlines"
 By default, perltidy will add line breaks when necessary to create
 continuations of long lines and to improve the script appearance.  Use
-\&\fB\-nanl\fR or \fB\-\-noadd\-newlines\fR to prevent any new line breaks.  
+\&\fB\-nanl\fR or \fB\-\-noadd\-newlines\fR to prevent any new line breaks.
 .Sp
 This flag does not prevent perltidy from eliminating existing line
 breaks; see \fB\-\-freeze\-newlines\fR to completely prevent changes to line
@@ -1835,7 +1897,7 @@ By default, perltidy breaks \fBafter\fR these token types:
 And perltidy breaks \fBbefore\fR these token types by default:
   . << >> \-> && || //
 .Sp
-To illustrate, to cause a break after a concatenation operator, \f(CW'.'\fR,
+To illustrate, to cause a break after a concatenation operator, \f(CW\*(Aq.\*(Aq\fR,
 rather than before it, the command line would be
 .Sp
 .Vb 1
@@ -1843,7 +1905,7 @@ rather than before it, the command line would be
 .Ve
 .Sp
 As another example, the following command would cause a break before 
-math operators \f(CW'+'\fR, \f(CW'\-'\fR, \f(CW'/'\fR, and \f(CW'*'\fR:
+math operators \f(CW\*(Aq+\*(Aq\fR, \f(CW\*(Aq\-\*(Aq\fR, \f(CW\*(Aq/\*(Aq\fR, and \f(CW\*(Aq*\*(Aq\fR:
 .Sp
 .Vb 1
 \&  \-wbb="+ \- / *"
@@ -1879,7 +1941,7 @@ These can be used to define an initial break preference which can be fine-tuned
 with the \fB\-wba\fR and \fB\-wbb\fR flags.  For example, to break before all operators
 except an \fB=\fR one could use \-\-bbao \-wba='=' rather than listing every
 single perl operator except \fB=\fR on a \-wbb flag.
-.Sh "Controlling List Formatting"
+.SS "Controlling List Formatting"
 .IX Subsection "Controlling List Formatting"
 Perltidy attempts to place comma-separated arrays of values in tables
 which look good.  Its default algorithms usually work well, and they
@@ -1936,12 +1998,12 @@ of perltidy.
 .Vb 9
 \&    # perltidy \-mft=2
 \&    @month_of_year = (    
-\&        'Jan', 'Feb',
-\&        'Mar', 'Apr',
-\&        'May', 'Jun',
-\&        'Jul', 'Aug',
-\&        'Sep', 'Oct',
-\&        'Nov', 'Dec'
+\&        \*(AqJan\*(Aq, \*(AqFeb\*(Aq,
+\&        \*(AqMar\*(Aq, \*(AqApr\*(Aq,
+\&        \*(AqMay\*(Aq, \*(AqJun\*(Aq,
+\&        \*(AqJul\*(Aq, \*(AqAug\*(Aq,
+\&        \*(AqSep\*(Aq, \*(AqOct\*(Aq,
+\&        \*(AqNov\*(Aq, \*(AqDec\*(Aq
 \&    );
 .Ve
 .IP "\fB\-cab=n\fR,  \fB\-\-comma\-arrow\-breakpoints=n\fR" 4
@@ -1998,7 +2060,7 @@ Here is an example.
 \&        "09" => 30, "10" => 31, "11" => 30, "12" => 31
 \&    );
 .Ve
-.Sh "Retaining or Ignoring Existing Line Breaks"
+.SS "Retaining or Ignoring Existing Line Breaks"
 .IX Subsection "Retaining or Ignoring Existing Line Breaks"
 Several additional parameters are available for controlling the extent
 to which line breaks in the input script influence the output script.
@@ -2068,11 +2130,17 @@ With \fBperltidy \-kis\fR the multiple statements are retained:
 The statements are still subject to the specified value
 of \fBmaximum-line-length\fR and will be broken if this 
 maximum is exceeed.
-.Sh "Blank Line Control"
+.SS "Blank Line Control"
 .IX Subsection "Blank Line Control"
 Blank lines can improve the readability of a script if they are carefully
 placed.  Perltidy has several commands for controlling the insertion,
 retention, and removal of blank lines.
+.IP "\fB\-fbl\fR,  \fB\-\-freeze\-blank\-lines\fR" 4
+.IX Item "-fbl,  --freeze-blank-lines"
+Set \fB\-fbl\fR if you want to the blank lines in your script to
+remain exactly as they are.  The rest of the parameters in
+this section may then be ignored.  (Note: setting the \fB\-fbl\fR flag
+is equivalent to setting \fB\-mbl=0\fR and \fB\-kbl=2\fR).
 .IP "\fB\-bbc\fR,  \fB\-\-blanks\-before\-comments\fR" 4
 .IX Item "-bbc,  --blanks-before-comments"
 A blank line will be introduced before a full-line comment.  This is the
@@ -2085,18 +2153,18 @@ one-liner or preceded by a comment.  A blank line will also be introduced
 before a \fBpackage\fR statement and a \fB\s-1BEGIN\s0\fR and \fB\s-1END\s0\fR block.  This is the
 default.  The intention is to help display the structure of a program by
 setting off certain key sections of code.  This is negated with \fB\-nbbs\fR or
-\&\fB\-\-noblanks\-before\-subs\fR.  
+\&\fB\-\-noblanks\-before\-subs\fR.
 .IP "\fB\-bbb\fR,  \fB\-\-blanks\-before\-blocks\fR" 4
 .IX Item "-bbb,  --blanks-before-blocks"
 A blank line will be introduced before blocks of coding delimited by
 \&\fBfor\fR, \fBforeach\fR, \fBwhile\fR, \fBuntil\fR, and \fBif\fR, \fBunless\fR, in the following
 circumstances:
 .RS 4
-.IP "*" 4
+.IP "\(bu" 4
 The block is not preceded by a comment.
-.IP "*" 4
+.IP "\(bu" 4
 The block is not a one-line block.
-.IP "*" 4
+.IP "\(bu" 4
 The number of consecutive non-blank lines at the current indentation depth is at least \fB\-lbl\fR
 (see next section).
 .RE
@@ -2113,22 +2181,39 @@ certain block types (see previous section).  The default is 8.  Entering
 a value of \fB0\fR is equivalent to entering a very large number.
 .IP "\fB\-mbl=n\fR \fB\-\-maximum\-consecutive\-blank\-lines=n\fR" 4
 .IX Item "-mbl=n --maximum-consecutive-blank-lines=n"
-This parameter specifies the maximum number of consecutive blank lines
-in the output script.  The default is n=1.  If the input file has more
-than n consecutive blank lines, the number will be reduced to n.
-(This obviously does not apply to pod sections, here\-documents, and quotes).
+This parameter specifies the maximum number of consecutive
+blank lines which will be output within code sections of a
+script.  The default is n=1.  If the input file has more
+than n consecutive blank lines, the number will be reduced
+to n.  If \fBn=0\fR then no blank lines will be output (unless
+all old blank lines are retained with the \fB\-kbl=2\fR flag of
+the next section).
+.Sp
+This flag obviously does not apply to pod sections,
+here-documents, and quotes.
+.IP "\fB\-kbl=n\fR,  \fB\-\-keep\-old\-blank\-lines=n\fR" 4
+.IX Item "-kbl=n,  --keep-old-blank-lines=n"
+The \fB\-kbl=n\fR flag gives you control over how your existing blank lines are
+treated.
+.Sp
+The possible values of \fBn\fR are:
+.Sp
+.Vb 3
+\& n=0 ignore all old blank lines
+\& n=1 stable: keep old blanks, but limited by the value of the B<\-mbl=n> flag
+\& n=2 keep all old blank lines, regardless of the value of the B<\-mbl=n> flag
+.Ve
+.Sp
+The default is \fBn=1\fR.
 .IP "\fB\-sob\fR,  \fB\-\-swallow\-optional\-blank\-lines\fR" 4
 .IX Item "-sob,  --swallow-optional-blank-lines"
-All blank lines not required by the above flags, \fB\-bbb\fR, \fB\-bbs\fR, and \fB\-bbc\fR,
-will be deleted.  (But essential blank lines above pod documents will be
-retained).  This is \s-1NOT\s0 the default.
+This is equivalent to \fBkbl=0\fR and is included for compatability with
+previous versions.
 .IP "\fB\-nsob\fR,  \fB\-\-noswallow\-optional\-blank\-lines\fR" 4
 .IX Item "-nsob,  --noswallow-optional-blank-lines"
-Retain blank lines, including those which do not corresponding to flags
-\&\fB\-bbb\fR, \fB\-bbs\fR, and \fB\-bbc\fR.  This is the default.  The number of
-blanks retained is subject to the limit imposed by
-\&\fB\-\-maximum\-consecutive\-blank\-lines\fR, however.
-.Sh "Styles"
+This is equivalent to \fBkbl=1\fR and is included for compatability with
+previous versions.
+.SS "Styles"
 .IX Subsection "Styles"
 A style refers to a convenient collection of existing parameters.
 .IP "\fB\-gnu\fR, \fB\-\-gnu\-style\fR" 4
@@ -2153,7 +2238,7 @@ by Damian Conway:
 .Sp
 Note that the \-st and \-se flags make perltidy act as a filter on one file only.  
 These can be overridden with \-nst and \-nse if necessary.
-.Sh "Other Controls"
+.SS "Other Controls"
 .IX Subsection "Other Controls"
 .IP "Deleting selected text" 4
 .IX Item "Deleting selected text"
@@ -2177,7 +2262,7 @@ hash-bang will be retained (even if they are in the form of comments).
 .IX Item "Writing selected text to a file"
 When perltidy writes a formatted text file, it has the ability to also
 send selected text to a file with a \fI.TEE\fR extension.  This text can
-include comments and pod documentation.  
+include comments and pod documentation.
 .Sp
 The command \fB\-tac\fR or  \fB\-\-tee\-all\-comments\fR will write all comments
 \&\fBand\fR all pod documentation.
@@ -2189,16 +2274,16 @@ The commands which write comments (but not pod) are: \fB\-tbc\fR or
 \&\fB\-\-tee\-block\-comments\fR and \fB\-tsc\fR or  \fB\-\-tee\-side\-comments\fR.
 (Hanging side comments will be written with block comments here.)
 .Sp
-The negatives of these commands also work, and are the defaults.  
+The negatives of these commands also work, and are the defaults.
 .IP "Using a \fI.perltidyrc\fR command file" 4
 .IX Item "Using a .perltidyrc command file"
 If you use perltidy frequently, you probably won't be happy until you
 create a \fI.perltidyrc\fR file to avoid typing commonly-used parameters.
 Perltidy will first look in your current directory for a command file
 named \fI.perltidyrc\fR.  If it does not find one, it will continue looking
-for one in other standard locations.  
+for one in other standard locations.
 .Sp
-These other locations are system\-dependent, and may be displayed with
+These other locations are system-dependent, and may be displayed with
 the command \f(CW\*(C`perltidy \-dpro\*(C'\fR.  Under Unix systems, it will first look
 for an environment variable \fB\s-1PERLTIDY\s0\fR.  Then it will look for a
 \&\fI.perltidyrc\fR file in the home directory, and then for a system-wide
@@ -2207,11 +2292,28 @@ file \fI/usr/local/etc/perltidyrc\fR, and then it will look for
 have a leading dot.  Further system-dependent information will be found
 in the \s-1INSTALL\s0 file distributed with perltidy.
 .Sp
-This file is free format, and simply a list of parameters, just as they
-would be entered on a command line.  Any number of lines may be used,
-with any number of parameters per line, although it may be easiest to
-read with one parameter per line.  Blank lines are ignored, and text
-after a '#' is ignored to the end of a line.
+Under Windows, perltidy will also search for a configuration file named perltidy.ini since Windows does not allow files with a leading period (.).
+Use \f(CW\*(C`perltidy \-dpro\*(C'\fR to see the possbile locations for your system.
+An example might be \fIC:\eDocuments and Settings\eAll Users\eperltidy.ini\fR.
+.Sp
+Another option is the use of the \s-1PERLTIDY\s0 environment variable.
+The method for setting environment variables depends upon the version of
+Windows that you are using.  Instructions for Windows 95 and later versions can
+be found here:
+.Sp
+http://www.netmanage.com/000/20021101_005_tcm21\-6336.pdf
+.Sp
+Under Windows \s-1NT\s0 / 2000 / \s-1XP\s0 the \s-1PERLTIDY\s0 environment variable can be placed in
+either the user section or the system section.  The later makes the
+configuration file common to all users on the machine.  Be sure to enter the
+full path of the configuration file in the value of the environment variable.
+Ex.  PERLTIDY=C:\eDocuments and Settings\eperltidy.ini
+.Sp
+The configuation file is free format, and simply a list of parameters, just as
+they would be entered on a command line.  Any number of lines may be used, with
+any number of parameters per line, although it may be easiest to read with one
+parameter per line.  Blank lines are ignored, and text after a '#' is ignored
+to the end of a line.
 .Sp
 Here is an example of a \fI.perltidyrc\fR file:
 .Sp
@@ -2227,7 +2329,7 @@ Here is an example of a \fI.perltidyrc\fR file:
 .Ve
 .Sp
 The parameters in the \fI.perltidyrc\fR file are installed first, so any
-parameters given on the command line will have priority over them.  
+parameters given on the command line will have priority over them.
 .Sp
 To avoid confusion, perltidy ignores any command in the .perltidyrc
 file which would cause some kind of dump and an exit.  These are:
@@ -2237,26 +2339,26 @@ file which would cause some kind of dump and an exit.  These are:
 .Ve
 .Sp
 There are several options may be helpful in debugging a \fI.perltidyrc\fR
-file:  
+file:
 .RS 4
-.IP "*" 4
+.IP "\(bu" 4
 A very helpful command is \fB\-\-dump\-profile\fR or \fB\-dpro\fR.  It writes a
 list of all configuration filenames tested to standard output, and 
 if a file is found, it dumps the content to standard output before
 exiting.  So, to find out where perltidy looks for its configuration
-files, and which one if any it selects, just enter 
+files, and which one if any it selects, just enter
 .Sp
 .Vb 1
 \&  perltidy \-dpro
 .Ve
-.IP "*" 4
+.IP "\(bu" 4
 It may be simplest to develop and test configuration files with
 alternative names, and invoke them with \fB\-pro=filename\fR on the command
 line.  Then rename the desired file to \fI.perltidyrc\fR when finished.
-.IP "*" 4
+.IP "\(bu" 4
 The parameters in the \fI.perltidyrc\fR file can be switched off with 
 the \fB\-npro\fR option.
-.IP "*" 4
+.IP "\(bu" 4
 The commands \fB\-\-dump\-options\fR, \fB\-\-dump\-defaults\fR, \fB\-\-dump\-long\-names\fR,
 and \fB\-\-dump\-short\-names\fR, all described below, may all be helpful.
 .RE
@@ -2300,9 +2402,9 @@ could be placed in a \fI.perltidyrc\fR file, and then invoked at will with
 .IX Item "Skipping leading non-perl commands with -x or --look-for-hash-bang"
 If your script has leading lines of system commands or other text which
 are not valid perl code, and which are separated from the start of the
-perl code by a \*(L"hash\-bang\*(R" line, ( a line of the form \f(CW\*(C`#!...perl\*(C'\fR ),
+perl code by a \*(L"hash-bang\*(R" line, ( a line of the form \f(CW\*(C`#!...perl\*(C'\fR ),
 you must use the \fB\-x\fR flag to tell perltidy not to parse and format any
-lines before the \*(L"hash\-bang\*(R" line.  This option also invokes perl with a
+lines before the \*(L"hash-bang\*(R" line.  This option also invokes perl with a
 \&\-x flag when checking the syntax.  This option was originally added to
 allow perltidy to parse interactive \s-1VMS\s0 scripts, but it should be used
 for any script which is normally invoked with \f(CW\*(C`perl \-x\*(C'\fR.
@@ -2354,7 +2456,7 @@ one-line block style of the input file.
 If an existing one-line block is longer than the maximum line length,
 however, it will be broken into multiple lines.  When this happens, perltidy
 checks for and adds any optional terminating semicolon (unless the \fB\-nasc\fR
-option is used) if the block is a code block.  
+option is used) if the block is a code block.
 .Sp
 The main exception is that perltidy will attempt to form new one-line
 blocks following the keywords \f(CW\*(C`map\*(C'\fR, \f(CW\*(C`eval\*(C'\fR, and \f(CW\*(C`sort\*(C'\fR, because
@@ -2379,7 +2481,7 @@ The following flags are available for debugging:
 configuration file and its contents to standard output and quit.
 .Sp
 \&\fB\-\-dump\-options\fR or \fB\-dop\fR  will write current option set to standard
-output and quit.  
+output and quit.
 .Sp
 \&\fB\-\-dump\-long\-names\fR or \fB\-dln\fR  will write all command line long names (passed 
 to Get_options) to standard output and quit.
@@ -2439,7 +2541,7 @@ which may be viewed with a browser.
 \&\fBPlease Note\fR: In this case, perltidy does not do any formatting to the
 input file, and it does not write a formatted file with extension
 \&\fI.tdy\fR.  This means that two perltidy runs are required to create a
-fully reformatted, html copy of a script.  
+fully reformatted, html copy of a script.
 .IP "The \fB\-pre\fR flag for code snippets" 4
 .IX Item "The -pre flag for code snippets"
 When the \fB\-pre\fR flag is given, only the pre-formatted section, within
@@ -2572,7 +2674,7 @@ the long form, \fB\-html\-color\-xxxxxx=n\fR, or more conveniently the short for
 \&\fB\-hcx=n\fR, where \fBxxxxxx\fR is one of the following words, and \fBx\fR is the
 corresponding abbreviation:
 .Sp
-.Vb 19
+.Vb 10
 \&      Token Type             xxxxxx           x 
 \&      \-\-\-\-\-\-\-\-\-\-             \-\-\-\-\-\-\-\-         \-\-
 \&      comment                comment          c
@@ -2614,7 +2716,7 @@ and this should be equivalent for most browsers:
 Perltidy merely writes any non-hex names that it sees in the html file.
 The following 16 color names are defined in the \s-1HTML\s0 3.2 standard:
 .Sp
-.Vb 16
+.Vb 10
 \&        black   => 000000,
 \&        silver  => c0c0c0,
 \&        gray    => 808080,
@@ -2635,7 +2737,7 @@ The following 16 color names are defined in the \s-1HTML\s0 3.2 standard:
 .Sp
 Many more names are supported in specific browsers, but it is safest
 to use the hex codes for other colors.  Helpful color tables can be
-located with an internet search for \*(L"\s-1HTML\s0 color tables\*(R". 
+located with an internet search for \*(L"\s-1HTML\s0 color tables\*(R".
 .Sp
 Besides color, two other character attributes may be set: bold, and italics.
 To set a token type to use bold, use the flag
@@ -2648,7 +2750,7 @@ Likewise, to set a token type to use an italic font, use the flag
 long or short names from the above table.  And to set a token type to
 \&\s-1NOT\s0 use italics, use \fB\-\-nohtml\-italic\-xxxxxx\fR or \fB\-nhix\fR.
 .Sp
-For example, to use bold braces and lime color, non\-bold, italics keywords the
+For example, to use bold braces and lime color, non-bold, italics keywords the
 following command would be used:
 .Sp
 .Vb 1
@@ -2674,7 +2776,7 @@ sheet contains comments which should make this easy.
 split large files into smaller pieces to improve download times.
 .SH "SOME COMMON INPUT CONVENTIONS"
 .IX Header "SOME COMMON INPUT CONVENTIONS"
-.Sh "Specifying Block Types"
+.SS "Specifying Block Types"
 .IX Subsection "Specifying Block Types"
 Several parameters which refer to code block types may be customized by also
 specifying an associated list of block types.  The type of a block is the name
@@ -2692,7 +2794,7 @@ For example, the following parameter specifies \f(CW\*(C`sub\*(C'\fR, labels, \f
 (the meaning of the \-cscl parameter is described above.)  Note that
 quotes are required around the list of block types because of the
 spaces.
-.Sh "Specifying File Extensions"
+.SS "Specifying File Extensions"
 .IX Subsection "Specifying File Extensions"
 Several parameters allow default file extensions to be overridden.  For
 example, a backup file extension may be specified with \fB\-bext=ext\fR,
@@ -2701,12 +2803,12 @@ flexibility, the following convention is used in all cases to decide if
 a leading '.' should be used.  If the extension \f(CW\*(C`ext\*(C'\fR begins with
 \&\f(CW\*(C`A\-Z\*(C'\fR, \f(CW\*(C`a\-z\*(C'\fR, or \f(CW\*(C`0\-9\*(C'\fR, then it will be appended to the filename with
 an intermediate '.' (or perhaps an '_' on \s-1VMS\s0 systems).  Otherwise, it
-will be appended directly.  
+will be appended directly.
 .PP
 For example, suppose the file is \fIsomefile.pl\fR.  For \f(CW\*(C`\-bext=old\*(C'\fR, a '.' is
 added to give \fIsomefile.pl.old\fR.  For \f(CW\*(C`\-bext=.old\*(C'\fR, no additional '.' is
 added, so again the backup file is \fIsomefile.pl.old\fR.  For \f(CW\*(C`\-bext=~\*(C'\fR, then no
-dot is added, and the backup file will be \fIsomefile.pl~\fR  .  
+dot is added, and the backup file will be \fIsomefile.pl~\fR  .
 .SH "SWITCHES WHICH MAY BE NEGATED"
 .IX Header "SWITCHES WHICH MAY BE NEGATED"
 The following list shows all short parameter names which allow a prefix
@@ -2728,7 +2830,7 @@ used.
 .IP "Parsing Limitations" 4
 .IX Item "Parsing Limitations"
 Perltidy should work properly on most perl scripts.  It does a lot of
-self\-checking, but still, it is possible that an error could be
+self-checking, but still, it is possible that an error could be
 introduced and go undetected.  Therefore, it is essential to make
 careful backups and to test reformatted scripts.
 .Sp
@@ -2758,7 +2860,7 @@ created in the current working directory.
 .IX Item "Special files when standard input is used"
 When standard input is used, the log file, if saved, is \fIperltidy.LOG\fR,
 and any errors are written to \fIperltidy.ERR\fR unless the \fB\-se\fR flag is
-set.  These are saved in the current working directory.  
+set.  These are saved in the current working directory.
 .IP "Files overwritten" 4
 .IX Item "Files overwritten"
 The following file extensions are used by perltidy, and files with these
@@ -2777,18 +2879,18 @@ purpose of this rule is to prevent generating confusing filenames such as
 \&\fIperlstyle\fR\|(1), \fIPerl::Tidy\fR\|(3)
 .SH "VERSION"
 .IX Header "VERSION"
-This man page documents perltidy version 20071205.
+This man page documents perltidy version 20090616.
 .SH "CREDITS"
 .IX Header "CREDITS"
 Michael Cartmell supplied code for adaptation to \s-1VMS\s0 and helped with
 v\-strings.
 .PP
 Yves Orton supplied code for adaptation to the various versions
-of Windows. 
+of Windows.
 .PP
 Axel Rose supplied a patch for MacPerl.
 .PP
-Hugh S. Myers designed and implemented the initial Perl::Tidy module interface. 
+Hugh S. Myers designed and implemented the initial Perl::Tidy module interface.
 .PP
 Many others have supplied key ideas, suggestions, and bug reports;
 see the \s-1CHANGES\s0 file.
@@ -2801,7 +2903,7 @@ see the \s-1CHANGES\s0 file.
 .Ve
 .SH "COPYRIGHT"
 .IX Header "COPYRIGHT"
-Copyright (c) 2000\-2006 by Steve Hancock
+Copyright (c) 2000\-2008 by Steve Hancock
 .SH "LICENSE"
 .IX Header "LICENSE"
 This package is free software; you can redistribute it and/or modify it
index 9a7e5813aca0f951121517208206533dc2476702..c190f80f4246262eec5afda75cbe9ab7ef67e5bc 100644 (file)
@@ -2,7 +2,7 @@
 #
 #    perltidy - a perl script indenter and formatter
 #
-#    Copyright (c) 2000-2007 by Steve Hancock
+#    Copyright (c) 2000-2009 by Steve Hancock
 #    Distributed under the GPL license agreement; see file COPYING
 #
 #    This program is free software; you can redistribute it and/or modify
@@ -65,7 +65,7 @@ use IO::File;
 use File::Basename;
 
 BEGIN {
-    ( $VERSION = q($Id: Tidy.pm,v 1.73 2007/12/05 17:51:17 perltidy Exp $) ) =~ s/^.*\s+(\d+)\/(\d+)\/(\d+).*$/$1$2$3/; # all one line for MakeMaker
+    ( $VERSION = q($Id: Tidy.pm,v 1.74 2009/06/16 13:56:49 perltidy Exp $) ) =~ s/^.*\s+(\d+)\/(\d+)\/(\d+).*$/$1$2$3/; # all one line for MakeMaker
 }
 
 sub streamhandle {
@@ -693,7 +693,7 @@ EOM
                         if ( $input_file =~ /^\'(.+)\'$/ ) { $input_file = $1 }
                         if ( $input_file =~ /^\"(.+)\"$/ ) { $input_file = $1 }
                         my $pattern = fileglob_to_re($input_file);
-                        eval "/$pattern/";
+                        ##eval "/$pattern/";
                         if ( !$@ && opendir( DIR, './' ) ) {
                             my @files =
                               grep { /$pattern/ && !-d $_ } readdir(DIR);
@@ -1307,6 +1307,7 @@ sub generate_options {
     $add_option->( 'closing-side-comment-prefix',       'cscp', '=s' );
     $add_option->( 'closing-side-comment-warnings',     'cscw', '!' );
     $add_option->( 'closing-side-comments',             'csc',  '!' );
+    $add_option->( 'closing-side-comments-balanced',    'cscb', '!' );
     $add_option->( 'format-skipping',                   'fs',   '!' );
     $add_option->( 'format-skipping-begin',             'fsb',  '=s' );
     $add_option->( 'format-skipping-end',               'fse',  '=s' );
@@ -1325,34 +1326,35 @@ sub generate_options {
     ########################################
     $category = 5;    # Linebreak controls
     ########################################
-    $add_option->( 'add-newlines',                        'anl',   '!' );
-    $add_option->( 'block-brace-vertical-tightness',      'bbvt',  '=i' );
-    $add_option->( 'block-brace-vertical-tightness-list', 'bbvtl', '=s' );
-    $add_option->( 'brace-vertical-tightness',            'bvt',   '=i' );
-    $add_option->( 'brace-vertical-tightness-closing',    'bvtc',  '=i' );
-    $add_option->( 'cuddled-else',                        'ce',    '!' );
-    $add_option->( 'delete-old-newlines',                 'dnl',   '!' );
-    $add_option->( 'opening-brace-always-on-right',       'bar',   '!' );
-    $add_option->( 'opening-brace-on-new-line',           'bl',    '!' );
-    $add_option->( 'opening-hash-brace-right',            'ohbr',  '!' );
-    $add_option->( 'opening-paren-right',                 'opr',   '!' );
-    $add_option->( 'opening-square-bracket-right',        'osbr',  '!' );
-    $add_option->( 'opening-sub-brace-on-new-line',       'sbl',   '!' );
-    $add_option->( 'paren-vertical-tightness',            'pvt',   '=i' );
-    $add_option->( 'paren-vertical-tightness-closing',    'pvtc',  '=i' );
-    $add_option->( 'stack-closing-hash-brace',            'schb',  '!' );
-    $add_option->( 'stack-closing-paren',                 'scp',   '!' );
-    $add_option->( 'stack-closing-square-bracket',        'scsb',  '!' );
-    $add_option->( 'stack-opening-hash-brace',            'sohb',  '!' );
-    $add_option->( 'stack-opening-paren',                 'sop',   '!' );
-    $add_option->( 'stack-opening-square-bracket',        'sosb',  '!' );
-    $add_option->( 'vertical-tightness',                  'vt',    '=i' );
-    $add_option->( 'vertical-tightness-closing',          'vtc',   '=i' );
-    $add_option->( 'want-break-after',                    'wba',   '=s' );
-    $add_option->( 'want-break-before',                   'wbb',   '=s' );
-    $add_option->( 'break-after-all-operators',           'baao',  '!' );
-    $add_option->( 'break-before-all-operators',          'bbao',  '!' );
-    $add_option->( 'keep-interior-semicolons',            'kis',   '!' );
+    $add_option->( 'add-newlines',                            'anl',   '!' );
+    $add_option->( 'block-brace-vertical-tightness',          'bbvt',  '=i' );
+    $add_option->( 'block-brace-vertical-tightness-list',     'bbvtl', '=s' );
+    $add_option->( 'brace-vertical-tightness',                'bvt',   '=i' );
+    $add_option->( 'brace-vertical-tightness-closing',        'bvtc',  '=i' );
+    $add_option->( 'cuddled-else',                            'ce',    '!' );
+    $add_option->( 'delete-old-newlines',                     'dnl',   '!' );
+    $add_option->( 'opening-brace-always-on-right',           'bar',   '!' );
+    $add_option->( 'opening-brace-on-new-line',               'bl',    '!' );
+    $add_option->( 'opening-hash-brace-right',                'ohbr',  '!' );
+    $add_option->( 'opening-paren-right',                     'opr',   '!' );
+    $add_option->( 'opening-square-bracket-right',            'osbr',  '!' );
+    $add_option->( 'opening-anonymous-sub-brace-on-new-line', 'asbl',  '!' );
+    $add_option->( 'opening-sub-brace-on-new-line',           'sbl',   '!' );
+    $add_option->( 'paren-vertical-tightness',                'pvt',   '=i' );
+    $add_option->( 'paren-vertical-tightness-closing',        'pvtc',  '=i' );
+    $add_option->( 'stack-closing-hash-brace',                'schb',  '!' );
+    $add_option->( 'stack-closing-paren',                     'scp',   '!' );
+    $add_option->( 'stack-closing-square-bracket',            'scsb',  '!' );
+    $add_option->( 'stack-opening-hash-brace',                'sohb',  '!' );
+    $add_option->( 'stack-opening-paren',                     'sop',   '!' );
+    $add_option->( 'stack-opening-square-bracket',            'sosb',  '!' );
+    $add_option->( 'vertical-tightness',                      'vt',    '=i' );
+    $add_option->( 'vertical-tightness-closing',              'vtc',   '=i' );
+    $add_option->( 'want-break-after',                        'wba',   '=s' );
+    $add_option->( 'want-break-before',                       'wbb',   '=s' );
+    $add_option->( 'break-after-all-operators',               'baao',  '!' );
+    $add_option->( 'break-before-all-operators',              'bbao',  '!' );
+    $add_option->( 'keep-interior-semicolons',                'kis',   '!' );
 
     ########################################
     $category = 6;    # Controlling list formatting
@@ -1377,7 +1379,7 @@ sub generate_options {
     $add_option->( 'blanks-before-subs',              'bbs', '!' );
     $add_option->( 'long-block-line-count',           'lbl', '=i' );
     $add_option->( 'maximum-consecutive-blank-lines', 'mbl', '=i' );
-    $add_option->( 'swallow-optional-blank-lines',    'sob', '!' );
+    $add_option->( 'keep-old-blank-lines',            'kbl', '=i' );
 
     ########################################
     $category = 9;    # Other controls
@@ -1508,6 +1510,7 @@ sub generate_options {
       closing-side-comment-interval=6
       closing-side-comment-maximum-text=20
       closing-side-comment-else-flag=0
+      closing-side-comments-balanced
       closing-paren-indentation=0
       closing-brace-indentation=0
       closing-square-bracket-indentation=0
@@ -1518,6 +1521,7 @@ sub generate_options {
       hanging-side-comments
       indent-block-comments
       indent-columns=4
+      keep-old-blank-lines=1
       long-block-line-count=8
       look-for-autoloader
       look-for-selfloader
@@ -1533,7 +1537,6 @@ sub generate_options {
       noquiet
       noshow-options
       nostatic-side-comments
-      noswallow-optional-blank-lines
       notabs
       nowarning-output
       outdent-labels
@@ -1569,10 +1572,13 @@ sub generate_options {
     #---------------------------------------------------------------
     %expansion = (
         %expansion,
-        'freeze-newlines'    => [qw(noadd-newlines nodelete-old-newlines)],
-        'fnl'                => [qw(freeze-newlines)],
-        'freeze-whitespace'  => [qw(noadd-whitespace nodelete-old-whitespace)],
-        'fws'                => [qw(freeze-whitespace)],
+        'freeze-newlines'   => [qw(noadd-newlines nodelete-old-newlines)],
+        'fnl'               => [qw(freeze-newlines)],
+        'freeze-whitespace' => [qw(noadd-whitespace nodelete-old-whitespace)],
+        'fws'               => [qw(freeze-whitespace)],
+        'freeze-blank-lines' =>
+          [qw(maximum-consecutive-blank-lines=0 keep-old-blank-lines=2)],
+        'fbl'                => [qw(freeze-blank-lines)],
         'indent-only'        => [qw(freeze-newlines freeze-whitespace)],
         'outdent-long-lines' => [qw(outdent-long-quotes outdent-long-comments)],
         'nooutdent-long-lines' =>
@@ -1597,6 +1603,11 @@ sub generate_options {
         'nhtml' => [qw(format=tidy)],
         'tidy'  => [qw(format=tidy)],
 
+        'swallow-optional-blank-lines'   => [qw(kbl=0)],
+        'noswallow-optional-blank-lines' => [qw(kbl=1)],
+        'sob'                            => [qw(kbl=0)],
+        'nsob'                           => [qw(kbl=1)],
+
         'break-after-comma-arrows'   => [qw(cab=0)],
         'nobreak-after-comma-arrows' => [qw(cab=1)],
         'baa'                        => [qw(cab=0)],
@@ -1659,6 +1670,7 @@ sub generate_options {
         'mangle' => [
             qw(
               check-syntax
+              keep-old-blank-lines=0
               delete-old-newlines
               delete-old-whitespace
               delete-semicolons
@@ -2109,11 +2121,6 @@ EOM
           $rOpts->{'opening-brace-on-new-line'};
     }
 
-    # set shortcut flag if no blanks to be written
-    unless ( $rOpts->{'maximum-consecutive-blank-lines'} ) {
-        $rOpts->{'swallow-optional-blank-lines'} = 1;
-    }
-
     if ( $rOpts->{'entab-leading-whitespace'} ) {
         if ( $rOpts->{'entab-leading-whitespace'} < 0 ) {
             warn "-et=n must use a positive integer; ignoring -et\n";
@@ -2360,6 +2367,7 @@ sub look_for_Windows {
 sub find_config_file {
 
     # look for a .perltidyrc configuration file
+    # For Windows also look for a file named perltidy.ini
     my ( $is_Windows, $Windows_type, $rconfig_file_chatter,
         $rpending_complaint ) = @_;
 
@@ -2384,6 +2392,10 @@ sub find_config_file {
     # look in current directory first
     $config_file = ".perltidyrc";
     return $config_file if $exists_config_file->($config_file);
+    if ($is_Windows) {
+        $config_file = "perltidy.ini";
+        return $config_file if $exists_config_file->($config_file);
+    }
 
     # Default environment vars.
     my @envs = qw(PERLTIDY HOME);
@@ -2407,6 +2419,11 @@ sub find_config_file {
             # test ENV as directory:
             $config_file = catfile( $ENV{$var}, ".perltidyrc" );
             return $config_file if $exists_config_file->($config_file);
+
+            if ($is_Windows) {
+                $config_file = catfile( $ENV{$var}, "perltidy.ini" );
+                return $config_file if $exists_config_file->($config_file);
+            }
         }
         else {
             $$rconfig_file_chatter .= "\n";
@@ -2422,14 +2439,24 @@ sub find_config_file {
               Win_Config_Locs( $rpending_complaint, $Windows_type );
 
             # Check All Users directory, if there is one.
+            # i.e. C:\Documents and Settings\User\perltidy.ini
             if ($allusers) {
+
                 $config_file = catfile( $allusers, ".perltidyrc" );
                 return $config_file if $exists_config_file->($config_file);
+
+                $config_file = catfile( $allusers, "perltidy.ini" );
+                return $config_file if $exists_config_file->($config_file);
             }
 
             # Check system directory.
+            # retain old code in case someone has been able to create
+            # a file with a leading period.
             $config_file = catfile( $system, ".perltidyrc" );
             return $config_file if $exists_config_file->($config_file);
+
+            $config_file = catfile( $system, "perltidy.ini" );
+            return $config_file if $exists_config_file->($config_file);
         }
     }
 
@@ -2789,7 +2816,7 @@ sub show_version {
     print <<"EOM";
 This is perltidy, v$VERSION 
 
-Copyright 2000-2007, Steve Hancock
+Copyright 2000-2009, 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.
@@ -2883,10 +2910,10 @@ Line Break Control
  -bbs    add blank line before subs and packages
  -bbc    add blank line before block comments
  -bbb    add blank line between major blocks
- -sob    swallow optional blank lines
+ -kbl=n  keep old blank lines? 0=no, 1=some, 2=all
+ -mbl=n  maximum consecutive blank lines to output (default=1)
  -ce     cuddled else; use this style: '} else {'
  -dnl    delete old newlines (default)
- -mbl=n  maximum consecutive blank lines (default=1)
  -l=n    maximum line length;  default n=80
  -bl     opening brace on new line 
  -sbl    opening sub brace on new line.  value of -bl is used if not given.
@@ -5588,7 +5615,7 @@ use vars qw{
   $rOpts_maximum_fields_per_table
   $rOpts_maximum_line_length
   $rOpts_short_concatenation_item_length
-  $rOpts_swallow_optional_blank_lines
+  $rOpts_keep_old_blank_lines
   $rOpts_ignore_old_breakpoints
   $rOpts_format_skipping
   $rOpts_space_function_paren
@@ -6578,7 +6605,7 @@ sub check_for_long_gnu_style_lines {
     my $spaces_needed =
       $gnu_position_predictor - $rOpts_maximum_line_length + 2;
 
-    return if ( $spaces_needed < 0 );
+    return if ( $spaces_needed <= 0 );
 
     # We are over the limit, so try to remove a requested number of
     # spaces from leading whitespace.  We are only allowed to remove
@@ -6627,7 +6654,7 @@ sub check_for_long_gnu_style_lines {
         for ( ; $i <= $max_gnu_item_index ; $i++ ) {
 
             my $old_spaces = $gnu_item_list[$i]->get_SPACES();
-            if ( $old_spaces > $deleted_spaces ) {
+            if ( $old_spaces >= $deleted_spaces ) {
                 $gnu_item_list[$i]->decrease_SPACES($deleted_spaces);
             }
 
@@ -7175,8 +7202,7 @@ EOM
     $rOpts_maximum_line_length      = $rOpts->{'maximum-line-length'};
     $rOpts_short_concatenation_item_length =
       $rOpts->{'short-concatenation-item-length'};
-    $rOpts_swallow_optional_blank_lines =
-      $rOpts->{'swallow-optional-blank-lines'};
+    $rOpts_keep_old_blank_lines     = $rOpts->{'keep-old-blank-lines'};
     $rOpts_ignore_old_breakpoints   = $rOpts->{'ignore-old-breakpoints'};
     $rOpts_format_skipping          = $rOpts->{'format-skipping'};
     $rOpts_space_function_paren     = $rOpts->{'space-function-paren'};
@@ -8374,12 +8400,13 @@ sub set_white_space_flag {
         # Handle a blank line..
         if ( $jmax < 0 ) {
 
-            # For the 'swallow-optional-blank-lines' option, we delete all
+            # If keep-old-blank-lines is zero, we delete all
             # old blank lines and let the blank line rules generate any
             # needed blanks.
-            if ( !$rOpts_swallow_optional_blank_lines ) {
+            if ($rOpts_keep_old_blank_lines) {
                 flush();
-                $file_writer_object->write_blank_code_line();
+                $file_writer_object->write_blank_code_line(
+                    $rOpts_keep_old_blank_lines == 2 );
                 $last_line_leading_type = 'b';
             }
             $last_line_had_side_comment = 0;
@@ -8517,7 +8544,7 @@ sub set_white_space_flag {
         #       /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/
         #   Examples:
         #     *VERSION = \'1.01';
-        #     ( $VERSION ) = '$Revision: 1.73 $ ' =~ /\$Revision:\s+([^\s]+)/;
+        #     ( $VERSION ) = '$Revision: 1.74 $ ' =~ /\$Revision:\s+([^\s]+)/;
         #   We will pass such a line straight through without breaking
         #   it unless -npvl is used
 
@@ -8805,12 +8832,12 @@ sub set_white_space_flag {
                   $block_type !~ /^sub/
                   ? $rOpts->{'opening-brace-on-new-line'}
 
-                  # use -sbl flag unless this is an anonymous sub block
+                  # use -sbl flag for a named sub block
                   : $block_type !~ /^sub\W*$/
                   ? $rOpts->{'opening-sub-brace-on-new-line'}
 
-                  # do not break for anonymous subs
-                  : 0;
+                  # use -asbl flag for an anonymous sub block
+                  : $rOpts->{'opening-anonymous-sub-brace-on-new-line'};
 
                 # Break before an opening '{' ...
                 if (
@@ -8894,7 +8921,10 @@ sub set_white_space_flag {
                         # that this is a block and not an anonomyous
                         # hash (blktype.t, blktype1.t)
                         && ( $block_type !~ /^[\{\};]$/ )
-
+                        
+                        # patch: and do not add semi-colons for recently
+                        # added block types (see tmp/semicolon.t)
+                        && ( $block_type !~ /^(switch|case|given|when|default)$/)
                         # it seems best not to add semicolons in these
                         # special block types: sort|map|grep
                         && ( !$is_sort_map_grep{$block_type} )
@@ -9669,6 +9699,104 @@ sub write_unindented_line {
     $file_writer_object->write_line( $_[0] );
 }
 
+sub undo_ci {
+
+    # Undo continuation indentation in certain sequences
+    # For example, we can undo continuation indation in sort/map/grep chains
+    #    my $dat1 = pack( "n*",
+    #        map { $_, $lookup->{$_} }
+    #          sort { $a <=> $b }
+    #          grep { $lookup->{$_} ne $default } keys %$lookup );
+    # To align the map/sort/grep keywords like this:
+    #    my $dat1 = pack( "n*",
+    #        map { $_, $lookup->{$_} }
+    #        sort { $a <=> $b }
+    #        grep { $lookup->{$_} ne $default } keys %$lookup );
+    my ( $ri_first, $ri_last ) = @_;
+    my ( $line_1, $line_2, $lev_last );
+    my $this_line_is_semicolon_terminated;
+    my $max_line = @$ri_first - 1;
+
+    # looking at each line of this batch..
+    # We are looking at leading tokens and looking for a sequence
+    # all at the same level and higher level than enclosing lines.
+    foreach my $line ( 0 .. $max_line ) {
+
+        my $ibeg = $$ri_first[$line];
+        my $lev  = $levels_to_go[$ibeg];
+        if ( $line > 0 ) {
+
+            # if we have started a chain..
+            if ($line_1) {
+
+                # see if it continues..
+                if ( $lev == $lev_last ) {
+                    if (   $types_to_go[$ibeg] eq 'k'
+                        && $is_sort_map_grep{ $tokens_to_go[$ibeg] } )
+                    {
+
+                        # chain continues...
+                        # check for chain ending at end of a a statement
+                        if ( $line == $max_line ) {
+
+                            # see of this line ends a statement
+                            my $iend = $$ri_last[$line];
+                            $this_line_is_semicolon_terminated =
+                              $types_to_go[$iend] eq ';'
+
+                              # with possible side comment
+                              || ( $types_to_go[$iend] eq '#'
+                                && $iend - $ibeg >= 2
+                                && $types_to_go[ $iend - 2 ] eq ';'
+                                && $types_to_go[ $iend - 1 ] eq 'b' );
+                        }
+                        $line_2 = $line if ($this_line_is_semicolon_terminated);
+                    }
+                    else {
+
+                        # kill chain
+                        $line_1 = undef;
+                    }
+                }
+                elsif ( $lev < $lev_last ) {
+
+                    # chain ends with previous line
+                    $line_2 = $line - 1;
+                }
+                elsif ( $lev > $lev_last ) {
+
+                    # kill chain
+                    $line_1 = undef;
+                }
+
+                # undo the continuation indentation if a chain ends
+                if ( defined($line_2) && defined($line_1) ) {
+                    my $continuation_line_count = $line_2 - $line_1 + 1;
+                    @ci_levels_to_go[ @$ri_first[ $line_1 .. $line_2 ] ] =
+                      (0) x ($continuation_line_count);
+                    @leading_spaces_to_go[ @$ri_first[ $line_1 .. $line_2 ] ] =
+                      @reduced_spaces_to_go[ @$ri_first[ $line_1 .. $line_2 ] ];
+                    $line_1 = undef;
+                }
+            }
+
+            # not in a chain yet..
+            else {
+
+                # look for start of a new sort/map/grep chain
+                if ( $lev > $lev_last ) {
+                    if (   $types_to_go[$ibeg] eq 'k'
+                        && $is_sort_map_grep{ $tokens_to_go[$ibeg] } )
+                    {
+                        $line_1 = $line;
+                    }
+                }
+            }
+        }
+        $lev_last = $lev;
+    }
+}
+
 sub undo_lp_ci {
 
     # If there is a single, long parameter within parens, like this:
@@ -10691,6 +10819,64 @@ sub make_else_csc_text {
     return $csc_text;
 }
 
+{    # sub balance_csc_text
+
+    my %matching_char;
+
+    BEGIN {
+        %matching_char = (
+            '{' => '}',
+            '(' => ')',
+            '[' => ']',
+            '}' => '{',
+            ')' => '(',
+            ']' => '[',
+        );
+    }
+
+    sub balance_csc_text {
+
+        # Append characters to balance a closing side comment so that editors
+        # such as vim can correctly jump through code.
+        # Simple Example:
+        #  input  = ## end foreach my $foo ( sort { $b  ...
+        #  output = ## end foreach my $foo ( sort { $b  ...})
+
+        # NOTE: This routine does not currently filter out structures within
+        # quoted text because the bounce algorithims in text editors do not
+        # necessarily do this either (a version of vim was checked and
+        # did not do this).
+
+        # Some complex examples which will cause trouble for some editors:
+        #  while ( $mask_string =~ /\{[^{]*?\}/g ) {
+        #  if ( $mask_str =~ /\}\s*els[^\{\}]+\{$/ ) {
+        #  if ( $1 eq '{' ) {
+        # test file test1/braces.pl has many such examples.
+
+        my ($csc) = @_;
+
+        # loop to examine characters one-by-one, RIGHT to LEFT and
+        # build a balancing ending, LEFT to RIGHT.
+        for ( my $pos = length($csc) - 1 ; $pos >= 0 ; $pos-- ) {
+
+            my $char = substr( $csc, $pos, 1 );
+
+            # ignore everything except structural characters
+            next unless ( $matching_char{$char} );
+
+            # pop most recently appended character
+            my $top = chop($csc);
+
+            # push it back plus the mate to the newest character
+            # unless they balance each other.
+            $csc = $csc . $top . $matching_char{$char} unless $top eq $char;
+        }
+
+        # return the balanced string
+        return $csc;
+    }
+}
+
 sub add_closing_side_comment {
 
     # add closing side comments after closing block braces if -csc used
@@ -10763,6 +10949,10 @@ sub add_closing_side_comment {
         if ( $i_block_leading_text == $i_terminal ) {
             $token .= $block_leading_text;
         }
+
+        $token = balance_csc_text($token)
+          if $rOpts->{'closing-side-comments-balanced'};
+
         $token =~ s/\s*$//;    # trim any trailing whitespace
 
         # handle case of existing closing side comment
@@ -10772,11 +10962,13 @@ sub add_closing_side_comment {
             if ( $rOpts->{'closing-side-comment-warnings'} ) {
                 my $old_csc = $tokens_to_go[$max_index_to_go];
                 my $new_csc = $token;
-                $new_csc =~ s/(\.\.\.)\s*$//;    # trim trailing '...'
-                my $new_trailing_dots = $1;
-                $old_csc =~ s/\.\.\.\s*$//;
                 $new_csc =~ s/\s+//g;            # trim all whitespace
-                $old_csc =~ s/\s+//g;
+                $old_csc =~ s/\s+//g;            # trim all whitespace
+                $new_csc =~ s/[\]\)\}\s]*$//;    # trim trailing structures
+                $old_csc =~ s/[\]\)\}\s]*$//;    # trim trailing structures
+                $new_csc =~ s/(\.\.\.)$//;       # trim trailing '...'
+                my $new_trailing_dots = $1;
+                $old_csc =~ s/(\.\.\.)\s*$//;    # trim trailing '...'
 
                 # Patch to handle multiple closing side comments at
                 # else and elsif's.  These have become too complicated
@@ -10921,6 +11113,8 @@ sub send_lines_to_vertical_aligner {
         Perl::Tidy::VerticalAligner::flush();
     }
 
+    undo_ci( $ri_first, $ri_last );
+
     set_logical_padding( $ri_first, $ri_last );
 
     # loop to prepare each line for shipment
@@ -11606,6 +11800,28 @@ sub lookup_opening_indentation {
                 }
             }
 
+            # YVES patch 1 of 2:
+            # Undo ci of line with leading closing eval brace,
+            # but not beyond the indention of the line with
+            # the opening brace.
+            if (   $block_type_to_go[$ibeg] eq 'eval'
+                && !$rOpts->{'line-up-parentheses'}
+                && !$rOpts->{'indent-closing-brace'} )
+            {
+                (
+                    $opening_indentation, $opening_offset,
+                    $is_leading,          $opening_exists
+                  )
+                  = get_opening_indentation( $ibeg, $ri_first, $ri_last,
+                    $rindentation_list );
+                my $indentation = $leading_spaces_to_go[$ibeg];
+                if ( defined($opening_indentation)
+                    && $indentation > $opening_indentation )
+                {
+                    $adjust_indentation = 1;
+                }
+            }
+
             $default_adjust_indentation = $adjust_indentation;
 
             # Now modify default behavior according to user request:
@@ -15653,6 +15869,47 @@ sub undo_forced_breakpoint_stack {
                       && ( $nesting_depth_to_go[$iend_1] ==
                         $nesting_depth_to_go[$iend_2] + 1 );
 
+                    # YVES patch 2 of 2:
+                    # Allow cuddled eval chains, like this:
+                    #   eval {
+                    #       #STUFF;
+                    #       1; # return true
+                    #   } or do {
+                    #       #handle error
+                    #   };
+                    # This patch works together with a patch in
+                    # setting adjusted indentation (where the closing eval
+                    # brace is outdented if possible).
+                    # The problem is that an 'eval' block has continuation
+                    # indentation and it looks better to undo it in some
+                    # cases.  If we do not use this patch we would get:
+                    #   eval {
+                    #       #STUFF;
+                    #       1; # return true
+                    #       }
+                    #       or do {
+                    #       #handle error
+                    #     };
+                    # The alternative, for uncuddled style, is to create
+                    # a patch in set_adjusted_indentation which undoes
+                    # the indentation of a leading line like 'or do {'.
+                    # This doesn't work well with -icb through
+                    if (
+                           $block_type_to_go[$iend_1] eq 'eval'
+                        && !$rOpts->{'line-up-parentheses'}
+                        && !$rOpts->{'indent-closing-brace'}
+                        && $tokens_to_go[$iend_2] eq '{'
+                        && (
+                            ( $types_to_go[$ibeg_2] =~ /^(|\&\&|\|\|)$/ )
+                            || (   $types_to_go[$ibeg_2] eq 'k'
+                                && $is_and_or{ $tokens_to_go[$ibeg_2] } )
+                            || $is_if_unless{ $tokens_to_go[$ibeg_2] }
+                        )
+                      )
+                    {
+                        $previous_outdentable_closing_paren ||= 1;
+                    }
+
                     next
                       unless (
                         $previous_outdentable_closing_paren
@@ -15662,6 +15919,14 @@ sub undo_forced_breakpoint_stack {
                       );
                 }
 
+                # YVES
+                # honor breaks at opening brace
+                # Added to prevent recombining something like this:
+                #  } || eval { package main;
+                elsif ( $types_to_go[$iend_1] eq '{' ) {
+                    next if $forced_breakpoint_to_go[$iend_1];
+                }
+
                 # do not recombine lines with ending &&, ||,
                 elsif ( $is_amp_amp{ $types_to_go[$iend_1] } ) {
                     next unless $want_break_before{ $types_to_go[$iend_1] };
@@ -16576,7 +16841,7 @@ sub in_same_container {
     # See test file 'infinite_loop.txt'
     # TODO: replace this loop with a data structure
     ###########################################################
-    return if ( $i2-$i1 > 200 );
+    return if ( $i2 - $i1 > 200 );
 
     for ( my $i = $i1 + 1 ; $i < $i2 ; $i++ ) {
         next   if ( $nesting_depth_to_go[$i] > $depth );
@@ -20179,10 +20444,12 @@ sub want_blank_line {
 }
 
 sub write_blank_code_line {
-    my $self  = shift;
-    my $rOpts = $self->{_rOpts};
+    my $self   = shift;
+    my $forced = shift;
+    my $rOpts  = $self->{_rOpts};
     return
-      if ( $self->{_consecutive_blank_lines} >=
+      if (!$forced
+        && $self->{_consecutive_blank_lines} >=
         $rOpts->{'maximum-consecutive-blank-lines'} );
     $self->{_consecutive_blank_lines}++;
     $self->{_consecutive_nonblank_lines} = 0;
@@ -22462,6 +22729,12 @@ sub prepare_for_a_new_file {
                   find_angle_operator_termination( $input_line, $i, $rtoken_map,
                     $expecting, $max_token_index );
 
+                if ( $type eq '<' && $expecting == TERM ) {
+                    error_if_expecting_TERM();
+                    interrupt_logfile();
+                    warning("Unterminated <> operator?\n");
+                    resume_logfile();
+                }
             }
             else {
             }
@@ -22789,7 +23062,7 @@ sub prepare_for_a_new_file {
 
     # These block types terminate statements and do not need a trailing
     # semicolon
-    # patched for SWITCH/CASE:
+    # patched for SWITCH/CASE/
     my %is_zero_continuation_block_type;
     @_ = qw( } { BEGIN END CHECK INIT AUTOLOAD DESTROY UNITCHECK continue ;
       if elsif else unless while until for foreach switch case given when);
@@ -24734,7 +25007,20 @@ sub code_block_type {
 # it follows any of these:
 # /^(BEGIN|END|CHECK|INIT|AUTOLOAD|DESTROY|UNITCHECK|continue|if|elsif|else|unless|do|while|until|eval|for|foreach|map|grep|sort)$/
     elsif ( $is_code_block_token{$last_nonblank_token} ) {
-        return $last_nonblank_token;
+
+        # Bug Patch: Note that the opening brace after the 'if' in the following
+        # snippet is an anonymous hash ref and not a code block!
+        #   print 'hi' if { x => 1, }->{x};
+        # We can identify this situation because the last nonblank type
+        # will be a keyword (instead of a closing peren)
+        if (   $last_nonblank_token =~ /^(if|unless)$/
+            && $last_nonblank_type eq 'k' )
+        {
+            return "";
+        }
+        else {
+            return $last_nonblank_token;
+        }
     }
 
     # or a sub definition
@@ -28251,7 +28537,7 @@ to perltidy.
 
 =head1 VERSION
 
-This man page documents Perl::Tidy version 20071205.
+This man page documents Perl::Tidy version 20090616.
 
 =head1 AUTHOR