"Fossies" - the Fresh Open Source Software Archive

Member "Perl-Tidy-20210717/bin/perltidy" (15 Jul 2021, 186862 Bytes) of package /linux/misc/Perl-Tidy-20210717.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "perltidy": 20210402_vs_20210717.

    1 #!/usr/bin/perl
    2 package main;
    3 
    4 use Perl::Tidy;
    5 
    6 my $arg_string = undef;
    7 
    8 # give Macs a chance to provide command line parameters
    9 if ( $^O =~ /Mac/ ) {
   10     $arg_string = MacPerl::Ask(
   11         'Please enter @ARGV (-h for help)',
   12         defined $ARGV[0] ? "\"$ARGV[0]\"" : ""
   13     );
   14 }
   15 
   16 # Exit codes returned by perltidy:
   17 #    0 = no errors
   18 #    1 = perltidy could not run to completion due to errors
   19 #    2 = perltidy ran to completion with error messages
   20 exit Perl::Tidy::perltidy( argv => $arg_string );
   21 
   22 __END__
   23 
   24 =head1 NAME
   25 
   26 perltidy - a perl script indenter and reformatter
   27 
   28 =head1 SYNOPSIS
   29 
   30     perltidy [ options ] file1 file2 file3 ...
   31             (output goes to file1.tdy, file2.tdy, file3.tdy, ...)
   32     perltidy [ options ] file1 -o outfile
   33     perltidy [ options ] file1 -st >outfile
   34     perltidy [ options ] <infile >outfile
   35 
   36 =head1 DESCRIPTION
   37 
   38 Perltidy reads a perl script and writes an indented, reformatted script.
   39 
   40 Many users will find enough information in L<"EXAMPLES"> to get 
   41 started.  New users may benefit from the short tutorial 
   42 which can be found at
   43 http://perltidy.sourceforge.net/tutorial.html
   44 
   45 A convenient aid to systematically defining a set of style parameters
   46 can be found at
   47 http://perltidy.sourceforge.net/stylekey.html
   48 
   49 Perltidy can produce output on either of two modes, depending on the
   50 existence of an B<-html> flag.  Without this flag, the output is passed
   51 through a formatter.  The default formatting tries to follow the
   52 recommendations in perlstyle(1), but it can be controlled in detail with
   53 numerous input parameters, which are described in L<"FORMATTING
   54 OPTIONS">.  
   55 
   56 When the B<-html> flag is given, the output is passed through an HTML
   57 formatter which is described in L<"HTML OPTIONS">.  
   58 
   59 =head1 EXAMPLES
   60 
   61   perltidy somefile.pl
   62 
   63 This will produce a file F<somefile.pl.tdy> containing the script reformatted
   64 using the default options, which approximate the style suggested in 
   65 perlstyle(1).  The source file F<somefile.pl> is unchanged.
   66 
   67   perltidy *.pl
   68 
   69 Execute perltidy on all F<.pl> files in the current directory with the
   70 default options.  The output will be in files with an appended F<.tdy>
   71 extension.  For any file with an error, there will be a file with extension
   72 F<.ERR>.
   73 
   74   perltidy -b file1.pl file2.pl
   75 
   76 Modify F<file1.pl> and F<file2.pl> in place, and backup the originals to
   77 F<file1.pl.bak> and F<file2.pl.bak>.  If F<file1.pl.bak> and/or F<file2.pl.bak>
   78 already exist, they will be overwritten.
   79 
   80   perltidy -b -bext='/' file1.pl file2.pl
   81 
   82 Same as the previous example except that the backup files F<file1.pl.bak> and F<file2.pl.bak> will be deleted if there are no errors.
   83 
   84   perltidy -gnu somefile.pl
   85 
   86 Execute perltidy on file F<somefile.pl> with a style which approximates the
   87 GNU Coding Standards for C programs.  The output will be F<somefile.pl.tdy>.
   88 
   89   perltidy -i=3 somefile.pl
   90 
   91 Execute perltidy on file F<somefile.pl>, with 3 columns for each level of
   92 indentation (B<-i=3>) instead of the default 4 columns.  There will not be any
   93 tabs in the reformatted script, except for any which already exist in comments,
   94 pod documents, quotes, and here documents.  Output will be F<somefile.pl.tdy>. 
   95 
   96   perltidy -i=3 -et=8 somefile.pl
   97 
   98 Same as the previous example, except that leading whitespace will
   99 be entabbed with one tab character per 8 spaces.
  100 
  101   perltidy -ce -l=72 somefile.pl
  102 
  103 Execute perltidy on file F<somefile.pl> with all defaults except use "cuddled
  104 elses" (B<-ce>) and a maximum line length of 72 columns (B<-l=72>) instead of
  105 the default 80 columns.  
  106 
  107   perltidy -g somefile.pl
  108 
  109 Execute perltidy on file F<somefile.pl> and save a log file F<somefile.pl.LOG>
  110 which shows the nesting of braces, parentheses, and square brackets at
  111 the start of every line.
  112 
  113   perltidy -html somefile.pl
  114 
  115 This will produce a file F<somefile.pl.html> containing the script with
  116 html markup.  The output file will contain an embedded style sheet in
  117 the <HEAD> section which may be edited to change the appearance.
  118 
  119   perltidy -html -css=mystyle.css somefile.pl
  120 
  121 This will produce a file F<somefile.pl.html> containing the script with
  122 html markup.  This output file will contain a link to a separate style
  123 sheet file F<mystyle.css>.  If the file F<mystyle.css> does not exist,
  124 it will be created.  If it exists, it will not be overwritten.
  125 
  126   perltidy -html -pre somefile.pl
  127 
  128 Write an html snippet with only the PRE section to F<somefile.pl.html>.
  129 This is useful when code snippets are being formatted for inclusion in a
  130 larger web page.  No style sheet will be written in this case.  
  131 
  132   perltidy -html -ss >mystyle.css
  133 
  134 Write a style sheet to F<mystyle.css> and exit.
  135 
  136   perltidy -html -frm mymodule.pm
  137 
  138 Write html with a frame holding a table of contents and the source code.  The
  139 output files will be F<mymodule.pm.html> (the frame), F<mymodule.pm.toc.html>
  140 (the table of contents), and F<mymodule.pm.src.html> (the source code).
  141 
  142 =head1 OPTIONS - OVERVIEW
  143 
  144 The entire command line is scanned for options, and they are processed
  145 before any files are processed.  As a result, it does not matter
  146 whether flags are before or after any filenames.  However, the relative
  147 order of parameters is important, with later parameters overriding the
  148 values of earlier parameters.  
  149 
  150 For each parameter, there is a long name and a short name.  The short
  151 names are convenient for keyboard input, while the long names are
  152 self-documenting and therefore useful in scripts.  It is customary to
  153 use two leading dashes for long names, but one may be used.
  154 
  155 Most parameters which serve as on/off flags can be negated with a
  156 leading "n" (for the short name) or a leading "no" or "no-" (for the
  157 long name).  For example, the flag to outdent long quotes is B<-olq>
  158 or B<--outdent-long-quotes>.  The flag to skip this is B<-nolq>
  159 or B<--nooutdent-long-quotes> or B<--no-outdent-long-quotes>.
  160 
  161 Options may not be bundled together.  In other words, options B<-q> and
  162 B<-g> may NOT be entered as B<-qg>.
  163 
  164 Option names may be terminated early as long as they are uniquely identified.
  165 For example, instead of B<--dump-token-types>, it would be sufficient to enter
  166 B<--dump-tok>, or even B<--dump-t>, to uniquely identify this command.
  167 
  168 =head2 I/O control
  169 
  170 The following parameters concern the files which are read and written.
  171 
  172 =over 4
  173 
  174 =item B<-h>,    B<--help> 
  175 
  176 Show summary of usage and exit.
  177 
  178 =item   B<-o>=filename,    B<--outfile>=filename  
  179 
  180 Name of the output file (only if a single input file is being
  181 processed).  If no output file is specified, and output is not
  182 redirected to the standard output (see B<-st>), the output will go to
  183 F<filename.tdy>. [Note: - does not redirect to standard output. Use
  184 B<-st> instead.]
  185 
  186 =item   B<-st>,    B<--standard-output>
  187 
  188 Perltidy must be able to operate on an arbitrarily large number of files
  189 in a single run, with each output being directed to a different output
  190 file.  Obviously this would conflict with outputting to the single
  191 standard output device, so a special flag, B<-st>, is required to
  192 request outputting to the standard output.  For example,
  193 
  194   perltidy somefile.pl -st >somefile.new.pl
  195 
  196 This option may only be used if there is just a single input file.  
  197 The default is B<-nst> or B<--nostandard-output>.
  198 
  199 =item   B<-se>,    B<--standard-error-output>
  200 
  201 If perltidy detects an error when processing file F<somefile.pl>, its
  202 default behavior is to write error messages to file F<somefile.pl.ERR>.
  203 Use B<-se> to cause all error messages to be sent to the standard error
  204 output stream instead.  This directive may be negated with B<-nse>.
  205 Thus, you may place B<-se> in a F<.perltidyrc> and override it when
  206 desired with B<-nse> on the command line.
  207 
  208 =item   B<-oext>=ext,    B<--output-file-extension>=ext  
  209 
  210 Change the extension of the output file to be F<ext> instead of the
  211 default F<tdy> (or F<html> in case the -B<-html> option is used).
  212 See L<Specifying File Extensions>.
  213 
  214 =item   B<-opath>=path,    B<--output-path>=path  
  215 
  216 When perltidy creates a filename for an output file, by default it merely
  217 appends an extension to the path and basename of the input file.  This
  218 parameter causes the path to be changed to F<path> instead.
  219 
  220 The path should end in a valid path separator character, but perltidy will try
  221 to add one if it is missing.
  222 
  223 For example
  224 
  225  perltidy somefile.pl -opath=/tmp/
  226 
  227 will produce F</tmp/somefile.pl.tdy>.  Otherwise, F<somefile.pl.tdy> will
  228 appear in whatever directory contains F<somefile.pl>.
  229 
  230 If the path contains spaces, it should be placed in quotes.
  231 
  232 This parameter will be ignored if output is being directed to standard output,
  233 or if it is being specified explicitly with the B<-o=s> parameter.
  234 
  235 =item   B<-b>,    B<--backup-and-modify-in-place>
  236 
  237 Modify the input file or files in-place and save the original with the
  238 extension F<.bak>.  Any existing F<.bak> file will be deleted.  See next
  239 item for changing the default backup extension, and for eliminating the
  240 backup file altogether.  
  241 
  242 A B<-b> flag will be ignored if input is from standard input or goes to
  243 standard output, or if the B<-html> flag is set.  
  244 
  245 In particular, if you want to use both the B<-b> flag and the B<-pbp>
  246 (--perl-best-practices) flag, then you must put a B<-nst> flag after the
  247 B<-pbp> flag because it contains a B<-st> flag as one of its components,
  248 which means that output will go to the standard output stream.
  249 
  250 =item   B<-bext>=ext,    B<--backup-file-extension>=ext  
  251 
  252 This parameter serves two purposes: (1) to change the extension of the backup
  253 file to be something other than the default F<.bak>, and (2) to indicate
  254 that no backup file should be saved.
  255 
  256 To change the default extension to something other than F<.bak> see
  257 L<Specifying File Extensions>.
  258 
  259 A backup file of the source is always written, but you can request that it
  260 be deleted at the end of processing if there were no errors.  This is risky
  261 unless the source code is being maintained with a source code control
  262 system.  
  263 
  264 To indicate that the backup should be deleted include one forward slash,
  265 B</>, in the extension.  If any text remains after the slash is removed
  266 it will be used to define the backup file extension (which is always
  267 created and only deleted if there were no errors).
  268 
  269 Here are some examples:
  270 
  271   Parameter           Extension          Backup File Treatment
  272   <-bext=bak>         F<.bak>            Keep (same as the default behavior)
  273   <-bext='/'>         F<.bak>            Delete if no errors
  274   <-bext='/backup'>   F<.backup>         Delete if no errors
  275   <-bext='original/'> F<.original>       Delete if no errors
  276 
  277 =item B<-w>,    B<--warning-output>             
  278 
  279 Setting B<-w> causes any non-critical warning
  280 messages to be reported as errors.  These include messages
  281 about possible pod problems, possibly bad starting indentation level,
  282 and cautions about indirect object usage.  The default, B<-nw> or
  283 B<--nowarning-output>, is not to include these warnings.
  284 
  285 =item B<-q>,    B<--quiet>             
  286 
  287 Deactivate error messages (for running under an editor). 
  288 
  289 For example, if you use a vi-style editor, such as vim, you may execute
  290 perltidy as a filter from within the editor using something like
  291 
  292  :n1,n2!perltidy -q
  293 
  294 where C<n1,n2> represents the selected text.  Without the B<-q> flag,
  295 any error message may mess up your screen, so be prepared to use your
  296 "undo" key.
  297 
  298 =item B<-log>,    B<--logfile>           
  299 
  300 Save the F<.LOG> file, which has many useful diagnostics.  Perltidy always
  301 creates a F<.LOG> file, but by default it is deleted unless a program bug is
  302 suspected.  Setting the B<-log> flag forces the log file to be saved.
  303 
  304 =item B<-g=n>, B<--logfile-gap=n>
  305 
  306 Set maximum interval between input code lines in the logfile.  This purpose of
  307 this flag is to assist in debugging nesting errors.  The value of C<n> is
  308 optional.  If you set the flag B<-g> without the value of C<n>, it will be
  309 taken to be 1, meaning that every line will be written to the log file.  This
  310 can be helpful if you are looking for a brace, paren, or bracket nesting error. 
  311 
  312 Setting B<-g> also causes the logfile to be saved, so it is not necessary to
  313 also include B<-log>. 
  314 
  315 If no B<-g> flag is given, a value of 50 will be used, meaning that at least
  316 every 50th line will be recorded in the logfile.  This helps prevent
  317 excessively long log files.  
  318 
  319 Setting a negative value of C<n> is the same as not setting B<-g> at all.
  320 
  321 =item B<-npro>  B<--noprofile>    
  322 
  323 Ignore any F<.perltidyrc> command file.  Normally, perltidy looks first in
  324 your current directory for a F<.perltidyrc> file of parameters.  (The format
  325 is described below).  If it finds one, it applies those options to the
  326 initial default values, and then it applies any that have been defined
  327 on the command line.  If no F<.perltidyrc> file is found, it looks for one
  328 in your home directory.
  329 
  330 If you set the B<-npro> flag, perltidy will not look for this file.
  331 
  332 =item B<-pro=filename> or  B<--profile=filename>    
  333 
  334 To simplify testing and switching .perltidyrc files, this command may be
  335 used to specify a configuration file which will override the default
  336 name of .perltidyrc.  There must not be a space on either side of the
  337 '=' sign.  For example, the line
  338 
  339    perltidy -pro=testcfg
  340 
  341 would cause file F<testcfg> to be used instead of the 
  342 default F<.perltidyrc>.
  343 
  344 A pathname begins with three dots, e.g. ".../.perltidyrc", indicates that
  345 the file should be searched for starting in the current directory and
  346 working upwards. This makes it easier to have multiple projects each with
  347 their own .perltidyrc in their root directories.
  348 
  349 =item B<-opt>,   B<--show-options>      
  350 
  351 Write a list of all options used to the F<.LOG> file.  
  352 Please see B<--dump-options> for a simpler way to do this.
  353 
  354 =item B<-f>,   B<--force-read-binary>      
  355 
  356 Force perltidy to process binary files.  To avoid producing excessive
  357 error messages, perltidy skips files identified by the system as non-text.
  358 However, valid perl scripts containing binary data may sometimes be identified
  359 as non-text, and this flag forces perltidy to process them.
  360 
  361 =item B<-ast>,   B<--assert-tidy>      
  362 
  363 This flag asserts that the input and output code streams are identical, or in
  364 other words that the input code is already 'tidy' according to the formatting
  365 parameters.  If this is not the case, an error message noting this is produced.
  366 This error message will cause the process to return a non-zero exit code.
  367 The test for this is made by comparing an MD5 hash value for the input and
  368 output code streams. This flag has no other effect on the functioning of
  369 perltidy.  This might be useful for certain code maintenance operations.
  370 Note: you will not see this message if you have error messages turned off with the
  371 -quiet flag.
  372 
  373 =item B<-asu>,   B<--assert-untidy>      
  374 
  375 This flag asserts that the input and output code streams are different, or in
  376 other words that the input code is 'untidy' according to the formatting
  377 parameters.  If this is not the case, an error message noting this is produced.
  378 This flag has no other effect on the functioning of perltidy.
  379 
  380 =item B<-sal=s>,   B<--sub-alias-list=s>      
  381 
  382 This flag causes one or more words to be treated the same as if they were the keyword 'sub'.  The string B<s> contains one or more alias words, separated by spaces or commas.
  383 
  384 For example,
  385 
  386         perltidy -sal='method fun _sub M4' 
  387 
  388 will cause the perltidy to treate the words 'method', 'fun', '_sub' and 'M4' to be treated the same as if they were 'sub'.  Note that if the alias words are separated by spaces then the string of words should be placed in quotes.
  389 
  390 Note that several other parameters accept a list of keywords, including 'sub' (see L<Specifying Block Types>).
  391 You do not need to include any sub aliases in these lists. Just include keyword 'sub' if you wish, and all aliases are automatically included.
  392 
  393 =back
  394 
  395 =head1 FORMATTING OPTIONS
  396 
  397 =head2 Basic Options
  398 
  399 =over 4
  400 
  401 =item B<--notidy>
  402 
  403 This flag disables all formatting and causes the input to be copied unchanged
  404 to the output except for possible changes in line ending characters and any
  405 pre- and post-filters.  This can be useful in conjunction with a hierarchical
  406 set of F<.perltidyrc> files to avoid unwanted code tidying.  See also
  407 L<Skipping Selected Sections of Code> for a way to avoid tidying specific
  408 sections of code.
  409 
  410 =item B<-i=n>,  B<--indent-columns=n>  
  411 
  412 Use n columns per indentation level (default n=4).
  413 
  414 =item B<-l=n>, B<--maximum-line-length=n>
  415 
  416 The default maximum line length is n=80 characters.  Perltidy will try
  417 to find line break points to keep lines below this length. However, long
  418 quotes and side comments may cause lines to exceed this length. 
  419 
  420 The default length of 80 comes from the past when this was the standard CRT
  421 screen width.  Many programmers prefer to increase this to something like 120.
  422 
  423 Setting B<-l=0> is equivalent to setting B<-l=(a very large number)>.  But this is
  424 not recommended because, for example, a very long list will be formatted in a
  425 single long line.
  426 
  427 =item B<-vmll>, B<--variable-maximum-line-length>
  428 
  429 A problem arises using a fixed maximum line length with very deeply nested code
  430 and data structures because eventually the amount of leading whitespace used
  431 for indicating indentation takes up most or all of the available line width,
  432 leaving little or no space for the actual code or data.  One solution is to use
  433 a vary long line length.  Another solution is to use the B<-vmll> flag, which
  434 basically tells perltidy to ignore leading whitespace when measuring the line
  435 length.  
  436 
  437 To be precise, when the B<-vmll> parameter is set, the maximum line length of a
  438 line of code will be M+L*I, where
  439 
  440       M is the value of --maximum-line-length=M (-l=M), default 80,
  441       I is the value of --indent-columns=I (-i=I), default 4,
  442       L is the indentation level of the line of code
  443 
  444 When this flag is set, the choice of breakpoints for a block of code should be
  445 essentially independent of its nesting depth.  However, the absolute line
  446 lengths, including leading whitespace, can still be arbitrarily large.  This
  447 problem can be avoided by including the next parameter.  
  448 
  449 The default is not to do this (B<-nvmll>).
  450 
  451 =item B<-wc=n>, B<--whitespace-cycle=n>
  452 
  453 This flag also addresses problems with very deeply nested code and data
  454 structures.  When the nesting depth exceeds the value B<n> the leading
  455 whitespace will be reduced and start at a depth of 1 again.  The result is that
  456 blocks of code will shift back to the left rather than moving arbitrarily far
  457 to the right.  This occurs cyclically to any depth.  
  458 
  459 For example if one level of indentation equals 4 spaces (B<-i=4>, the default),
  460 and one uses B<-wc=15>, then if the leading whitespace on a line exceeds about
  461 4*15=60 spaces it will be reduced back to 4*1=4 spaces and continue increasing
  462 from there.  If the whitespace never exceeds this limit the formatting remains
  463 unchanged.
  464 
  465 The combination of B<-vmll> and B<-wc=n> provides a solution to the problem of
  466 displaying arbitrarily deep data structures and code in a finite window,
  467 although B<-wc=n> may of course be used without B<-vmll>.
  468 
  469 The default is not to use this, which can also be indicated using B<-wc=0>.
  470 
  471 =item B<Tabs>
  472 
  473 Using tab characters will almost certainly lead to future portability
  474 and maintenance problems, so the default and recommendation is not to
  475 use them.  For those who prefer tabs, however, there are two different
  476 options.  
  477 
  478 Except for possibly introducing tab indentation characters, as outlined
  479 below, perltidy does not introduce any tab characters into your file,
  480 and it removes any tabs from the code (unless requested not to do so
  481 with B<-fws>).  If you have any tabs in your comments, quotes, or
  482 here-documents, they will remain.
  483 
  484 =over 4
  485 
  486 =item B<-et=n>,   B<--entab-leading-whitespace>
  487 
  488 This flag causes each B<n> initial space characters to be replaced by
  489 one tab character.  
  490 
  491 The value of the integer B<n> can be any value but can be coordinated with the
  492 number of spaces used for intentation. For example, B<-et=4 -ci=4 -i=4> will
  493 produce one tab for each indentation level and and one for each continuation
  494 indentation level.  You may want to coordinate the value of B<n> with what your
  495 display software assumes for the spacing of a tab. 
  496 
  497 =item B<-t>,   B<--tabs>
  498 
  499 This flag causes one leading tab character to be inserted for each level
  500 of indentation.  Certain other features are incompatible with this
  501 option, and if these options are also given, then a warning message will
  502 be issued and this flag will be unset.  One example is the B<-lp>
  503 option. This flag is retained for backwards compatibility, but
  504 if you use tabs, the B<-et=n> flag is recommended.
  505 
  506 =item B<-dt=n>,   B<--default-tabsize=n>
  507 
  508 If the first line of code passed to perltidy contains leading tabs but no
  509 tab scheme is specified for the output stream then perltidy must guess how many
  510 spaces correspond to each leading tab.  This number of spaces B<n>
  511 corresponding to each leading tab of the input stream may be specified with
  512 B<-dt=n>.  The default is B<n=8>.  
  513 
  514 This flag has no effect if a tab scheme is specified for the output stream,
  515 because then the input stream is assumed to use the same tab scheme and
  516 indentation spaces as for the output stream (any other assumption would lead to
  517 unstable editing).
  518 
  519 =back
  520 
  521 =item B<-xs>,   B<--extended-syntax>      
  522 
  523 A problem with formatting Perl code is that some modules can introduce new
  524 syntax.  This flag allows perltidy to handle certain common extensions
  525 to the standard syntax without complaint.  
  526 
  527 For example, without this flag a structure such as the following would generate
  528 a syntax error and the braces would not be balanced:
  529 
  530     method deposit( Num $amount) {
  531         $self->balance( $self->balance + $amount );
  532     }
  533 
  534 For one of the extensions, module Switch::Plain, colons are marked as labels.
  535 If you use this module, you may want to also use the B<--nooutdent-labels> flag
  536 to prevent lines such as 'default:' from being outdented.
  537 
  538 This flag is enabled by default but it can be deactivated with B<-nxs>.
  539 Probably the only reason to deactivate this flag is to generate more diagnostic
  540 messages when debugging a script.
  541 
  542 For another method of handling extended syntax see the section L<Skipping Selected Sections of Code>.
  543 
  544 =item B<-io>,   B<--indent-only>       
  545 
  546 This flag is used to deactivate all whitespace and line break changes
  547 within non-blank lines of code.
  548 When it is in effect, the only change to the script will be
  549 to the indentation and to the number of blank lines.
  550 And any flags controlling whitespace and newlines will be ignored.  You
  551 might want to use this if you are perfectly happy with your whitespace
  552 and line breaks, and merely want perltidy to handle the indentation.
  553 (This also speeds up perltidy by well over a factor of two, so it might be
  554 useful when perltidy is merely being used to help find a brace error in
  555 a large script).
  556 
  557 Setting this flag is equivalent to setting B<--freeze-newlines> and
  558 B<--freeze-whitespace>.  
  559 
  560 If you also want to keep your existing blank lines exactly
  561 as they are, you can add B<--freeze-blank-lines>. 
  562 
  563 With this option perltidy is still free to modify the indenting (and
  564 outdenting) of code and comments as it normally would.  If you also want to
  565 prevent long comment lines from being outdented, you can add either B<-noll> or
  566 B<-l=0>.
  567 
  568 Setting this flag will prevent perltidy from doing any special operations on
  569 closing side comments.  You may still delete all side comments however when
  570 this flag is in effect.
  571 
  572 
  573 =item B<-enc=s>,  B<--character-encoding=s>
  574 
  575 This flag indicates the character encoding, if any, of the input data stream.
  576 Perltidy does not look for the encoding directives in the soure stream, such
  577 as B<use utf8>, and instead relies on this flag to determine the encoding.
  578 (Note that perltidy often works on snippets of code rather than complete files
  579 so it cannot rely on B<use utf8> directives).
  580 
  581 The possible values for B<s> are (1) the name of an encoding recognized by the
  582 Encode.pm module, (2) B<none> if no encoding is used, or (3) <guess> if
  583 perltidy should guess.  
  584 
  585 For example, the value B<utf8> causes the stream to be read and written as
  586 UTF-8.  If the input stream cannot be decoded with a specified encoding then
  587 processing is not done.  
  588 
  589 The value B<none> causes the stream to be processed without special encoding
  590 assumptions.  This is appropriate for files which are written in single-byte
  591 character encodings such as latin-1.  
  592 
  593 The value B<guess> tells perltidy to guess between either utf8 encoding or no
  594 encoding (meaning one character per byte).  The guess uses the Encode::Guess
  595 module and this restricted range of guesses covers the most common cases.
  596 Testing showed that considering any greater number of encodings as guess
  597 suspects is too risky.
  598 
  599 The current default is B<guess>.  
  600 
  601 The abbreviations B<-utf8> or B<-UTF8> are equivalent to B<-enc=utf8>, and the
  602 abbreviation B<-guess> is equivalent to <-enc=guess>.  So to process a file
  603 named B<file.pl> which is encoded in UTF-8 you can use:
  604 
  605    perltidy -utf8 file.pl
  606 
  607 or
  608    perltidy -guess file.pl
  609 
  610 To process a file in B<euc-jp> you could use
  611 
  612    perltidy -enc=euc-jp file.pl
  613 
  614 A perltidy output file is unencoded if the input file is unencoded, and
  615 otherwise it is encoded as B<utf8>, even if the input encoding was not
  616 B<utf8>.
  617 
  618 =item B<-gcs>,  B<--use-unicode-gcstring>
  619 
  620 This flag controls whether or not perltidy may use module Unicode::GCString to
  621 obtain accurate display widths of wide characters.  The default 
  622 is B<--nouse-unicode-gcstring>.
  623 
  624 If this flag is set, and text is encoded, perltidy will look for the module
  625 Unicode::GCString and, if found, will use it to obtain character display
  626 widths.  This can improve displayed vertical alignment for files with wide
  627 characters.  It is a nice feature but it is off by default to avoid conflicting
  628 formatting when there are multiple developers.  Perltidy installation does not
  629 require Unicode::GCString, so users wanting to use this feature need set this
  630 flag and also to install Unicode::GCString separately.
  631 
  632 If this flag is set and perltidy does not find module Unicode::GCString,
  633 a warning message will be produced and processing will continue but without
  634 the potential benefit provided by the module.
  635 
  636 Also note that actual vertical alignment depends upon the fonts used by the
  637 text display software, so vertical alignment may not be optimal even when
  638 Unicode::GCString is used.
  639 
  640 =item B<-ole=s>,  B<--output-line-ending=s>
  641 
  642 where s=C<win>, C<dos>, C<unix>, or C<mac>.  This flag tells perltidy
  643 to output line endings for a specific system.  Normally,
  644 perltidy writes files with the line separator character of the host
  645 system.  The C<win> and C<dos> flags have an identical result.
  646 
  647 =item B<-ple>,  B<--preserve-line-endings>
  648 
  649 This flag tells perltidy to write its output files with the same line
  650 endings as the input file, if possible.  It should work for
  651 B<dos>, B<unix>, and B<mac> line endings.  It will only work if perltidy
  652 input comes from a filename (rather than stdin, for example).  If
  653 perltidy has trouble determining the input file line ending, it will
  654 revert to the default behavior of using the line ending of the host system.
  655 
  656 =item B<-atnl>,  B<--add-terminal-newline>
  657 
  658 This flag, which is enabled by default, allows perltidy to terminate the last
  659 line of the output stream with a newline character, regardless of whether or
  660 not the input stream was terminated with a newline character.  If this flag is
  661 negated, with B<-natnl>, then perltidy will add a terminal newline to the the
  662 output stream only if the input stream is terminated with a newline.
  663 
  664 Negating this flag may be useful for manipulating one-line scripts intended for
  665 use on a command line.
  666 
  667 =item B<-it=n>,   B<--iterations=n>
  668 
  669 This flag causes perltidy to do B<n> complete iterations.  The reason for this
  670 flag is that code beautification is an iterative process and in some
  671 cases the output from perltidy can be different if it is applied a second time.
  672 For most purposes the default of B<n=1> should be satisfactory.  However B<n=2>
  673 can be useful when a major style change is being made, or when code is being
  674 beautified on check-in to a source code control system.  It has been found to
  675 be extremely rare for the output to change after 2 iterations.  If a value
  676 B<n> is greater than 2 is input then a convergence test will be used to stop
  677 the iterations as soon as possible, almost always after 2 iterations.  See
  678 the next item for a simplified iteration control.
  679 
  680 This flag has no effect when perltidy is used to generate html.
  681 
  682 =item B<-conv>,   B<--converge>
  683 
  684 This flag is equivalent to B<-it=4> and is included to simplify iteration
  685 control.  For all practical purposes one either does or does not want to be
  686 sure that the output is converged, and there is no penalty to using a large
  687 iteration limit since perltidy will check for convergence and stop iterating as
  688 soon as possible.  The default is B<-nconv> (no convergence check).  Using
  689 B<-conv> will approximately double run time since typically one extra iteration
  690 is required to verify convergence.  No extra iterations are required if no new
  691 line breaks are made, and two extra iterations are occasionally needed when
  692 reformatting complex code structures, such as deeply nested ternary statements.
  693 
  694 =back
  695 
  696 =head2 Code Indentation Control
  697 
  698 =over 4
  699 
  700 =item B<-ci=n>, B<--continuation-indentation=n>
  701 
  702 Continuation indentation is extra indentation spaces applied when
  703 a long line is broken.  The default is n=2, illustrated here:
  704 
  705  my $level =   # -ci=2      
  706    ( $max_index_to_go >= 0 ) ? $levels_to_go[0] : $last_output_level;
  707 
  708 The same example, with n=0, is a little harder to read:
  709 
  710  my $level =   # -ci=0    
  711  ( $max_index_to_go >= 0 ) ? $levels_to_go[0] : $last_output_level;
  712 
  713 The value given to B<-ci> is also used by some commands when a small
  714 space is required.  Examples are commands for outdenting labels,
  715 B<-ola>, and control keywords, B<-okw>.  
  716 
  717 When default values are not used, it is recommended that either 
  718 
  719 (1) the value B<n> given with B<-ci=n> be no more than about one-half of the
  720 number of spaces assigned to a full indentation level on the B<-i=n> command, or
  721 
  722 (2) the flag B<-extended-continuation-indentation> is used (see next section).
  723 
  724 =item B<-xci>, B<--extended-continuation-indentation>
  725 
  726 This flag allows perltidy to use some improvements which have been made to its
  727 indentation model. One of the things it does is "extend" continuation
  728 indentation deeper into structures, hence the name.  The improved indentation
  729 is particularly noticeable when the flags B<-ci=n> and B<-i=n> use the same value of
  730 B<n>. There are no significant disadvantages to using this flag, but to avoid
  731 disturbing existing formatting the default is not to use it, B<-nxci>.
  732 
  733 Please see the section L<"B<-pbp>, B<--perl-best-practices>"> for an example of
  734 how this flag can improve the formatting of ternary statements.  It can also
  735 improve indentation of some multi-line qw lists as shown below.
  736 
  737             # perltidy
  738             foreach $color (
  739                 qw(
  740                 AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
  741                 SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
  742                 ),
  743                 qw(
  744                 LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
  745                 SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
  746                 )
  747               )
  748 
  749             # perltidy -xci
  750             foreach $color (
  751                 qw(
  752                     AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
  753                     SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
  754                 ),
  755                 qw(
  756                     LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
  757                     SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
  758                 )
  759               )
  760 
  761 =item B<-sil=n> B<--starting-indentation-level=n>   
  762 
  763 By default, perltidy examines the input file and tries to determine the
  764 starting indentation level.  While it is often zero, it may not be
  765 zero for a code snippet being sent from an editing session.  
  766 
  767 To guess the starting indentation level perltidy simply assumes that
  768 indentation scheme used to create the code snippet is the same as is being used
  769 for the current perltidy process.  This is the only sensible guess that can be
  770 made.  It should be correct if this is true, but otherwise it probably won't.
  771 For example, if the input script was written with -i=2 and the current peltidy
  772 flags have -i=4, the wrong initial indentation will be guessed for a code
  773 snippet which has non-zero initial indentation. Likewise, if an entabbing
  774 scheme is used in the input script and not in the current process then the
  775 guessed indentation will be wrong.
  776 
  777 If the default method does not work correctly, or you want to change the
  778 starting level, use B<-sil=n>, to force the starting level to be n.
  779 
  780 =item B<List indentation> using B<-lp>, B<--line-up-parentheses>
  781 
  782 By default, perltidy indents lists with 4 spaces, or whatever value
  783 is specified with B<-i=n>.  Here is a small list formatted in this way:
  784 
  785     # perltidy (default)
  786     @month_of_year = (
  787         'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
  788         'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
  789     );
  790 
  791 Use the B<-lp> flag to add extra indentation to cause the data to begin
  792 past the opening parentheses of a sub call or list, or opening square
  793 bracket of an anonymous array, or opening curly brace of an anonymous
  794 hash.  With this option, the above list would become:
  795 
  796     # perltidy -lp
  797     @month_of_year = (
  798                        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
  799                        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
  800     );
  801 
  802 If the available line length (see B<-l=n> ) does not permit this much 
  803 space, perltidy will use less.   For alternate placement of the
  804 closing paren, see the next section.
  805 
  806 This option has no effect on code BLOCKS, such as if/then/else blocks,
  807 which always use whatever is specified with B<-i=n>.
  808 
  809 In situations where perltidy does not have complete freedom to choose line
  810 breaks it may temporarily revert to its default indentation method.  This can
  811 occur for example if there are blank lines, block comments, multi-line quotes,
  812 or side comments between the opening and closing parens, braces, or brackets.
  813 
  814 In addition, any parameter which significantly restricts the ability of
  815 perltidy to choose newlines will conflict with B<-lp> and will cause
  816 B<-lp> to be deactivated.  These include B<-io>, B<-fnl>, B<-nanl>, and
  817 B<-ndnl>.  The reason is that the B<-lp> indentation style can require
  818 the careful coordination of an arbitrary number of break points in
  819 hierarchical lists, and these flags may prevent that.
  820 
  821 The B<-lp> option may not be used together with the B<-t> tabs option.
  822 It may, however, be used with the B<-et=n> tab method.
  823 
  824 
  825 =item B<-lpxl=s>,  B<--line-up-parentheses-exclusion-list>
  826 
  827 This is an experimental parameter; the details might change as experience
  828 with it is gained.
  829 
  830 The B<-lp> indentation style works well for some types of coding but can
  831 produce very long lines when variables have long names and/or containers are
  832 very deeply nested.  The B<-lpxl=s> flag is intended to help mitigate this problem by
  833 providing control over the containers to which the B<-lp> indentation style is
  834 applied.  The B<-lp> flag by default is "greedy" and applies to as many
  835 containers as possible.  This flag specifies a list of things which should
  836 B<not> be use B<-lp> indentation.
  837 
  838 This list is a string with space-separated items.  Each item consists of up to
  839 three pieces of information in this order: (1) an optional letter code (2) a
  840 required container type, and (3) an optional numeric code.
  841 
  842 The only required piece of information is a container type, which is one of
  843 '(', '[', or '{'.  For example the string
  844 
  845   -lpxl='[ {'
  846 
  847 means do B<NOT> include use -lp formatting within square-bracets or braces.  The only unspecified
  848 container is '(', so this string means that only the contents within parens will use -lp indentation.
  849 
  850 An optional numeric code may follow any of the container types to further refine the selection based
  851 on container contents.  The numeric codes are:
  852 
  853   '0' or blank: no check on contents
  854   '1' reject -lp unless the contents is a simple list without sublists
  855   '2' reject -lp unless the contents is a simple list without sublists, without
  856       code blocks, and without ternary operators
  857 
  858 For example,
  859 
  860   -lpxl = '[ { (2'
  861 
  862 means only apply -lp to parenthesized lists which do not contain any sublists,
  863 code blocks or ternary expressions.
  864 
  865 A third optional item of information which can be given for parens is an alphanumeric
  866 letter which is used to limit the selection further depending on the type of
  867 token immediately before the paren.  The possible letters are currently 'k',
  868 'K', 'f', 'F', 'w', and 'W', with these meanings:
  869 
  870  'k' matches if the previous nonblank token is a perl builtin keyword (such as 'if', 'while'),
  871  'K' matches if 'k' does not, meaning that the previous token is not a keyword.
  872  'f' matches if the previous token is a function other than a keyword.
  873  'F' matches if 'f' does not.
  874  'w' matches if either 'k' or 'f' match.
  875  'W' matches if 'w' does not.
  876 
  877 For example,
  878 
  879   -lpxl = '[ { F(2'
  880 
  881 means only apply -lp to parenthesized lists which follow a function call and
  882 which do not contain any sublists, code blocks or ternary expressions.  The logic
  883 of writing these codes is somewhat counter-intuitive because they describe what is not
  884 getting the -lp indentation.  So the 'F' indicates that non-function calls are
  885 not getting -lp, or in other words that function calls are getting the -lp indentation.
  886 
  887 =item B<-cti=n>, B<--closing-token-indentation>
  888 
  889 The B<-cti=n> flag controls the indentation of a line beginning with 
  890 a C<)>, C<]>, or a non-block C<}>.  Such a line receives:
  891 
  892  -cti = 0 no extra indentation (default)
  893  -cti = 1 extra indentation such that the closing token
  894         aligns with its opening token.
  895  -cti = 2 one extra indentation level if the line looks like:
  896         );  or  ];  or  };
  897  -cti = 3 one extra indentation level always
  898 
  899 The flags B<-cti=1> and B<-cti=2> work well with the B<-lp> flag (previous
  900 section).
  901 
  902     # perltidy -lp -cti=1
  903     @month_of_year = (
  904                        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
  905                        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
  906                      );
  907 
  908     # perltidy -lp -cti=2
  909     @month_of_year = (
  910                        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
  911                        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
  912                        );
  913 
  914 These flags are merely hints to the formatter and they may not always be
  915 followed.  In particular, if -lp is not being used, the indentation for
  916 B<cti=1> is constrained to be no more than one indentation level.
  917 
  918 If desired, this control can be applied independently to each of the
  919 closing container token types.  In fact, B<-cti=n> is merely an
  920 abbreviation for B<-cpi=n -csbi=n -cbi=n>, where:  
  921 B<-cpi> or B<--closing-paren-indentation> controls B<)>'s,
  922 B<-csbi> or B<--closing-square-bracket-indentation> controls B<]>'s, 
  923 B<-cbi> or B<--closing-brace-indentation> controls non-block B<}>'s. 
  924 
  925 =item B<-icp>, B<--indent-closing-paren>
  926 
  927 The B<-icp> flag is equivalent to
  928 B<-cti=2>, described in the previous section.  The B<-nicp> flag is
  929 equivalent B<-cti=0>.  They are included for backwards compatibility.
  930 
  931 =item B<-icb>, B<--indent-closing-brace>
  932 
  933 The B<-icb> option gives one extra level of indentation to a brace which
  934 terminates a code block .  For example,
  935 
  936         if ($task) {
  937             yyy();
  938             }    # -icb
  939         else {
  940             zzz();
  941             }
  942 
  943 The default is not to do this, indicated by B<-nicb>.
  944 
  945 
  946 =item B<-nib>, B<--non-indenting-braces>
  947 
  948 Normally, lines of code contained within a pair of block braces receive one
  949 additional level of indentation.  This flag, which is enabled by default, 
  950 causes perltidy to look for
  951 opening block braces which are followed by a special side comment. This special
  952 side comment is B<#<<<> by default.  If found, the code between this opening brace and its
  953 corresponding closing brace will not be given the normal extra indentation
  954 level.  For example:
  955 
  956             { #<<<   a closure to contain lexical vars
  957 
  958             my $var;  # this line does not get one level of indentation
  959             ...
  960 
  961             }
  962 
  963             # this line does not 'see' $var;
  964 
  965 This can be useful, for example, when combining code from different files.
  966 Different sections of code can be placed within braces to keep their lexical
  967 variables from being visible to the end of the file.  To keep the new braces
  968 from causing all of their contained code to be indented if you run perltidy,
  969 and possibly introducing new line breaks in long lines, you can mark the
  970 opening braces with this special side comment.
  971 
  972 Only the opening brace needs to be marked, since perltidy knows where the
  973 closing brace is.  Braces contained within marked braces may also be marked
  974 as non-indenting.
  975 
  976 If your code happens to have some opening braces followed by '#<<<', and you
  977 don't want this behavior, you can use B<-nnib> to deactivate it.  To make it
  978 easy to remember, the default string is the same as the string for starting a
  979 B<format-skipping> section. There is no confusion because in that case it is
  980 for a block comment rather than a side-comment. 
  981 
  982 The special side comment can be changed with the next parameter.
  983 
  984 
  985 =item B<-nibp=s>, B<--non-indenting-brace-prefix=s>
  986 
  987 The B<-nibp=string> parameter may be used to change the marker for
  988 non-indenting braces.  The default is equivalent to -nibp='#<<<'.  The string
  989 that you enter must begin with a # and should be in quotes as necessary to get
  990 past the command shell of your system.  This string is the leading text of a
  991 regex pattern that is constructed by appending pre-pending a '^' and appending
  992 a'\s', so you must also include backslashes for characters to be taken
  993 literally rather than as patterns.
  994 
  995 For example, to match the side comment '#++', the parameter would be
  996 
  997   -nibp='#\+\+'
  998 
  999 
 1000 =item B<-olq>, B<--outdent-long-quotes>
 1001 
 1002 When B<-olq> is set, lines which is a quoted string longer than the
 1003 value B<maximum-line-length> will have their indentation removed to make
 1004 them more readable.  This is the default.  To prevent such out-denting,
 1005 use B<-nolq> or B<--nooutdent-long-lines>.
 1006 
 1007 =item B<-oll>, B<--outdent-long-lines>
 1008 
 1009 This command is equivalent to B<--outdent-long-quotes> and
 1010 B<--outdent-long-comments>, and it is included for compatibility with previous
 1011 versions of perltidy.  The negation of this also works, B<-noll> or
 1012 B<--nooutdent-long-lines>, and is equivalent to setting B<-nolq> and B<-nolc>.
 1013 
 1014 =item B<Outdenting Labels:> B<-ola>,  B<--outdent-labels>
 1015 
 1016 This command will cause labels to be outdented by 2 spaces (or whatever B<-ci>
 1017 has been set to), if possible.  This is the default.  For example:
 1018 
 1019         my $i;
 1020       LOOP: while ( $i = <FOTOS> ) {
 1021             chomp($i);
 1022             next unless $i;
 1023             fixit($i);
 1024         }
 1025 
 1026 Use B<-nola> to not outdent labels. 
 1027 
 1028 =item B<Outdenting Keywords>
 1029 
 1030 =over 4
 1031 
 1032 =item B<-okw>,  B<--outdent-keywords>
 1033 
 1034 The command B<-okw> will cause certain leading control keywords to
 1035 be outdented by 2 spaces (or whatever B<-ci> has been set to), if
 1036 possible.  By default, these keywords are C<redo>, C<next>, C<last>,
 1037 C<goto>, and C<return>.  The intention is to make these control keywords
 1038 easier to see.  To change this list of keywords being outdented, see
 1039 the next section.
 1040 
 1041 For example, using C<perltidy -okw> on the previous example gives:
 1042 
 1043         my $i;
 1044       LOOP: while ( $i = <FOTOS> ) {
 1045             chomp($i);
 1046           next unless $i;
 1047             fixit($i);
 1048         }
 1049 
 1050 The default is not to do this.  
 1051 
 1052 =item B<Specifying Outdented Keywords:> B<-okwl=string>,  B<--outdent-keyword-list=string>
 1053 
 1054 This command can be used to change the keywords which are outdented with
 1055 the B<-okw> command.  The parameter B<string> is a required list of perl
 1056 keywords, which should be placed in quotes if there are more than one.
 1057 By itself, it does not cause any outdenting to occur, so the B<-okw>
 1058 command is still required.
 1059 
 1060 For example, the commands C<-okwl="next last redo goto" -okw> will cause
 1061 those four keywords to be outdented.  It is probably simplest to place
 1062 any B<-okwl> command in a F<.perltidyrc> file.
 1063 
 1064 =back
 1065 
 1066 =back
 1067 
 1068 =head2 Whitespace Control
 1069 
 1070 Whitespace refers to the blank space between variables, operators,
 1071 and other code tokens.
 1072 
 1073 =over 4
 1074 
 1075 =item B<-fws>,  B<--freeze-whitespace>
 1076 
 1077 This flag causes your original whitespace to remain unchanged, and
 1078 causes the rest of the whitespace commands in this section, the
 1079 Code Indentation section, and
 1080 the Comment Control section to be ignored.
 1081 
 1082 =item B<Tightness of curly braces, parentheses, and square brackets>
 1083 
 1084 Here the term "tightness" will mean the closeness with which
 1085 pairs of enclosing tokens, such as parentheses, contain the quantities
 1086 within.  A numerical value of 0, 1, or 2 defines the tightness, with
 1087 0 being least tight and 2 being most tight.  Spaces within containers
 1088 are always symmetric, so if there is a space after a C<(> then there
 1089 will be a space before the corresponding C<)>.
 1090 
 1091 The B<-pt=n> or B<--paren-tightness=n> parameter controls the space within
 1092 parens.  The example below shows the effect of the three possible
 1093 values, 0, 1, and 2:
 1094 
 1095  if ( ( my $len_tab = length( $tabstr ) ) > 0 ) {  # -pt=0
 1096  if ( ( my $len_tab = length($tabstr) ) > 0 ) {    # -pt=1 (default)
 1097  if ((my $len_tab = length($tabstr)) > 0) {        # -pt=2
 1098 
 1099 When n is 0, there is always a space to the right of a '(' and to the left
 1100 of a ')'.  For n=2 there is never a space.  For n=1, the default, there
 1101 is a space unless the quantity within the parens is a single token, such
 1102 as an identifier or quoted string.  
 1103 
 1104 Likewise, the parameter B<-sbt=n> or B<--square-bracket-tightness=n>
 1105 controls the space within square brackets, as illustrated below.
 1106 
 1107  $width = $col[ $j + $k ] - $col[ $j ];  # -sbt=0
 1108  $width = $col[ $j + $k ] - $col[$j];    # -sbt=1 (default)
 1109  $width = $col[$j + $k] - $col[$j];      # -sbt=2 
 1110 
 1111 Curly braces which do not contain code blocks are controlled by
 1112 the parameter B<-bt=n> or B<--brace-tightness=n>. 
 1113 
 1114  $obj->{ $parsed_sql->{ 'table' }[0] };    # -bt=0
 1115  $obj->{ $parsed_sql->{'table'}[0] };      # -bt=1 (default)
 1116  $obj->{$parsed_sql->{'table'}[0]};        # -bt=2
 1117 
 1118 And finally, curly braces which contain blocks of code are controlled by the
 1119 parameter B<-bbt=n> or B<--block-brace-tightness=n> as illustrated in the
 1120 example below.   
 1121 
 1122  %bf = map { $_ => -M $_ } grep { /\.deb$/ } dirents '.'; # -bbt=0 (default)
 1123  %bf = map { $_ => -M $_ } grep {/\.deb$/} dirents '.';   # -bbt=1
 1124  %bf = map {$_ => -M $_} grep {/\.deb$/} dirents '.';     # -bbt=2
 1125 
 1126 To simplify input in the case that all of the tightness flags have the same
 1127 value <n>, the parameter <-act=n> or B<--all-containers-tightness=n> is an
 1128 abbreviation for the combination <-pt=n -sbt=n -bt=n -bbt=n>.
 1129 
 1130 
 1131 =item B<-tso>,   B<--tight-secret-operators>
 1132 
 1133 The flag B<-tso> causes certain perl token sequences (secret operators)
 1134 which might be considered to be a single operator to be formatted "tightly"
 1135 (without spaces).  The operators currently modified by this flag are: 
 1136 
 1137      0+  +0  ()x!! ~~<>  ,=>   =( )=  
 1138 
 1139 For example the sequence B<0 +>,  which converts a string to a number,
 1140 would be formatted without a space: B<0+> when the B<-tso> flag is set.  This
 1141 flag is off by default.
 1142 
 1143 =item B<-sts>,   B<--space-terminal-semicolon>
 1144 
 1145 Some programmers prefer a space before all terminal semicolons.  The
 1146 default is for no such space, and is indicated with B<-nsts> or
 1147 B<--nospace-terminal-semicolon>.
 1148 
 1149     $i = 1 ;     #  -sts
 1150     $i = 1;      #  -nsts   (default)
 1151 
 1152 =item B<-sfs>,   B<--space-for-semicolon>
 1153 
 1154 Semicolons within B<for> loops may sometimes be hard to see,
 1155 particularly when commas are also present.  This option places spaces on
 1156 both sides of these special semicolons, and is the default.  Use
 1157 B<-nsfs> or B<--nospace-for-semicolon> to deactivate it.
 1158 
 1159  for ( @a = @$ap, $u = shift @a ; @a ; $u = $v ) {  # -sfs (default)
 1160  for ( @a = @$ap, $u = shift @a; @a; $u = $v ) {    # -nsfs
 1161 
 1162 =item B<-asc>,  B<--add-semicolons>
 1163 
 1164 Setting B<-asc> allows perltidy to add any missing optional semicolon at the end 
 1165 of a line which is followed by a closing curly brace on the next line.  This
 1166 is the default, and may be deactivated with B<-nasc> or B<--noadd-semicolons>.
 1167 
 1168 =item B<-dsm>,  B<--delete-semicolons>
 1169 
 1170 Setting B<-dsm> allows perltidy to delete extra semicolons which are
 1171 simply empty statements.  This is the default, and may be deactivated
 1172 with B<-ndsm> or B<--nodelete-semicolons>.  (Such semicolons are not
 1173 deleted, however, if they would promote a side comment to a block
 1174 comment).
 1175 
 1176 =item B<-aws>,  B<--add-whitespace>
 1177 
 1178 Setting this option allows perltidy to add certain whitespace to improve
 1179 code readability.  This is the default. If you do not want any
 1180 whitespace added, but are willing to have some whitespace deleted, use
 1181 B<-naws>.  (Use B<-fws> to leave whitespace completely unchanged).
 1182 
 1183 =item B<-dws>,  B<--delete-old-whitespace>
 1184 
 1185 Setting this option allows perltidy to remove some old whitespace
 1186 between characters, if necessary.  This is the default.  If you
 1187 do not want any old whitespace removed, use B<-ndws> or
 1188 B<--nodelete-old-whitespace>.
 1189 
 1190 =item B<Detailed whitespace controls around tokens>
 1191 
 1192 For those who want more detailed control over the whitespace around
 1193 tokens, there are four parameters which can directly modify the default
 1194 whitespace rules built into perltidy for any token.  They are:
 1195 
 1196 B<-wls=s> or B<--want-left-space=s>,
 1197 
 1198 B<-nwls=s> or B<--nowant-left-space=s>,
 1199 
 1200 B<-wrs=s> or B<--want-right-space=s>,
 1201 
 1202 B<-nwrs=s> or B<--nowant-right-space=s>.
 1203 
 1204 These parameters are each followed by a quoted string, B<s>, containing a
 1205 list of token types.  No more than one of each of these parameters
 1206 should be specified, because repeating a command-line parameter
 1207 always overwrites the previous one before perltidy ever sees it.
 1208 
 1209 To illustrate how these are used, suppose it is desired that there be no
 1210 space on either side of the token types B<= + - / *>.  The following two
 1211 parameters would specify this desire:
 1212 
 1213   -nwls="= + - / *"    -nwrs="= + - / *"
 1214 
 1215 (Note that the token types are in quotes, and that they are separated by
 1216 spaces).  With these modified whitespace rules, the following line of math:
 1217 
 1218   $root = -$b + sqrt( $b * $b - 4. * $a * $c ) / ( 2. * $a );
 1219 
 1220 becomes this:
 1221 
 1222   $root=-$b+sqrt( $b*$b-4.*$a*$c )/( 2.*$a );
 1223 
 1224 These parameters should be considered to be hints to perltidy rather
 1225 than fixed rules, because perltidy must try to resolve conflicts that
 1226 arise between them and all of the other rules that it uses.  One
 1227 conflict that can arise is if, between two tokens, the left token wants
 1228 a space and the right one doesn't.  In this case, the token not wanting
 1229 a space takes priority.  
 1230 
 1231 It is necessary to have a list of all token types in order to create
 1232 this type of input.  Such a list can be obtained by the command
 1233 B<--dump-token-types>.  Also try the B<-D> flag on a short snippet of code
 1234 and look at the .DEBUG file to see the tokenization. 
 1235 
 1236 B<WARNING> Be sure to put these tokens in quotes to avoid having them
 1237 misinterpreted by your command shell.
 1238 
 1239 =item B<Note1: Perltidy does always follow whitespace controls>
 1240 
 1241 The various parameters controlling whitespace within a program are requests which perltidy follows as well as possible, but there are a number of situations where changing whitespace could change program behavior and is not done.  Some of these are obvious; for example, we should not remove the space between the two plus symbols in '$x+ +$y' to avoid creating a '++' operator. Some are more subtle and involve the whitespace around bareword symbols and locations of possible filehandles.  For example, consider the problem of formatting the following subroutine:
 1242 
 1243    sub print_div {
 1244       my ($x,$y)=@_;
 1245       print $x/$y;
 1246    }
 1247 
 1248 Suppose the user requests that / signs have a space to the left but not to the right. Perltidy will refuse to do this, but if this were done the result would be
 1249 
 1250    sub print_div {
 1251        my ($x,$y)=@_;
 1252        print $x /$y;
 1253    }
 1254 
 1255 If formatted in this way, the program will not run (at least with recent versions of perl) because the $x is taken to be a filehandle and / is assumed to start a quote. In a complex program, there might happen to be a / which terminates the multiline quote without a syntax error, allowing the program to run, but not as intended.
 1256 
 1257 Related issues arise with other binary operator symbols, such as + and -, and in older versions of perl there could be problems with ternary operators.  So to avoid changing program behavior, perltidy has the simple rule that whitespace around possible filehandles is left unchanged.  Likewise, whitespace around barewords is left unchanged.  The reason is that if the barewords are defined in other modules, or in code that has not even been written yet, perltidy will not have seen their prototypes and must treat them cautiously.
 1258 
 1259 In perltidy this is implemented in the tokenizer by marking token following a
 1260 B<print> keyword as a special type B<Z>.  When formatting is being done,
 1261 whitespace following this token type is generally left unchanged as a precaution
 1262 against changing program behavior.  This is excessively conservative but simple
 1263 and easy to implement.  Keywords which are treated similarly to B<print> include
 1264 B<printf>, B<sort>, B<exec>, B<system>.  Changes in spacing around parameters
 1265 following these keywords may have to be made manually.  For example, the space,
 1266 or lack of space, after the parameter $foo in the following line will be
 1267 unchanged in formatting.
 1268 
 1269    system($foo );
 1270    system($foo);
 1271 
 1272 To find if a token is of type B<Z> you can use B<perltidy -DEBUG>. For the 
 1273 first line above the result is
 1274 
 1275    1: system($foo );
 1276    1: kkkkkk{ZZZZb};
 1277 
 1278 which shows that B<system> is type B<k> (keyword) and $foo is type B<Z>.
 1279 
 1280 =item B<Note2: Perltidy's whitespace rules are not perfect>
 1281 
 1282 Despite these precautions, it is still possible to introduce syntax errors with
 1283 some asymmetric whitespace rules, particularly when call parameters are not
 1284 placed in containing parens or braces.  For example, the following two lines will
 1285 be parsed by perl without a syntax error:
 1286 
 1287   # original programming, syntax ok
 1288   my @newkeys = map $_-$nrecs+@data, @oldkeys;
 1289 
 1290   # perltidy default, syntax ok
 1291   my @newkeys = map $_ - $nrecs + @data, @oldkeys;
 1292 
 1293 But the following will give a syntax error:
 1294 
 1295   # perltidy -nwrs='-'
 1296   my @newkeys = map $_ -$nrecs + @data, @oldkeys;
 1297 
 1298 For another example, the following two lines will be parsed without syntax error:
 1299 
 1300   # original programming, syntax ok
 1301   for my $severity ( reverse $SEVERITY_LOWEST+1 .. $SEVERITY_HIGHEST ) { ...  }
 1302 
 1303   # perltidy default, syntax ok
 1304   for my $severity ( reverse $SEVERITY_LOWEST + 1 .. $SEVERITY_HIGHEST ) { ... }
 1305 
 1306 But the following will give a syntax error:
 1307 
 1308   # perltidy -nwrs='+', syntax error:
 1309   for my $severity ( reverse $SEVERITY_LOWEST +1 .. $SEVERITY_HIGHEST ) { ... }
 1310 
 1311 To avoid subtle parsing problems like this, it is best to avoid spacing a
 1312 binary operator asymetrically with a space on the left but not on the right.
 1313 
 1314 =item B<Space between specific keywords and opening paren>
 1315 
 1316 When an opening paren follows a Perl keyword, no space is introduced after the
 1317 keyword, unless it is (by default) one of these:
 1318 
 1319    my local our and or xor eq ne if else elsif until unless 
 1320    while for foreach return switch case given when
 1321 
 1322 These defaults can be modified with two commands:
 1323 
 1324 B<-sak=s>  or B<--space-after-keyword=s>  adds keywords.
 1325 
 1326 B<-nsak=s>  or B<--nospace-after-keyword=s>  removes keywords.
 1327 
 1328 where B<s> is a list of keywords (in quotes if necessary).  For example, 
 1329 
 1330   my ( $a, $b, $c ) = @_;    # default
 1331   my( $a, $b, $c ) = @_;     # -nsak="my local our"
 1332 
 1333 The abbreviation B<-nsak='*'> is equivalent to including all of the
 1334 keywords in the above list.
 1335 
 1336 When both B<-nsak=s> and B<-sak=s> commands are included, the B<-nsak=s>
 1337 command is executed first.  For example, to have space after only the
 1338 keywords (my, local, our) you could use B<-nsak="*" -sak="my local our">.
 1339 
 1340 To put a space after all keywords, see the next item.
 1341 
 1342 =item B<Space between all keywords and opening parens>
 1343 
 1344 When an opening paren follows a function or keyword, no space is introduced
 1345 after the keyword except for the keywords noted in the previous item.  To
 1346 always put a space between a function or keyword and its opening paren,
 1347 use the command:
 1348 
 1349 B<-skp>  or B<--space-keyword-paren>
 1350 
 1351 You may also want to use the flag B<-sfp> (next item) too.
 1352 
 1353 =item B<Space between all function names and opening parens>
 1354 
 1355 When an opening paren follows a function the default and recommended formatting
 1356 is not to introduce a space.  To cause a space to be introduced use:
 1357 
 1358 B<-sfp>  or B<--space-function-paren>
 1359 
 1360   myfunc( $a, $b, $c );    # default 
 1361   myfunc ( $a, $b, $c );   # -sfp
 1362 
 1363 You will probably also want to use the flag B<-skp> (previous item) too.
 1364 
 1365 The reason this is not recommended is that spacing a function paren can make a
 1366 program vulnerable to parsing problems by Perl.  For example, the following
 1367 two-line program will run as written but will have a syntax error if
 1368 reformatted with -sfp:
 1369 
 1370   if ( -e filename() ) { print "I'm here\n"; }
 1371   sub filename { return $0 }
 1372 
 1373 In this particular case the syntax error can be removed if the line order is
 1374 reversed, so that Perl parses 'sub filename' first. 
 1375 
 1376 =item B<-fpva>  or B<--function-paren-vertical-alignment>
 1377 
 1378 A side-effect of using the B<-sfp> flag is that the parens may become vertically
 1379 aligned. For example,
 1380 
 1381     # perltidy -sfp
 1382     myfun     ( $aaa, $b, $cc );
 1383     mylongfun ( $a, $b, $c );
 1384 
 1385 This is the default behavior.  To prevent this alignment use B<-nfpva>:
 1386 
 1387     # perltidy -sfp -nfpva
 1388     myfun ( $aaa, $b, $cc );
 1389     mylongfun ( $a, $b, $c );
 1390 
 1391 =item B<-spp=n>  or B<--space-prototype-paren=n>
 1392 
 1393 This flag can be used to control whether a function prototype is preceded by a space.  For example, the following prototype does not have a space.
 1394 
 1395       sub usage();
 1396 
 1397 This integer B<n> may have the value 0, 1, or 2 as follows:
 1398 
 1399     -spp=0 means no space before the paren
 1400     -spp=1 means follow the example of the source code [DEFAULT]
 1401     -spp=2 means always put a space before the paren
 1402 
 1403 The default is B<-spp=1>, meaning that a space will be used if and only if there is one in the source code.  Given the above line of code, the result of
 1404 applying the different options would be:
 1405 
 1406         sub usage();    # n=0 [no space]
 1407         sub usage();    # n=1 [default; follows input]
 1408         sub usage ();   # n=2 [space]
 1409 
 1410 =item B<-kpit=n> or B<--keyword-paren-inner-tightness=n>
 1411 
 1412 The space inside of an opening paren, which itself follows a certain keyword,
 1413 can be controlled by this parameter.  The space on the inside of the
 1414 corresponding closing paren will be treated in the same (balanced) manner.
 1415 This parameter has precedence over any other paren spacing rules.  The values
 1416 of B<n> are as follows:
 1417 
 1418    -kpit=0 means always put a space (not tight)
 1419    -kpit=1 means ignore this parameter [default]
 1420    -kpit=2 means never put a space (tight)
 1421 
 1422 To illustrate, the following snippet is shown formatted in three ways:
 1423 
 1424     if ( seek( DATA, 0, 0 ) ) { ... }    # perltidy (default)
 1425     if (seek(DATA, 0, 0)) { ... }        # perltidy -pt=2
 1426     if ( seek(DATA, 0, 0) ) { ... }      # perltidy -pt=2 -kpit=0
 1427 
 1428 In the second case the -pt=2 parameter makes all of the parens tight. In the
 1429 third case the -kpit=0 flag causes the space within the 'if' parens to have a
 1430 space, since 'if' is one of the keywords to which the -kpit flag applies by
 1431 default.  The remaining parens are still tight because of the -pt=2 parameter.
 1432 
 1433 The set of keywords to which this parameter applies are by default are:
 1434 
 1435    if elsif unless while until for foreach
 1436 
 1437 These can be changed with the parameter B<-kpitl=s> described in the next section. 
 1438 
 1439 
 1440 =item B<-kpitl=string> or B<--keyword-paren-inner-tightness=string>
 1441 
 1442 This command can be used to change the keywords to which the the B<-kpit=n>
 1443 command applies.  The parameter B<string> is a required list either keywords or
 1444 functions, which should be placed in quotes if there are more than one.  By
 1445 itself, this parameter does not cause any change in spacing, so the B<-kpit=n>
 1446 command is still required.
 1447 
 1448 For example, the commands C<-kpitl="if else while" -kpit=2> will cause the just
 1449 the spaces inside parens following  'if', 'else', and 'while' keywords to
 1450 follow the tightness value indicated by the B<-kpit=2> flag.
 1451 
 1452 =item B<-lop>  or B<--logical-padding>
 1453 
 1454 In the following example some extra space has been inserted on the second
 1455 line between the two open parens. This extra space is called "logical padding"
 1456 and is intended to help align similar things vertically in some logical
 1457 or ternary expressions.  
 1458 
 1459     # perltidy [default formatting] 
 1460     $same =
 1461       (      ( $aP eq $bP )
 1462           && ( $aS eq $bS )
 1463           && ( $aT eq $bT )
 1464           && ( $a->{'title'} eq $b->{'title'} )
 1465           && ( $a->{'href'} eq $b->{'href'} ) );
 1466 
 1467 Note that this is considered to be a different operation from "vertical
 1468 alignment" because space at just one line is being adjusted, whereas in
 1469 "vertical alignment" the spaces at all lines are being adjusted. So it sort of
 1470 a local version of vertical alignment.
 1471 
 1472 Here is an example involving a ternary operator:
 1473 
 1474     # perltidy [default formatting] 
 1475     $bits =
 1476         $top > 0xffff ? 32
 1477       : $top > 0xff   ? 16
 1478       : $top > 1      ? 8
 1479       :                 1;
 1480 
 1481 This behavior is controlled with the flag B<--logical-padding>, which is set
 1482 'on' by default.  If it is not desired it can be turned off using
 1483 B<--nological-padding> or B<-nlop>.  The above two examples become, with
 1484 B<-nlop>:
 1485 
 1486     # perltidy -nlop
 1487     $same =
 1488       ( ( $aP eq $bP )
 1489           && ( $aS eq $bS )
 1490           && ( $aT eq $bT )
 1491           && ( $a->{'title'} eq $b->{'title'} )
 1492           && ( $a->{'href'} eq $b->{'href'} ) );
 1493 
 1494     # perltidy -nlop
 1495     $bits =
 1496       $top > 0xffff ? 32
 1497       : $top > 0xff ? 16
 1498       : $top > 1    ? 8
 1499       :               1;
 1500 
 1501 
 1502 =item B<Trimming whitespace around C<qw> quotes>
 1503 
 1504 B<-tqw> or B<--trim-qw> provide the default behavior of trimming
 1505 spaces around multi-line C<qw> quotes and indenting them appropriately.
 1506 
 1507 B<-ntqw> or B<--notrim-qw> cause leading and trailing whitespace around
 1508 multi-line C<qw> quotes to be left unchanged.  This option will not
 1509 normally be necessary, but was added for testing purposes, because in
 1510 some versions of perl, trimming C<qw> quotes changes the syntax tree.
 1511 
 1512 =item B<-sbq=n>  or B<--space-backslash-quote=n>
 1513 
 1514 lines like
 1515 
 1516        $str1=\"string1";
 1517        $str2=\'string2';
 1518 
 1519 can confuse syntax highlighters unless a space is included between the backslash and the single or double quotation mark.
 1520 
 1521 this can be controlled with the value of B<n> as follows:
 1522 
 1523     -sbq=0 means no space between the backslash and quote
 1524     -sbq=1 means follow the example of the source code
 1525     -sbq=2 means always put a space between the backslash and quote
 1526 
 1527 The default is B<-sbq=1>, meaning that a space will be used if there is one in the source code.
 1528 
 1529 =item B<Trimming trailing whitespace from lines of POD>
 1530 
 1531 B<-trp> or B<--trim-pod> will remove trailing whitespace from lines of POD.
 1532 The default is not to do this.
 1533 
 1534 =back
 1535 
 1536 =head2 Comment Controls
 1537 
 1538 Perltidy has a number of ways to control the appearance of both block comments
 1539 and side comments.  The term B<block comment> here refers to a full-line
 1540 comment, whereas B<side comment> will refer to a comment which appears on a
 1541 line to the right of some code.
 1542 
 1543 =over 4
 1544 
 1545 =item B<-ibc>,  B<--indent-block-comments>
 1546 
 1547 Block comments normally look best when they are indented to the same
 1548 level as the code which follows them.  This is the default behavior, but
 1549 you may use B<-nibc> to keep block comments left-justified.  Here is an
 1550 example:
 1551 
 1552              # this comment is indented      (-ibc, default)
 1553          if ($task) { yyy(); }
 1554 
 1555 The alternative is B<-nibc>:
 1556 
 1557  # this comment is not indented              (-nibc)
 1558          if ($task) { yyy(); }
 1559 
 1560 See also the next item, B<-isbc>, as well as B<-sbc>, for other ways to
 1561 have some indented and some outdented block comments.
 1562 
 1563 =item B<-isbc>,  B<--indent-spaced-block-comments>
 1564 
 1565 If there is no leading space on the line, then the comment will not be
 1566 indented, and otherwise it may be.
 1567 
 1568 If both B<-ibc> and B<-isbc> are set, then B<-isbc> takes priority.
 1569 
 1570 =item B<-olc>, B<--outdent-long-comments>
 1571 
 1572 When B<-olc> is set, lines which are full-line (block) comments longer
 1573 than the value B<maximum-line-length> will have their indentation
 1574 removed.  This is the default; use B<-nolc> to prevent outdenting.
 1575 
 1576 =item B<-msc=n>,  B<--minimum-space-to-comment=n>
 1577 
 1578 Side comments look best when lined up several spaces to the right of
 1579 code.  Perltidy will try to keep comments at least n spaces to the
 1580 right.  The default is n=4 spaces.
 1581 
 1582 =item B<-fpsc=n>,  B<--fixed-position-side-comment=n>
 1583 
 1584 This parameter tells perltidy to line up side comments in column number B<n>
 1585 whenever possible.  The default, n=0, will not do this.
 1586 
 1587 =item B<-iscl>,  B<--ignore-side-comment-lengths>
 1588 
 1589 This parameter causes perltidy to ignore the length of side comments when
 1590 setting line breaks.  The default, B<-niscl>, is to include the length of 
 1591 side comments when breaking lines to stay within the length prescribed
 1592 by the B<-l=n> maximum line length parameter.  For example, the following
 1593 long single line would remain intact with -l=80 and -iscl:
 1594 
 1595      perltidy -l=80 -iscl
 1596         $vmsfile =~ s/;[\d\-]*$//; # Clip off version number; we can use a newer version as well
 1597 
 1598 whereas without the -iscl flag the line will be broken:
 1599 
 1600      perltidy -l=80
 1601         $vmsfile =~ s/;[\d\-]*$//
 1602           ;    # Clip off version number; we can use a newer version as well
 1603    
 1604 
 1605 =item B<-hsc>, B<--hanging-side-comments>
 1606 
 1607 By default, perltidy tries to identify and align "hanging side
 1608 comments", which are something like this:
 1609 
 1610         my $IGNORE = 0;    # This is a side comment
 1611                            # This is a hanging side comment
 1612                            # And so is this
 1613 
 1614 A comment is considered to be a hanging side comment if (1) it immediately
 1615 follows a line with a side comment, or another hanging side comment, and
 1616 (2) there is some leading whitespace on the line.
 1617 To deactivate this feature, use B<-nhsc> or B<--nohanging-side-comments>.  
 1618 If block comments are preceded by a blank line, or have no leading
 1619 whitespace, they will not be mistaken as hanging side comments.
 1620 
 1621 =item B<Closing Side Comments>
 1622 
 1623 A closing side comment is a special comment which perltidy can
 1624 automatically create and place after the closing brace of a code block.
 1625 They can be useful for code maintenance and debugging.  The command
 1626 B<-csc> (or B<--closing-side-comments>) adds or updates closing side
 1627 comments.  For example, here is a small code snippet
 1628 
 1629         sub message {
 1630             if ( !defined( $_[0] ) ) {
 1631                 print("Hello, World\n");
 1632             }
 1633             else {
 1634                 print( $_[0], "\n" );
 1635             }
 1636         }
 1637 
 1638 And here is the result of processing with C<perltidy -csc>:
 1639 
 1640         sub message {
 1641             if ( !defined( $_[0] ) ) {
 1642                 print("Hello, World\n");
 1643             }
 1644             else {
 1645                 print( $_[0], "\n" );
 1646             }
 1647         } ## end sub message
 1648 
 1649 A closing side comment was added for C<sub message> in this case, but not
 1650 for the C<if> and C<else> blocks, because they were below the 6 line
 1651 cutoff limit for adding closing side comments.  This limit may be
 1652 changed with the B<-csci> command, described below.
 1653 
 1654 The command B<-dcsc> (or B<--delete-closing-side-comments>) reverses this 
 1655 process and removes these comments.
 1656 
 1657 Several commands are available to modify the behavior of these two basic
 1658 commands, B<-csc> and B<-dcsc>:
 1659 
 1660 =over 4
 1661 
 1662 =item B<-csci=n>, or B<--closing-side-comment-interval=n> 
 1663 
 1664 where C<n> is the minimum number of lines that a block must have in
 1665 order for a closing side comment to be added.  The default value is
 1666 C<n=6>.  To illustrate:
 1667 
 1668         # perltidy -csci=2 -csc
 1669         sub message {
 1670             if ( !defined( $_[0] ) ) {
 1671                 print("Hello, World\n");
 1672             } ## end if ( !defined( $_[0] ))
 1673             else {
 1674                 print( $_[0], "\n" );
 1675             } ## end else [ if ( !defined( $_[0] ))
 1676         } ## end sub message
 1677 
 1678 Now the C<if> and C<else> blocks are commented.  However, now this has
 1679 become very cluttered.
 1680 
 1681 =item B<-cscp=string>, or B<--closing-side-comment-prefix=string> 
 1682 
 1683 where string is the prefix used before the name of the block type.  The
 1684 default prefix, shown above, is C<## end>.  This string will be added to
 1685 closing side comments, and it will also be used to recognize them in
 1686 order to update, delete, and format them.  Any comment identified as a
 1687 closing side comment will be placed just a single space to the right of
 1688 its closing brace.
 1689 
 1690 =item B<-cscl=string>, or B<--closing-side-comment-list> 
 1691 
 1692 where C<string> is a list of block types to be tagged with closing side
 1693 comments.  By default, all code block types preceded by a keyword or
 1694 label (such as C<if>, C<sub>, and so on) will be tagged.  The B<-cscl>
 1695 command changes the default list to be any selected block types; see
 1696 L<Specifying Block Types>.
 1697 For example, the following command
 1698 requests that only C<sub>'s, labels, C<BEGIN>, and C<END> blocks be
 1699 affected by any B<-csc> or B<-dcsc> operation:
 1700 
 1701    -cscl="sub : BEGIN END"
 1702 
 1703 =item B<-csct=n>, or B<--closing-side-comment-maximum-text=n> 
 1704 
 1705 The text appended to certain block types, such as an C<if> block, is
 1706 whatever lies between the keyword introducing the block, such as C<if>,
 1707 and the opening brace.  Since this might be too much text for a side
 1708 comment, there needs to be a limit, and that is the purpose of this
 1709 parameter.  The default value is C<n=20>, meaning that no additional
 1710 tokens will be appended to this text after its length reaches 20
 1711 characters.  Omitted text is indicated with C<...>.  (Tokens, including
 1712 sub names, are never truncated, however, so actual lengths may exceed
 1713 this).  To illustrate, in the above example, the appended text of the
 1714 first block is C< ( !defined( $_[0] )...>.  The existing limit of
 1715 C<n=20> caused this text to be truncated, as indicated by the C<...>.  See
 1716 the next flag for additional control of the abbreviated text.
 1717 
 1718 =item B<-cscb>, or B<--closing-side-comments-balanced> 
 1719 
 1720 As discussed in the previous item, when the
 1721 closing-side-comment-maximum-text limit is exceeded the comment text must
 1722 be truncated.  Older versions of perltidy terminated with three dots, and this
 1723 can still be achieved with -ncscb:
 1724 
 1725   perltidy -csc -ncscb
 1726   } ## end foreach my $foo (sort { $b cmp $a ...
 1727 
 1728 However this causes a problem with editors which cannot recognize
 1729 comments or are not configured to do so because they cannot "bounce" around in
 1730 the text correctly.  The B<-cscb> flag has been added to
 1731 help them by appending appropriate balancing structure:
 1732 
 1733   perltidy -csc -cscb
 1734   } ## end foreach my $foo (sort { $b cmp $a ... })
 1735 
 1736 The default is B<-cscb>.
 1737 
 1738 =item B<-csce=n>, or B<--closing-side-comment-else-flag=n> 
 1739 
 1740 The default, B<n=0>, places the text of the opening C<if> statement after any
 1741 terminal C<else>.
 1742 
 1743 If B<n=2> is used, then each C<elsif> is also given the text of the opening
 1744 C<if> statement.  Also, an C<else> will include the text of a preceding
 1745 C<elsif> statement.  Note that this may result some long closing
 1746 side comments.
 1747 
 1748 If B<n=1> is used, the results will be the same as B<n=2> whenever the
 1749 resulting line length is less than the maximum allowed.
 1750 
 1751 =item B<-cscb>, or B<--closing-side-comments-balanced> 
 1752 
 1753 When using closing-side-comments, and the closing-side-comment-maximum-text
 1754 limit is exceeded, then the comment text must be abbreviated.  
 1755 It is terminated with three dots if the B<-cscb> flag is negated:
 1756 
 1757   perltidy -csc -ncscb
 1758   } ## end foreach my $foo (sort { $b cmp $a ...
 1759 
 1760 This causes a problem with older editors which do not recognize comments
 1761 because they cannot "bounce" around in the text correctly.  The B<-cscb>
 1762 flag tries to help them by appending appropriate terminal balancing structures:
 1763 
 1764   perltidy -csc -cscb
 1765   } ## end foreach my $foo (sort { $b cmp $a ... })
 1766 
 1767 The default is B<-cscb>.  
 1768 
 1769 
 1770 =item B<-cscw>, or B<--closing-side-comment-warnings> 
 1771 
 1772 This parameter is intended to help make the initial transition to the use of
 1773 closing side comments.  
 1774 It causes two
 1775 things to happen if a closing side comment replaces an existing, different
 1776 closing side comment:  first, an error message will be issued, and second, the
 1777 original side comment will be placed alone on a new specially marked comment
 1778 line for later attention. 
 1779 
 1780 The intent is to avoid clobbering existing hand-written side comments
 1781 which happen to match the pattern of closing side comments. This flag
 1782 should only be needed on the first run with B<-csc>.
 1783 
 1784 =back
 1785 
 1786 B<Important Notes on Closing Side Comments:> 
 1787 
 1788 =over 4
 1789 
 1790 =item *
 1791 
 1792 Closing side comments are only placed on lines terminated with a closing
 1793 brace.  Certain closing styles, such as the use of cuddled elses
 1794 (B<-ce>), preclude the generation of some closing side comments.
 1795 
 1796 =item *
 1797 
 1798 Please note that adding or deleting of closing side comments takes
 1799 place only through the commands B<-csc> or B<-dcsc>.  The other commands,
 1800 if used, merely modify the behavior of these two commands.  
 1801 
 1802 =item *
 1803 
 1804 It is recommended that the B<-cscw> flag be used along with B<-csc> on
 1805 the first use of perltidy on a given file.  This will prevent loss of
 1806 any existing side comment data which happens to have the csc prefix.
 1807 
 1808 =item *
 1809 
 1810 Once you use B<-csc>, you should continue to use it so that any
 1811 closing side comments remain correct as code changes.  Otherwise, these
 1812 comments will become incorrect as the code is updated.
 1813 
 1814 =item *
 1815 
 1816 If you edit the closing side comments generated by perltidy, you must also
 1817 change the prefix to be different from the closing side comment prefix.
 1818 Otherwise, your edits will be lost when you rerun perltidy with B<-csc>.   For
 1819 example, you could simply change C<## end> to be C<## End>, since the test is
 1820 case sensitive.  You may also want to use the B<-ssc> flag to keep these
 1821 modified closing side comments spaced the same as actual closing side comments.
 1822 
 1823 =item *
 1824 
 1825 Temporarily generating closing side comments is a useful technique for
 1826 exploring and/or debugging a perl script, especially one written by someone
 1827 else.  You can always remove them with B<-dcsc>.
 1828 
 1829 =back
 1830 
 1831 =item B<Static Block Comments>
 1832 
 1833 Static block comments are block comments with a special leading pattern,
 1834 C<##> by default, which will be treated slightly differently from other
 1835 block comments.  They effectively behave as if they had glue along their
 1836 left and top edges, because they stick to the left edge and previous line
 1837 when there is no blank spaces in those places.  This option is
 1838 particularly useful for controlling how commented code is displayed.
 1839 
 1840 =over 4
 1841 
 1842 =item B<-sbc>, B<--static-block-comments>
 1843 
 1844 When B<-sbc> is used, a block comment with a special leading pattern, C<##> by
 1845 default, will be treated specially. 
 1846 
 1847 Comments so identified  are treated as follows: 
 1848 
 1849 =over 4
 1850 
 1851 =item *
 1852 
 1853 If there is no leading space on the line, then the comment will not
 1854 be indented, and otherwise it may be,
 1855 
 1856 =item *
 1857 
 1858 no new blank line will be
 1859 inserted before such a comment, and 
 1860 
 1861 =item *
 1862 
 1863 such a comment will never become
 1864 a hanging side comment.  
 1865 
 1866 =back
 1867 
 1868 For example, assuming C<@month_of_year> is
 1869 left-adjusted:
 1870 
 1871     @month_of_year = (    # -sbc (default)
 1872         'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
 1873     ##  'Dec', 'Nov'
 1874         'Nov', 'Dec');
 1875 
 1876 Without this convention, the above code would become
 1877 
 1878     @month_of_year = (   # -nsbc
 1879         'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
 1880   
 1881         ##  'Dec', 'Nov'
 1882         'Nov', 'Dec'
 1883     );
 1884 
 1885 which is not as clear.
 1886 The default is to use B<-sbc>.  This may be deactivated with B<-nsbc>.
 1887 
 1888 =item B<-sbcp=string>, B<--static-block-comment-prefix=string>
 1889 
 1890 This parameter defines the prefix used to identify static block comments
 1891 when the B<-sbc> parameter is set.  The default prefix is C<##>,
 1892 corresponding to C<-sbcp=##>.  The prefix is actually part of a perl 
 1893 pattern used to match lines and it must either begin with C<#> or C<^#>.  
 1894 In the first case a prefix ^\s* will be added to match any leading
 1895 whitespace, while in the second case the pattern will match only
 1896 comments with no leading whitespace.  For example, to
 1897 identify all comments as static block comments, one would use C<-sbcp=#>.
 1898 To identify all left-adjusted comments as static block comments, use C<-sbcp='^#'>.
 1899 
 1900 Please note that B<-sbcp> merely defines the pattern used to identify static
 1901 block comments; it will not be used unless the switch B<-sbc> is set.  Also,
 1902 please be aware that since this string is used in a perl regular expression
 1903 which identifies these comments, it must enable a valid regular expression to
 1904 be formed.
 1905 
 1906 A pattern which can be useful is:
 1907 
 1908     -sbcp=^#{2,}[^\s#] 
 1909 
 1910 This pattern requires a static block comment to have at least one character
 1911 which is neither a # nor a space.  It allows a line containing only '#'
 1912 characters to be rejected as a static block comment.  Such lines are often used
 1913 at the start and end of header information in subroutines and should not be
 1914 separated from the intervening comments, which typically begin with just a
 1915 single '#'.
 1916 
 1917 =item B<-osbc>, B<--outdent-static-block-comments>
 1918 
 1919 The command B<-osbc> will cause static block comments to be outdented by 2
 1920 spaces (or whatever B<-ci=n> has been set to), if possible.
 1921 
 1922 =back
 1923 
 1924 =item B<Static Side Comments>
 1925 
 1926 Static side comments are side comments with a special leading pattern.
 1927 This option can be useful for controlling how commented code is displayed
 1928 when it is a side comment.
 1929 
 1930 =over 4
 1931 
 1932 =item B<-ssc>, B<--static-side-comments>
 1933 
 1934 When B<-ssc> is used, a side comment with a static leading pattern, which is
 1935 C<##> by default, will be spaced only a single space from previous
 1936 character, and it will not be vertically aligned with other side comments.
 1937 
 1938 The default is B<-nssc>.
 1939 
 1940 =item B<-sscp=string>, B<--static-side-comment-prefix=string>
 1941 
 1942 This parameter defines the prefix used to identify static side comments
 1943 when the B<-ssc> parameter is set.  The default prefix is C<##>,
 1944 corresponding to C<-sscp=##>.  
 1945 
 1946 Please note that B<-sscp> merely defines the pattern used to identify
 1947 static side comments; it will not be used unless the switch B<-ssc> is
 1948 set.  Also, note that this string is used in a perl regular expression
 1949 which identifies these comments, so it must enable a valid regular
 1950 expression to be formed.
 1951 
 1952 =back
 1953 
 1954 =back
 1955 
 1956 =head2 Skipping Selected Sections of Code
 1957 
 1958 Selected lines of code may be passed verbatim to the output without any
 1959 formatting by marking the starting and ending lines with special comments.
 1960 There are two options for doing this.  The first option is called
 1961 B<--format-skipping> or B<-fs>, and the second option is called
 1962 B<--code-skipping> or B<-cs>.
 1963 
 1964 In both cases the lines of code will be output without any changes.
 1965 The difference is that in B<--format-skipping>
 1966 perltidy will still parse the marked lines of code and check for errors,
 1967 whereas in B<--code-skipping> perltidy will simply pass the lines to the output without any checking.
 1968 
 1969 Both of these features are enabled by default and are invoked with special
 1970 comment markers.  B<--format-skipping> uses starting and ending markers '#<<<'
 1971 and '#>>>', like this:
 1972 
 1973  #<<<  format skipping: do not let perltidy change my nice formatting
 1974     my @list = (1,
 1975                 1, 1,
 1976                 1, 2, 1,
 1977                 1, 3, 3, 1,
 1978                 1, 4, 6, 4, 1,);
 1979  #>>>
 1980 
 1981 B<--code-skipping> uses starting and ending markers '#<<V' and '#>>V', like
 1982 this:
 1983 
 1984  #<<V  code skipping: perltidy will pass this verbatim without error checking
 1985 
 1986     token ident_digit {
 1987         [ [ <?word> | _ | <?digit> ] <?ident_digit>
 1988         |   <''>
 1989         ]
 1990     };
 1991 
 1992  #>>V
 1993 
 1994 Additional text may appear on the special comment lines provided that it
 1995 is separated from the marker by at least one space, as in the above examples.
 1996 
 1997 It is recommended to use B<--code-skipping> only if you need to hide a block of
 1998 an extended syntax which would produce errors if parsed by perltidy, and use
 1999 B<--format-skipping> otherwise.  This is because the B<--format-skipping>
 2000 option provides the benefits of error checking, and there are essentially no
 2001 limitations on which lines to which it can be applied.  The B<--code-skipping>
 2002 option, on the other hand, does not do error checking and its use is more
 2003 restrictive because the code which remains, after skipping the marked lines,
 2004 must be syntactically correct code with balanced containers.
 2005 
 2006 These features should be used sparingly to avoid littering code with markers,
 2007 but they can be helpful for working around occasional problems.
 2008 
 2009 Note that it may be possible to avoid the use of B<--format-skipping> for the
 2010 specific case of a comma-separated list of values, as in the above example, by
 2011 simply inserting a blank or comment somewhere between the opening and closing
 2012 parens.  See the section L<Controlling List Formatting>.
 2013 
 2014 The following sections describe the available controls for these options.  They
 2015 should not normally be needed.
 2016 
 2017 =over 4
 2018 
 2019 =item B<-fs>,  B<--format-skipping>
 2020 
 2021 As explained above, this flag, which is enabled by default, causes any code
 2022 between special beginning and ending comment markers to be passed to the output
 2023 without formatting.  The code between the comments is still checked for errors
 2024 however.  The default beginning marker is #<<< and the default ending marker is
 2025 #>>>.
 2026 
 2027 Format skipping begins when a format skipping beginning comment is seen and
 2028 continues until a format-skipping ending comment is found.
 2029 
 2030 This feature can be disabled with B<-nfs>.   This should not normally be necessary.
 2031 
 2032 =item B<-fsb=string>,  B<--format-skipping-begin=string>
 2033 
 2034 This and the next parameter allow the special beginning and ending comments to
 2035 be changed.  However, it is recommended that they only be changed if there is a
 2036 conflict between the default values and some other use.  If they are used, it
 2037 is recommended that they only be entered in a B<.perltidyrc> file, rather than
 2038 on a command line.  This is because properly escaping these parameters on a
 2039 command line can be difficult.
 2040 
 2041 If changed comment markers do not appear to be working, use the B<-log> flag and
 2042 examine the F<.LOG> file to see if and where they are being detected.
 2043 
 2044 The B<-fsb=string> parameter may be used to change the beginning marker for
 2045 format skipping.  The default is equivalent to -fsb='#<<<'.  The string that
 2046 you enter must begin with a # and should be in quotes as necessary to get past
 2047 the command shell of your system.  It is actually the leading text of a pattern
 2048 that is constructed by appending a '\s', so you must also include backslashes
 2049 for characters to be taken literally rather than as patterns.  
 2050 
 2051 Some examples show how example strings become patterns:
 2052 
 2053  -fsb='#\{\{\{' becomes /^#\{\{\{\s/  which matches  #{{{ but not #{{{{
 2054  -fsb='#\*\*'   becomes /^#\*\*\s/    which matches  #** but not #***
 2055  -fsb='#\*{2,}' becomes /^#\*{2,}\s/  which matches  #** and #***** 
 2056 
 2057 =item B<-fse=string>,  B<--format-skipping-end=string>
 2058 
 2059 The B<-fse=string> is the corresponding parameter used to change the
 2060 ending marker for format skipping.  The default is equivalent to
 2061 -fse='#<<<'.  
 2062 
 2063 The beginning and ending strings may be the same, but it is preferable
 2064 to make them different for clarity.
 2065 
 2066 =item B<-cs>,  B<--code-skipping>
 2067 
 2068 As explained above, this flag, which is enabled by default, causes any code
 2069 between special beginning and ending comment markers to be directly passed to
 2070 the output without any error checking or formatting.  Essentially, perltidy
 2071 treats it as if it were a block of arbitrary text.  The default beginning
 2072 marker is #<<V and the default ending marker is #>>V.
 2073 
 2074 This feature can be disabled with B<-ncs>.   This should not normally be
 2075 necessary.
 2076 
 2077 =item B<-csb=string>,  B<--code-skipping-begin=string>
 2078 
 2079 This may be used to change the beginning comment for a B<--code-skipping> section, and its use is similar to the B<-fsb=string>.
 2080 The default is equivalent to -csb='#<<V'.
 2081 
 2082 =item B<-cse=string>,  B<--code-skipping-end=string>
 2083 
 2084 This may be used to change the ending comment for a B<--code-skipping> section, and its use is similar to the B<-fse=string>.
 2085 The default is equivalent to -cse='#>>V'.
 2086 
 2087 =back
 2088 
 2089 =head2 Line Break Control
 2090 
 2091 The parameters in this section control breaks after
 2092 non-blank lines of code.  Blank lines are controlled
 2093 separately by parameters in the section L<Blank Line
 2094 Control>.
 2095 
 2096 =over 4
 2097 
 2098 =item B<-fnl>,  B<--freeze-newlines>
 2099 
 2100 If you do not want any changes to the line breaks within
 2101 lines of code in your script, set
 2102 B<-fnl>, and they will remain fixed, and the rest of the commands in
 2103 this section and sections 
 2104 L<Controlling List Formatting>,
 2105 L<Retaining or Ignoring Existing Line Breaks>. 
 2106 You may want to use B<-noll> with this.
 2107 
 2108 Note: If you also want to keep your blank lines exactly
 2109 as they are, you can use the B<-fbl> flag which is described
 2110 in the section L<Blank Line Control>.
 2111 
 2112 =item B<-ce>,   B<--cuddled-else>
 2113 
 2114 Enable the "cuddled else" style, in which C<else> and C<elsif> are
 2115 follow immediately after the curly brace closing the previous block.
 2116 The default is not to use cuddled elses, and is indicated with the flag
 2117 B<-nce> or B<--nocuddled-else>.  Here is a comparison of the
 2118 alternatives:
 2119 
 2120   # -ce
 2121   if ($task) {
 2122       yyy();
 2123   } else {    
 2124       zzz();
 2125   }
 2126 
 2127   # -nce (default)
 2128   if ($task) {
 2129     yyy();
 2130   }
 2131   else {    
 2132     zzz();
 2133   }
 2134 
 2135 In this example the keyword B<else> is placed on the same line which begins with
 2136 the preceding closing block brace and is followed by its own opening block brace
 2137 on the same line.  Other keywords and function names which are formatted with
 2138 this "cuddled" style are B<elsif>, B<continue>, B<catch>, B<finally>.
 2139 
 2140 Other block types can be formatted by specifying their names on a 
 2141 separate parameter B<-cbl>, described in a later section.  
 2142 
 2143 Cuddling between a pair of code blocks requires that the closing brace of the
 2144 first block start a new line.  If this block is entirely on one line in the
 2145 input file, it is necessary to decide if it should be broken to allow cuddling.
 2146 This decision is controlled by the flag B<-cbo=n> discussed below.  The default
 2147 and recommended value of B<-cbo=1> bases this decision on the first block in
 2148 the chain.  If it spans multiple lines then cuddling is made and continues
 2149 along the chain, regardless of the sizes of subsequent blocks. Otherwise, short
 2150 lines remain intact.
 2151 
 2152 So for example, the B<-ce> flag would not have any effect if the above snippet
 2153 is rewritten as
 2154 
 2155   if ($task) { yyy() }
 2156   else {    zzz() }
 2157 
 2158 If the first block spans multiple lines, then cuddling can be done and will
 2159 continue for the subsequent blocks in the chain, as illustrated in the previous
 2160 snippet.
 2161 
 2162 If there are blank lines between cuddled blocks they will be eliminated.  If
 2163 there are comments after the closing brace where cuddling would occur then
 2164 cuddling will be prevented.  If this occurs, cuddling will restart later in the
 2165 chain if possible.  
 2166 
 2167 =item B<-cb>,   B<--cuddled-blocks>
 2168 
 2169 This flag is equivalent to B<-ce>. 
 2170 
 2171 
 2172 =item B<-cbl>,    B<--cuddled-block-list>     
 2173 
 2174 The built-in default cuddled block types are B<else, elsif, continue, catch, finally>.
 2175 
 2176 Additional block types to which the B<-cuddled-blocks> style applies can be defined by
 2177 this parameter.  This parameter is a character string, giving a list of
 2178 block types separated by commas or spaces.  For example, to cuddle code blocks
 2179 of type sort, map and grep, in addition to the default types, the string could
 2180 be set to
 2181 
 2182   -cbl="sort map grep"
 2183 
 2184 or equivalently
 2185 
 2186   -cbl=sort,map,grep 
 2187 
 2188 Note however that these particular block types are typically short so there might not be much
 2189 opportunity for the cuddled format style.
 2190 
 2191 Using commas avoids the need to protect spaces with quotes.
 2192 
 2193 As a diagnostic check, the flag B<--dump-cuddled-block-list> or B<-dcbl> can be
 2194 used to view the hash of values that are generated by this flag. 
 2195 
 2196 Finally, note that the B<-cbl> flag by itself merely specifies which blocks are formatted
 2197 with the cuddled format. It has no effect unless this formatting style is activated with
 2198 B<-ce>.
 2199 
 2200 =item B<-cblx>,    B<--cuddled-block-list-exclusive>     
 2201 
 2202 When cuddled else formatting is selected with B<-ce>, setting this flag causes
 2203 perltidy to ignore its built-in defaults and rely exclusively on the block types
 2204 specified on the B<-cbl> flag described in the previous section.  For example,
 2205 to avoid using cuddled B<catch> and B<finally>, which among in the defaults, the
 2206 following set of parameters could be used:
 2207 
 2208   perltidy -ce -cbl='else elsif continue' -cblx
 2209 
 2210 
 2211 =item B<-cbo=n>,   B<--cuddled-break-option=n>
 2212 
 2213 Cuddled formatting is only possible between a pair of code blocks if the
 2214 closing brace of the first block starts a new line. If a block is encountered
 2215 which is entirely on a single line, and cuddled formatting is selected, it is
 2216 necessary to make a decision as to whether or not to "break" the block, meaning
 2217 to cause it to span multiple lines.  This parameter controls that decision. The
 2218 options are:
 2219 
 2220    cbo=0  Never force a short block to break.
 2221    cbo=1  If the first of a pair of blocks is broken in the input file, 
 2222           then break the second [DEFAULT].
 2223    cbo=2  Break open all blocks for maximal cuddled formatting.
 2224 
 2225 The default and recommended value is B<cbo=1>.  With this value, if the starting
 2226 block of a chain spans multiple lines, then a cascade of breaks will occur for
 2227 remaining blocks causing the entire chain to be cuddled.
 2228 
 2229 The option B<cbo=0> can produce erratic cuddling if there are numerous one-line
 2230 blocks.
 2231 
 2232 The option B<cbo=2> produces maximal cuddling but will not allow any short blocks.
 2233 
 2234 
 2235 =item B<-bl>,    B<--opening-brace-on-new-line>     
 2236 
 2237 Use the flag B<-bl> to place the opening brace on a new line:
 2238 
 2239   if ( $input_file eq '-' )    # -bl 
 2240   {                          
 2241       important_function();
 2242   }
 2243 
 2244 This flag applies to all structural blocks, including named sub's (unless
 2245 the B<-sbl> flag is set -- see next item).
 2246 
 2247 The default style, B<-nbl>, places an opening brace on the same line as
 2248 the keyword introducing it.  For example,
 2249 
 2250   if ( $input_file eq '-' ) {   # -nbl (default)
 2251 
 2252 =item B<-sbl>,    B<--opening-sub-brace-on-new-line>     
 2253 
 2254 The flag B<-sbl> can be used to override the value of B<-bl> for
 2255 the opening braces of named sub's.  For example, 
 2256 
 2257  perltidy -sbl
 2258 
 2259 produces this result:
 2260 
 2261  sub message
 2262  {
 2263     if (!defined($_[0])) {
 2264         print("Hello, World\n");
 2265     }
 2266     else {
 2267         print($_[0], "\n");
 2268     }
 2269  }
 2270 
 2271 This flag is negated with B<-nsbl>.  If B<-sbl> is not specified,
 2272 the value of B<-bl> is used.
 2273 
 2274 =item B<-asbl>,    B<--opening-anonymous-sub-brace-on-new-line>     
 2275 
 2276 The flag B<-asbl> is like the B<-sbl> flag except that it applies
 2277 to anonymous sub's instead of named subs. For example
 2278 
 2279  perltidy -asbl
 2280 
 2281 produces this result:
 2282 
 2283  $a = sub
 2284  {
 2285      if ( !defined( $_[0] ) ) {
 2286          print("Hello, World\n");
 2287      }
 2288      else {
 2289          print( $_[0], "\n" );
 2290      }
 2291  };
 2292 
 2293 This flag is negated with B<-nasbl>, and the default is B<-nasbl>.
 2294 
 2295 =item B<-bli>,    B<--brace-left-and-indent>     
 2296 
 2297 The flag B<-bli> is the same as B<-bl> but in addition it causes one 
 2298 unit of continuation indentation ( see B<-ci> ) to be placed before 
 2299 an opening and closing block braces.
 2300 
 2301 For example,
 2302 
 2303         if ( $input_file eq '-' )    # -bli
 2304           {
 2305             important_function();
 2306           }
 2307 
 2308 By default, this extra indentation occurs for blocks of type:
 2309 B<if>, B<elsif>, B<else>, B<unless>, B<for>, B<foreach>, B<sub>, 
 2310 B<while>, B<until>, and also with a preceding label.  The next item
 2311 shows how to change this.
 2312 
 2313 =item B<-blil=s>,    B<--brace-left-and-indent-list=s>     
 2314 
 2315 Use this parameter to change the types of block braces for which the
 2316 B<-bli> flag applies; see L<Specifying Block Types>.  For example,
 2317 B<-blil='if elsif else'> would apply it to only C<if/elsif/else> blocks.
 2318 
 2319 =item B<-bar>,    B<--opening-brace-always-on-right>     
 2320 
 2321 The default style, B<-nbl> places the opening code block brace on a new
 2322 line if it does not fit on the same line as the opening keyword, like
 2323 this:
 2324 
 2325         if ( $bigwasteofspace1 && $bigwasteofspace2
 2326           || $bigwasteofspace3 && $bigwasteofspace4 )
 2327         {
 2328             big_waste_of_time();
 2329         }
 2330 
 2331 To force the opening brace to always be on the right, use the B<-bar>
 2332 flag.  In this case, the above example becomes
 2333 
 2334         if ( $bigwasteofspace1 && $bigwasteofspace2
 2335           || $bigwasteofspace3 && $bigwasteofspace4 ) {
 2336             big_waste_of_time();
 2337         }
 2338 
 2339 A conflict occurs if both B<-bl> and B<-bar> are specified.
 2340 
 2341 =item B<-otr>,  B<--opening-token-right> and related flags
 2342 
 2343 The B<-otr> flag is a hint that perltidy should not place a break between a
 2344 comma and an opening token.  For example:
 2345 
 2346     # default formatting
 2347     push @{ $self->{$module}{$key} },
 2348       {
 2349         accno       => $ref->{accno},
 2350         description => $ref->{description}
 2351       };
 2352 
 2353     # perltidy -otr
 2354     push @{ $self->{$module}{$key} }, {
 2355         accno       => $ref->{accno},
 2356         description => $ref->{description}
 2357       };
 2358 
 2359 The flag B<-otr> is actually an abbreviation for three other flags
 2360 which can be used to control parens, hash braces, and square brackets
 2361 separately if desired:
 2362 
 2363   -opr  or --opening-paren-right
 2364   -ohbr or --opening-hash-brace-right
 2365   -osbr or --opening-square-bracket-right
 2366 
 2367 =item B<-bbhb=n>,  B<--break-before-hash-brace=n> and related flags
 2368 
 2369 When a list of items spans multiple lines, the default formatting is to place
 2370 the opening brace (or other container token) at the end of the starting line,
 2371 like this:
 2372 
 2373     $romanNumerals = {
 2374         one   => 'I',
 2375         two   => 'II',
 2376         three => 'III',
 2377         four  => 'IV',
 2378     };
 2379 
 2380 This flag can change the default behavior to cause a line break to be placed
 2381 before the opening brace according to the value given to the integer B<n>:
 2382 
 2383   -bbhb=0 never break [default]
 2384   -bbhb=1 stable: break if the input script had a break
 2385   -bbhb=2 break if list is 'complex' (see note below)
 2386   -bbhb=3 always break
 2387 
 2388 For example, 
 2389 
 2390     # perltidy -bbhb=3
 2391     $romanNumerals =
 2392       {
 2393         one   => 'I',
 2394         two   => 'II',
 2395         three => 'III',
 2396         four  => 'IV',
 2397       };
 2398 
 2399 There are several points to note about this flag:
 2400 
 2401 =over 4
 2402 
 2403 =item *
 2404 
 2405 This parameter only applies if the opening brace is preceded by an '='
 2406 or '=>'.
 2407 
 2408 =item *
 2409 
 2410 This parameter only applies if the contents of the container looks like a list.
 2411 The contents need to contain some commas or '=>'s at the next interior level to
 2412 be considered a list.
 2413 
 2414 =item *
 2415 
 2416 For the B<n=2> option, a list is considered 'complex' if it is part of a nested list
 2417 structure which spans multiple lines in the input file.
 2418 
 2419 =item *
 2420 
 2421 If multiple opening tokens have been 'welded' together with the B<-wn> parameter, then
 2422 this parameter has no effect.
 2423 
 2424 =item *
 2425 
 2426 The indentation of the braces will normally be one level of continuation
 2427 indentation by default.  This can be changed with the parameter
 2428 B<-bbhbi=n> in the next section.
 2429 
 2430 =item *
 2431 
 2432 Similar flags for controlling parens and square brackets are given in the subsequent section.
 2433 
 2434 =back   
 2435 
 2436 =item B<-bbhbi=n>,  B<--break-before-hash-brace-and-indent=n>
 2437 
 2438 This flag is a companion to B<-bbhb=n> for controlling the indentation of an opening hash brace
 2439 which is placed on a new line by that parameter.  The indentation is as follows:
 2440 
 2441   -bbhbi=0 one continuation level [default]
 2442   -bbhbi=1 outdent by one continuation level
 2443   -bbhbi=2 indent one full indentation level
 2444 
 2445 For example:
 2446 
 2447     # perltidy -bbhb=3 -bbhbi=1
 2448     $romanNumerals =
 2449     {
 2450         one   => 'I',
 2451         two   => 'II',
 2452         three => 'III',
 2453         four  => 'IV',
 2454     };
 2455 
 2456     # perltidy -bbhb=3 -bbhbi=2
 2457     $romanNumerals =
 2458         {
 2459         one   => 'I',
 2460         two   => 'II',
 2461         three => 'III',
 2462         four  => 'IV',
 2463         };
 2464 
 2465 Note that this parameter has no effect unless B<-bbhb=n> is also set.
 2466 
 2467 =item B<-bbsb=n>,  B<--break-before-square-bracket=n>
 2468 
 2469 This flag is similar to the flag described above, except it applies to lists contained within square brackets.
 2470 
 2471   -bbsb=0 never break [default]
 2472   -bbsb=1 stable: break if the input script had a break
 2473   -bbsb=2 break if list is 'complex' (part of nested list structure)
 2474   -bbsb=3 always break
 2475 
 2476 =item B<-bbsbi=n>,  B<--break-before-square-bracket-and-indent=n>
 2477 
 2478 This flag is a companion to B<-bbsb=n> for controlling the indentation of an opening square bracket
 2479 which is placed on a new line by that parameter.  The indentation is as follows:
 2480 
 2481   -bbsbi=0 one continuation level [default]
 2482   -bbsbi=1 outdent by one continuation level
 2483   -bbsbi=2 indent one full indentation level
 2484 
 2485 =item B<-bbp=n>,  B<--break-before-paren=n>
 2486 
 2487 This flag is similar to B<-bbhb=n>, described above, except it applies to lists contained within parens.
 2488 
 2489   -bbp=0 never break [default]
 2490   -bbp=1 stable: break if the input script had a break
 2491   -bpb=2 break if list is 'complex' (part of nested list structure)
 2492   -bbp=3 always break
 2493 
 2494 =item B<-bbpi=n>,  B<--break-before-paren-and-indent=n>
 2495 
 2496 This flag is a companion to B<-bbp=n> for controlling the indentation of an opening paren
 2497 which is placed on a new line by that parameter.  The indentation is as follows:
 2498 
 2499   -bbpi=0 one continuation level [default]
 2500   -bbpi=1 outdent by one continuation level
 2501   -bbpi=2 indent one full indentation level
 2502 
 2503 =item B<-wn>,  B<--weld-nested-containers> 
 2504 
 2505 The B<-wn> flag causes closely nested pairs of opening and closing container
 2506 symbols (curly braces, brackets, or parens) to be "welded" together, meaning
 2507 that they are treated as if combined into a single unit, with the indentation
 2508 of the innermost code reduced to be as if there were just a single container
 2509 symbol.
 2510 
 2511 For example:
 2512 
 2513     # default formatting
 2514         do {
 2515             {
 2516                 next if $x == $y;    
 2517             }
 2518         } until $x++ > $z;
 2519 
 2520     # perltidy -wn
 2521         do { {
 2522             next if $x == $y;
 2523         } } until $x++ > $z;
 2524 
 2525 When this flag is set perltidy makes a preliminary pass through the file and
 2526 identifies all nested pairs of containers.  To qualify as a nested pair, the
 2527 closing container symbols must be immediately adjacent and the opening symbols
 2528 must either (1) be adjacent as in the above example, or (2) have an anonymous
 2529 sub declaration following an outer opening container symbol which is not a
 2530 code block brace, or (3) have an outer opening paren separated from the inner
 2531 opening symbol by any single non-container symbol or something that looks like
 2532 a function evaluation, as illustrated in the next examples.  
 2533 
 2534 Any container symbol may serve as both the inner container of one pair and as
 2535 the outer container of an adjacent pair. Consequently, any number of adjacent
 2536 opening or closing symbols may join together in weld.  For example, here are
 2537 three levels of wrapped function calls:
 2538 
 2539     # default formatting
 2540         my (@date_time) = Localtime(
 2541             Date_to_Time(
 2542                 Add_Delta_DHMS(
 2543                     $year, $month,  $day, $hour, $minute, $second,
 2544                     '0',   $offset, '0',  '0'
 2545                 )
 2546             )
 2547         );
 2548 
 2549         # perltidy -wn
 2550         my (@date_time) = Localtime( Date_to_Time( Add_Delta_DHMS(
 2551             $year, $month,  $day, $hour, $minute, $second,
 2552             '0',   $offset, '0',  '0'
 2553         ) ) );
 2554 
 2555 Notice how the indentation of the inner lines are reduced by two levels in this
 2556 case.  This example also shows the typical result of this formatting, namely it
 2557 is a sandwich consisting of an initial opening layer, a central section of any
 2558 complexity forming the "meat" of the sandwich, and a final closing layer.  This
 2559 predictable structure helps keep the compacted structure readable.
 2560 
 2561 The inner sandwich layer is required to be at least one line thick.  If this
 2562 cannot be achieved, welding does not occur.  This constraint can cause
 2563 formatting to take a couple of iterations to stabilize when it is first applied
 2564 to a script. The B<-conv> flag can be used to insure that the final format is
 2565 achieved in a single run.
 2566 
 2567 Here is an example illustrating a welded container within a welded containers:
 2568 
 2569     # default formatting
 2570         $x->badd(
 2571             bmul(
 2572                 $class->new(
 2573                     abs(
 2574                         $sx * int( $xr->numify() ) & $sy * int( $yr->numify() )
 2575                     )
 2576                 ),
 2577                 $m
 2578             )
 2579         );
 2580 
 2581     # perltidy -wn
 2582         $x->badd( bmul(
 2583             $class->new( abs(
 2584                 $sx * int( $xr->numify() ) & $sy * int( $yr->numify() )
 2585             ) ),
 2586             $m
 2587         ) );
 2588 
 2589 The welded closing tokens are by default on a separate line but this can be
 2590 modified with the B<-vtc=n> flag (described in the next section).  For example,
 2591 the same example adding B<-vtc=2> is
 2592 
 2593     # perltidy -wn -vtc=2
 2594         $x->badd( bmul(
 2595             $class->new( abs(
 2596                 $sx * int( $xr->numify() ) & $sy * int( $yr->numify() ) ) ),
 2597             $m ) );
 2598 
 2599 This format option is quite general but there are some limitations.  
 2600 
 2601 One limitation is that any line length limit still applies and can cause long
 2602 welded sections to be broken into multiple lines.  
 2603 
 2604 Another limitation is that an opening symbol which delimits quoted text cannot
 2605 be included in a welded pair.  This is because quote delimiters are treated
 2606 specially in perltidy.  
 2607 
 2608 Finally, the stacking of containers defined by this flag have priority over
 2609 any other container stacking flags.  This is because any welding is done first.
 2610 
 2611 =item B<-wnxl=s>,  B<--weld-nested-exclusion-list> 
 2612 
 2613 The B<-wnxl=s> flag provides some control over the types of containers which
 2614 can be welded.  The B<-wn> flag by default is "greedy" in welding adjacent
 2615 containers.  If it welds more types of containers than desired, this flag
 2616 provides a capability to reduce the amount of welding by specifying a list
 2617 of things which should B<not> be welded. 
 2618 
 2619 The logic in perltidy to apply this is straightforward.  As each container
 2620 token is being considered for joining a weld, any exclusion rules are consulted
 2621 and used to reject the weld if necessary.
 2622 
 2623 This list is a string with space-separated items.  Each item consists of up to
 2624 three pieces of information: (1) an optional position, (2) an optional
 2625 preceding type, and (3) a container type.
 2626 
 2627 The only required piece of information is a container type, which is one of
 2628 '(', '[', '{' or 'q'.  The first three of these are container tokens and the
 2629 last represents a quoted list.  For example the string
 2630 
 2631   -wnxl='[ { q'
 2632 
 2633 means do B<NOT> include square-bracets, braces, or quotes in any welds.  The only unspecified
 2634 container is '(', so this string means that only welds involving parens will be made. 
 2635 
 2636 To illustrate, following welded snippet consists of a chain of three welded
 2637 containers with types '(' '[' and 'q':
 2638 
 2639     # perltidy -wn
 2640     skip_symbols( [ qw(
 2641         Perl_dump_fds
 2642         Perl_ErrorNo
 2643         Perl_GetVars
 2644         PL_sys_intern
 2645     ) ] );
 2646 
 2647 Even though the qw term uses parens as the quote delimiter, it has a special
 2648 type 'q' here. If it appears in a weld it always appears at the end of the
 2649 welded chain.
 2650 
 2651 Any of the container types '[', '{', and '(' may be prefixed with a position
 2652 indicator which is either '^', to indicate the first token of a welded
 2653 sequence, or '.', to indicate an interior token of a welded sequence.  (Since
 2654 a quoted string 'q' always ends a chain it does need a position indicator).
 2655 
 2656 For example, if we do not want a sequence of welded containers to start with a
 2657 square bracket we could use
 2658 
 2659   -wnxl='^['
 2660 
 2661 In the above snippet, there is a square bracket but it does not start the chain,
 2662 so the formatting would be unchanged if it were formatted with this restriction.
 2663 
 2664 A third optional item of information which can be given is an alphanumeric
 2665 letter which is used to limit the selection further depending on the type of
 2666 token immediately before the container.  If given, it goes just before the
 2667 container symbol.  The possible letters are currently 'k', 'K', 'f', 'F',
 2668 'w', and 'W', with these meanings:
 2669 
 2670  'k' matches if the previous nonblank token is a perl builtin keyword (such as 'if', 'while'),
 2671  'K' matches if 'k' does not, meaning that the previous token is not a keyword.
 2672  'f' matches if the previous token is a function other than a keyword.
 2673  'F' matches if 'f' does not.
 2674  'w' matches if either 'k' or 'f' match.
 2675  'W' matches if 'w' does not.
 2676 
 2677 For example, compare
 2678 
 2679         # perltidy -wn 
 2680         if ( defined( $_Cgi_Query{
 2681             $Config{'methods'}{'authentication'}{'remote'}{'cgi'}{'username'}
 2682         } ) )
 2683 
 2684 with
 2685 
 2686         # perltidy -wn -wnxl='^K( {'
 2687         if ( defined(
 2688             $_Cgi_Query{ $Config{'methods'}{'authentication'}{'remote'}{'cgi'}
 2689                   {'username'} }
 2690         ) )
 2691 
 2692 The first case does maximum welding. In the second case the leading paren is
 2693 retained by the rule (it would have been rejected if preceded by a non-keyword)
 2694 but the curly brace is rejected by the rule.
 2695 
 2696 Here are some additional example strings and their meanings:
 2697 
 2698     '^('   - the weld must not start with a paren
 2699     '.('   - the second and later tokens may not be parens
 2700     '.w('  - the second and later tokens may not keyword or function call parens
 2701     '('    - no parens in a weld
 2702     '^K('  - exclude a leading paren preceded by a non-keyword
 2703     '.k('  - exclude a secondary paren preceded by a keyword
 2704     '[ {'  - exclude all brackets and braces
 2705     '[ ( ^K{' - exclude everything except nested structures like do {{  ... }}
 2706 
 2707 =item B<Vertical tightness> of non-block curly braces, parentheses, and square brackets.
 2708 
 2709 These parameters control what shall be called vertical tightness.  Here are the
 2710 main points:
 2711 
 2712 =over 4
 2713 
 2714 =item *
 2715 
 2716 Opening tokens (except for block braces) are controlled by B<-vt=n>, or
 2717 B<--vertical-tightness=n>, where
 2718 
 2719  -vt=0 always break a line after opening token (default). 
 2720  -vt=1 do not break unless this would produce more than one 
 2721          step in indentation in a line.
 2722  -vt=2 never break a line after opening token
 2723 
 2724 =item *
 2725 
 2726 You must also use the B<-lp> flag when you use the B<-vt> flag; the
 2727 reason is explained below.
 2728 
 2729 =item *
 2730 
 2731 Closing tokens (except for block braces) are controlled by B<-vtc=n>, or
 2732 B<--vertical-tightness-closing=n>, where
 2733 
 2734  -vtc=0 always break a line before a closing token (default), 
 2735  -vtc=1 do not break before a closing token which is followed 
 2736         by a semicolon or another closing token, and is not in 
 2737         a list environment.
 2738  -vtc=2 never break before a closing token.
 2739  -vtc=3 Like -vtc=1 except always break before a closing token
 2740         if the corresponding opening token follows an = or =>.
 2741 
 2742 The rules for B<-vtc=1> and B<-vtc=3> are designed to maintain a reasonable
 2743 balance between tightness and readability in complex lists.
 2744 
 2745 =item *
 2746 
 2747 Different controls may be applied to different token types,
 2748 and it is also possible to control block braces; see below.
 2749 
 2750 =item *
 2751 
 2752 Finally, please note that these vertical tightness flags are merely
 2753 hints to the formatter, and it cannot always follow them.  Things which
 2754 make it difficult or impossible include comments, blank lines, blocks of
 2755 code within a list, and possibly the lack of the B<-lp> parameter.
 2756 Also, these flags may be ignored for very small lists (2 or 3 lines in
 2757 length).
 2758 
 2759 =back
 2760 
 2761 Here are some examples: 
 2762 
 2763     # perltidy -lp -vt=0 -vtc=0
 2764     %romanNumerals = (
 2765                        one   => 'I',
 2766                        two   => 'II',
 2767                        three => 'III',
 2768                        four  => 'IV',
 2769     );
 2770 
 2771     # perltidy -lp -vt=1 -vtc=0
 2772     %romanNumerals = ( one   => 'I',
 2773                        two   => 'II',
 2774                        three => 'III',
 2775                        four  => 'IV',
 2776     );
 2777 
 2778     # perltidy -lp -vt=1 -vtc=1
 2779     %romanNumerals = ( one   => 'I',
 2780                        two   => 'II',
 2781                        three => 'III',
 2782                        four  => 'IV', );
 2783 
 2784     # perltidy -vtc=3
 2785     my_function(
 2786         one   => 'I',
 2787         two   => 'II',
 2788         three => 'III',
 2789         four  => 'IV', );
 2790 
 2791     # perltidy -vtc=3
 2792     %romanNumerals = (
 2793         one   => 'I',
 2794         two   => 'II',
 2795         three => 'III',
 2796         four  => 'IV',
 2797     );
 2798 
 2799 In the last example for B<-vtc=3>, the opening paren is preceded by an equals
 2800 so the closing paren is placed on a new line.
 2801 
 2802 The difference between B<-vt=1> and B<-vt=2> is shown here:
 2803 
 2804     # perltidy -lp -vt=1 
 2805     $init->add(
 2806                 mysprintf( "(void)find_threadsv(%s);",
 2807                            cstring( $threadsv_names[ $op->targ ] )
 2808                 )
 2809     );
 2810 
 2811     # perltidy -lp -vt=2 
 2812     $init->add( mysprintf( "(void)find_threadsv(%s);",
 2813                            cstring( $threadsv_names[ $op->targ ] )
 2814                 )
 2815     );
 2816 
 2817 With B<-vt=1>, the line ending in C<add(> does not combine with the next
 2818 line because the next line is not balanced.  This can help with
 2819 readability, but B<-vt=2> can be used to ignore this rule.
 2820 
 2821 The tightest, and least readable, code is produced with both C<-vt=2> and
 2822 C<-vtc=2>:
 2823 
 2824     # perltidy -lp -vt=2 -vtc=2
 2825     $init->add( mysprintf( "(void)find_threadsv(%s);",
 2826                            cstring( $threadsv_names[ $op->targ ] ) ) );
 2827 
 2828 Notice how the code in all of these examples collapses vertically as
 2829 B<-vt> increases, but the indentation remains unchanged.  This is
 2830 because perltidy implements the B<-vt> parameter by first formatting as
 2831 if B<-vt=0>, and then simply overwriting one output line on top of the
 2832 next, if possible, to achieve the desired vertical tightness.  The
 2833 B<-lp> indentation style has been designed to allow this vertical
 2834 collapse to occur, which is why it is required for the B<-vt> parameter.
 2835 
 2836 The B<-vt=n> and B<-vtc=n> parameters apply to each type of container
 2837 token.  If desired, vertical tightness controls can be applied
 2838 independently to each of the closing container token types.
 2839 
 2840 The parameters for controlling parentheses are B<-pvt=n> or
 2841 B<--paren-vertical-tightness=n>, and B<-pvtc=n> or
 2842 B<--paren-vertical-tightness-closing=n>.
 2843 
 2844 Likewise, the parameters for square brackets are B<-sbvt=n> or
 2845 B<--square-bracket-vertical-tightness=n>, and B<-sbvtc=n> or
 2846 B<--square-bracket-vertical-tightness-closing=n>.
 2847 
 2848 Finally, the parameters for controlling non-code block braces are
 2849 B<-bvt=n> or B<--brace-vertical-tightness=n>, and B<-bvtc=n> or
 2850 B<--brace-vertical-tightness-closing=n>.
 2851 
 2852 In fact, the parameter B<-vt=n> is actually just an abbreviation for
 2853 B<-pvt=n -bvt=n sbvt=n>, and likewise B<-vtc=n> is an abbreviation
 2854 for B<-pvtc=n -bvtc=n -sbvtc=n>.
 2855 
 2856 =item B<-bbvt=n> or B<--block-brace-vertical-tightness=n>
 2857 
 2858 The B<-bbvt=n> flag is just like the B<-vt=n> flag but applies
 2859 to opening code block braces.
 2860 
 2861  -bbvt=0 break after opening block brace (default). 
 2862  -bbvt=1 do not break unless this would produce more than one 
 2863          step in indentation in a line.
 2864  -bbvt=2 do not break after opening block brace.
 2865 
 2866 It is necessary to also use either B<-bl> or B<-bli> for this to work,
 2867 because, as with other vertical tightness controls, it is implemented by
 2868 simply overwriting a line ending with an opening block brace with the
 2869 subsequent line.  For example:
 2870 
 2871     # perltidy -bli -bbvt=0
 2872     if ( open( FILE, "< $File" ) )
 2873       {
 2874         while ( $File = <FILE> )
 2875           {
 2876             $In .= $File;
 2877             $count++;
 2878           }
 2879         close(FILE);
 2880       }
 2881 
 2882     # perltidy -bli -bbvt=1
 2883     if ( open( FILE, "< $File" ) )
 2884       { while ( $File = <FILE> )
 2885           { $In .= $File;
 2886             $count++;
 2887           }
 2888         close(FILE);
 2889       }
 2890 
 2891 By default this applies to blocks associated with keywords B<if>,
 2892 B<elsif>, B<else>, B<unless>, B<for>, B<foreach>, B<sub>, B<while>,
 2893 B<until>, and also with a preceding label.  This can be changed with
 2894 the parameter B<-bbvtl=string>, or
 2895 B<--block-brace-vertical-tightness-list=string>, where B<string> is a
 2896 space-separated list of block types.  For more information on the
 2897 possible values of this string, see L<Specifying Block Types>
 2898 
 2899 For example, if we want to just apply this style to C<if>,
 2900 C<elsif>, and C<else> blocks, we could use 
 2901 C<perltidy -bli -bbvt=1 -bbvtl='if elsif else'>.
 2902 
 2903 There is no vertical tightness control for closing block braces; with
 2904 one exception they will be placed on separate lines.
 2905 The exception is that a cascade of closing block braces may
 2906 be stacked on a single line.  See B<-scbb>.
 2907 
 2908 =item B<-sot>,  B<--stack-opening-tokens> and related flags
 2909 
 2910 The B<-sot> flag tells perltidy to "stack" opening tokens
 2911 when possible to avoid lines with isolated opening tokens.
 2912 
 2913 For example:
 2914 
 2915     # default
 2916     $opt_c = Text::CSV_XS->new(
 2917         {
 2918             binary       => 1,
 2919             sep_char     => $opt_c,
 2920             always_quote => 1,
 2921         }
 2922     );
 2923 
 2924     # -sot
 2925     $opt_c = Text::CSV_XS->new( {
 2926             binary       => 1,
 2927             sep_char     => $opt_c,
 2928             always_quote => 1,
 2929         }
 2930     );
 2931 
 2932 For detailed control of individual closing tokens the following
 2933 controls can be used:
 2934 
 2935   -sop  or --stack-opening-paren
 2936   -sohb or --stack-opening-hash-brace
 2937   -sosb or --stack-opening-square-bracket
 2938   -sobb or --stack-opening-block-brace
 2939 
 2940 The flag B<-sot> is an abbreviation for B<-sop -sohb -sosb>.
 2941 
 2942 The flag B<-sobb> is an abbreviation for B<-bbvt=2 -bbvtl='*'>.  This
 2943 will case a cascade of opening block braces to appear on a single line,
 2944 although this an uncommon occurrence except in test scripts. 
 2945 
 2946 =item B<-sct>,  B<--stack-closing-tokens> and related flags
 2947 
 2948 The B<-sct> flag tells perltidy to "stack" closing tokens
 2949 when possible to avoid lines with isolated closing tokens.
 2950 
 2951 For example:
 2952 
 2953     # default
 2954     $opt_c = Text::CSV_XS->new(
 2955         {
 2956             binary       => 1,
 2957             sep_char     => $opt_c,
 2958             always_quote => 1,
 2959         }
 2960     );
 2961 
 2962     # -sct
 2963     $opt_c = Text::CSV_XS->new(
 2964         {
 2965             binary       => 1,
 2966             sep_char     => $opt_c,
 2967             always_quote => 1,
 2968         } );
 2969 
 2970 The B<-sct> flag is somewhat similar to the B<-vtc> flags, and in some
 2971 cases it can give a similar result.  The difference is that the B<-vtc>
 2972 flags try to avoid lines with leading opening tokens by "hiding" them at
 2973 the end of a previous line, whereas the B<-sct> flag merely tries to
 2974 reduce the number of lines with isolated closing tokens by stacking them
 2975 but does not try to hide them.  For example:
 2976 
 2977     # -vtc=2
 2978     $opt_c = Text::CSV_XS->new(
 2979         {
 2980             binary       => 1,
 2981             sep_char     => $opt_c,
 2982             always_quote => 1, } );
 2983 
 2984 For detailed control of the stacking of individual closing tokens the
 2985 following controls can be used:
 2986 
 2987   -scp  or --stack-closing-paren
 2988   -schb or --stack-closing-hash-brace
 2989   -scsb or --stack-closing-square-bracket
 2990   -scbb or --stack-closing-block-brace
 2991 
 2992 The flag B<-sct> is an abbreviation for stacking the non-block closing
 2993 tokens, B<-scp -schb -scsb>. 
 2994 
 2995 Stacking of closing block braces, B<-scbb>, causes a cascade of isolated
 2996 closing block braces to be combined into a single line as in the following
 2997 example:
 2998 
 2999     # -scbb:
 3000     for $w1 (@w1) {
 3001         for $w2 (@w2) {
 3002             for $w3 (@w3) {
 3003                 for $w4 (@w4) {
 3004                     push( @lines, "$w1 $w2 $w3 $w4\n" );
 3005                 } } } }
 3006 
 3007 To simplify input even further for the case in which both opening and closing
 3008 non-block containers are stacked, the flag B<-sac> or B<--stack-all-containers>
 3009 is an abbreviation for B<-sot -sct>.
 3010 
 3011 Please note that if both opening and closing tokens are to be stacked, then the
 3012 newer flag B<-weld-nested-containers> may be preferable because it insures that
 3013 stacking is always done symmetrically.  It also removes an extra level of
 3014 unnecessary indentation within welded containers.  It is able to do this
 3015 because it works on formatting globally rather than locally, as the B<-sot> and
 3016 B<-sct> flags do.
 3017 
 3018 =item B<-dnl>,  B<--delete-old-newlines>
 3019 
 3020 By default, perltidy first deletes all old line break locations, and then it
 3021 looks for good break points to match the desired line length.  Use B<-ndnl>
 3022 or  B<--nodelete-old-newlines> to force perltidy to retain all old line break
 3023 points.  
 3024 
 3025 =item B<-anl>,  B<--add-newlines>
 3026 
 3027 By default, perltidy will add line breaks when necessary to create
 3028 continuations of long lines and to improve the script appearance.  Use
 3029 B<-nanl> or B<--noadd-newlines> to prevent any new line breaks.  
 3030 
 3031 This flag does not prevent perltidy from eliminating existing line
 3032 breaks; see B<--freeze-newlines> to completely prevent changes to line
 3033 break points.
 3034 
 3035 =item B<Controlling whether perltidy breaks before or after operators>
 3036 
 3037 Four command line parameters provide some control over whether
 3038 a line break should be before or after specific token types.
 3039 Two parameters give detailed control:
 3040 
 3041 B<-wba=s> or B<--want-break-after=s>, and
 3042 
 3043 B<-wbb=s> or B<--want-break-before=s>.
 3044 
 3045 These parameters are each followed by a quoted string, B<s>, containing
 3046 a list of token types (separated only by spaces).  No more than one of each
 3047 of these parameters should be specified, because repeating a
 3048 command-line parameter always overwrites the previous one before
 3049 perltidy ever sees it.
 3050 
 3051 By default, perltidy breaks B<after> these token types:
 3052   % + - * / x != == >= <= =~ !~ < >  | & 
 3053   = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=
 3054 
 3055 And perltidy breaks B<before> these token types by default:
 3056   . << >> -> && || //
 3057 
 3058 To illustrate, to cause a break after a concatenation operator, C<'.'>,
 3059 rather than before it, the command line would be
 3060 
 3061   -wba="."
 3062 
 3063 As another example, the following command would cause a break before 
 3064 math operators C<'+'>, C<'-'>, C<'/'>, and C<'*'>:
 3065 
 3066   -wbb="+ - / *"
 3067 
 3068 These commands should work well for most of the token types that perltidy uses
 3069 (use B<--dump-token-types> for a list).  Also try the B<-D> flag on a short
 3070 snippet of code and look at the .DEBUG file to see the tokenization.  However,
 3071 for a few token types there may be conflicts with hardwired logic which cause
 3072 unexpected results.  One example is curly braces, which should be controlled
 3073 with the parameter B<bl> provided for that purpose.
 3074 
 3075 B<WARNING> Be sure to put these tokens in quotes to avoid having them
 3076 misinterpreted by your command shell.
 3077 
 3078 Two additional parameters are available which, though they provide no further
 3079 capability, can simplify input are:
 3080 
 3081 B<-baao> or B<--break-after-all-operators>,
 3082 
 3083 B<-bbao> or B<--break-before-all-operators>.
 3084 
 3085 The -baao sets the default to be to break after all of the following operators:
 3086 
 3087     % + - * / x != == >= <= =~ !~ < > | & 
 3088     = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=
 3089     . : ? && || and or err xor
 3090 
 3091 and the B<-bbao> flag sets the default to break before all of these operators.
 3092 These can be used to define an initial break preference which can be fine-tuned
 3093 with the B<-wba> and B<-wbb> flags.  For example, to break before all operators
 3094 except an B<=> one could use --bbao -wba='=' rather than listing every
 3095 single perl operator except B<=> on a -wbb flag.
 3096 
 3097 =back
 3098 
 3099 =head2 Controlling List Formatting
 3100 
 3101 Perltidy attempts to format lists of comma-separated values in tables which
 3102 look good.  Its default algorithms usually work well, but sometimes they don't.
 3103 In this case, there are several methods available to control list formatting.
 3104 
 3105 A very simple way to prevent perltidy from changing the line breaks
 3106 within a comma-separated list of values is to insert a blank line,
 3107 comment, or side-comment anywhere between the opening and closing
 3108 parens (or braces or brackets).   This causes perltidy to skip
 3109 over its list formatting logic.  (The reason is that any of
 3110 these items put a constraint on line breaks, and perltidy
 3111 needs complete control over line breaks within a container to
 3112 adjust a list layout).  For example, let us consider
 3113 
 3114     my @list = (1,
 3115                 1, 1,
 3116                 1, 2, 1,
 3117                 1, 3, 3, 1,
 3118                 1, 4, 6, 4, 1,);
 3119 
 3120 The default formatting, which allows a maximum line length of 80,
 3121 will flatten this down to one line:
 3122 
 3123     # perltidy (default)
 3124     my @list = ( 1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 4, 6, 4, 1, );
 3125 
 3126 This formatting loses important information.  If we place a side comment on one
 3127 of the lines, for example, we get the following result with with default formatting 
 3128 parameters:
 3129 
 3130     my @list = (
 3131         1,    # a side comment, comment, or blank keeps list intact
 3132         1, 1,
 3133         1, 2, 1,
 3134         1, 3, 3, 1,
 3135         1, 4, 6, 4, 1,
 3136     );
 3137 
 3138 We could achieve the same result with a blank line or full comment
 3139 anywhere between the opening and closing parens.
 3140 
 3141 For another possibility see
 3142 the -fs flag in L<Skipping Selected Sections of Code>.
 3143 
 3144 =over 4
 3145 
 3146 =item B<-boc>,  B<--break-at-old-comma-breakpoints>
 3147 
 3148 The B<-boc> flag is another way to prevent comma-separated lists from being
 3149 reformatted.  Using B<-boc> on the above example, plus additional flags to retain 
 3150 the original style, yields
 3151 
 3152     # perltidy -boc -lp -pt=2 -vt=1 -vtc=1
 3153     my @list = (1,
 3154                 1, 1,
 3155                 1, 2, 1,
 3156                 1, 3, 3, 1,
 3157                 1, 4, 6, 4, 1,);
 3158 
 3159 A disadvantage of this flag is that all tables in the file
 3160 must already be nicely formatted.  
 3161 
 3162 
 3163 =item B<-mft=n>,  B<--maximum-fields-per-table=n>
 3164 
 3165 If the computed number of fields for any table exceeds B<n>, then it
 3166 will be reduced to B<n>.  The default value for B<n> is a large number,
 3167 40.  While this value should probably be left unchanged as a general
 3168 rule, it might be used on a small section of code to force a list to
 3169 have a particular number of fields per line, and then either the B<-boc>
 3170 flag could be used to retain this formatting, or a single comment could
 3171 be introduced somewhere to freeze the formatting in future applications
 3172 of perltidy.
 3173 
 3174     # perltidy -mft=2
 3175     @month_of_year = (    
 3176         'Jan', 'Feb',
 3177         'Mar', 'Apr',
 3178         'May', 'Jun',
 3179         'Jul', 'Aug',
 3180         'Sep', 'Oct',
 3181         'Nov', 'Dec'
 3182     );
 3183 
 3184 =item B<-cab=n>,  B<--comma-arrow-breakpoints=n>
 3185 
 3186 A comma which follows a comma arrow, '=>', is given special
 3187 consideration.  In a long list, it is common to break at all such
 3188 commas.  This parameter can be used to control how perltidy breaks at
 3189 these commas.  (However, it will have no effect if old comma breaks are
 3190 being forced because B<-boc> is used).  The possible values of B<n> are:
 3191 
 3192  n=0 break at all commas after =>  
 3193  n=1 stable: break at all commas after => if container is open,
 3194      EXCEPT FOR one-line containers
 3195  n=2 break at all commas after =>, BUT try to form the maximum
 3196      one-line container lengths
 3197  n=3 do not treat commas after => specially at all 
 3198  n=4 break everything: like n=0 but ALSO break a short container with
 3199      a => not followed by a comma when -vt=0 is used
 3200  n=5 stable: like n=1 but ALSO break at open one-line containers when
 3201      -vt=0 is used (default)
 3202 
 3203 For example, given the following single line, perltidy by default will
 3204 not add any line breaks because it would break the existing one-line
 3205 container:
 3206 
 3207     bless { B => $B, Root => $Root } => $package;
 3208 
 3209 Using B<-cab=0> will force a break after each comma-arrow item:
 3210 
 3211     # perltidy -cab=0:
 3212     bless {
 3213         B    => $B,
 3214         Root => $Root
 3215     } => $package;
 3216 
 3217 If perltidy is subsequently run with this container broken, then by
 3218 default it will break after each '=>' because the container is now
 3219 broken.  To reform a one-line container, the parameter B<-cab=2> could
 3220 be used.
 3221 
 3222 The flag B<-cab=3> can be used to prevent these commas from being
 3223 treated specially.  In this case, an item such as "01" => 31 is
 3224 treated as a single item in a table.  The number of fields in this table
 3225 will be determined by the same rules that are used for any other table.
 3226 Here is an example.
 3227 
 3228     # perltidy -cab=3
 3229     my %last_day = (
 3230         "01" => 31, "02" => 29, "03" => 31, "04" => 30,
 3231         "05" => 31, "06" => 30, "07" => 31, "08" => 31,
 3232         "09" => 30, "10" => 31, "11" => 30, "12" => 31
 3233     );
 3234 
 3235 =back
 3236 
 3237 =head2 Retaining or Ignoring Existing Line Breaks
 3238 
 3239 Several additional parameters are available for controlling the extent
 3240 to which line breaks in the input script influence the output script.
 3241 In most cases, the default parameter values are set so that, if a choice
 3242 is possible, the output style follows the input style.  For example, if
 3243 a short logical container is broken in the input script, then the
 3244 default behavior is for it to remain broken in the output script.
 3245 
 3246 Most of the parameters in this section would only be required for a
 3247 one-time conversion of a script from short container lengths to longer
 3248 container lengths.  The opposite effect, of converting long container
 3249 lengths to shorter lengths, can be obtained by temporarily using a short
 3250 maximum line length.
 3251 
 3252 =over 4
 3253 
 3254 =item B<-bol>,  B<--break-at-old-logical-breakpoints>
 3255 
 3256 By default, if a logical expression is broken at a C<&&>, C<||>, C<and>,
 3257 or C<or>, then the container will remain broken.  Also, breaks
 3258 at internal keywords C<if> and C<unless> will normally be retained.
 3259 To prevent this, and thus form longer lines, use B<-nbol>.
 3260 
 3261 Please note that this flag does not duplicate old logical breakpoints.  They
 3262 are merely used as a hint with this flag that a statement should remain
 3263 broken.  Without this flag, perltidy will normally try to combine relatively
 3264 short expressions into a single line.
 3265 
 3266 For example, given this snippet:
 3267 
 3268     return unless $cmd = $cmd || ($dot 
 3269         && $Last_Shell) || &prompt('|');
 3270 
 3271     # perltidy -bol [default]
 3272     return
 3273       unless $cmd = $cmd
 3274       || ( $dot
 3275         && $Last_Shell )
 3276       || &prompt('|');
 3277 
 3278     # perltidy -nbol
 3279     return unless $cmd = $cmd || ( $dot && $Last_Shell ) || &prompt('|');
 3280 
 3281 =item B<-bom>,  B<--break-at-old-method-breakpoints>
 3282 
 3283 By default, a method call arrow C<-E<gt>> is considered a candidate for
 3284 a breakpoint, but method chains will fill to the line width before a break is
 3285 considered.  With B<-bom>, breaks before the arrow are preserved, so if you
 3286 have preformatted a method chain:
 3287 
 3288   my $q = $rs
 3289     ->related_resultset('CDs')
 3290     ->related_resultset('Tracks')
 3291     ->search({
 3292       'track.id' => {-ident => 'none_search.id'},
 3293     })->as_query;
 3294 
 3295 It will B<keep> these breaks, rather than become this:
 3296 
 3297   my $q = $rs->related_resultset('CDs')->related_resultset('Tracks')->search({
 3298       'track.id' => {-ident => 'none_search.id'},
 3299     })->as_query;
 3300 
 3301 This flag will also look for and keep a 'cuddled' style of calls, 
 3302 in which lines begin with a closing paren followed by a call arrow, 
 3303 as in this example:
 3304 
 3305   # perltidy -bom -wn
 3306   my $q = $rs->related_resultset(
 3307       'CDs'
 3308   )->related_resultset(
 3309       'Tracks'
 3310   )->search( {
 3311       'track.id' => { -ident => 'none_search.id' },
 3312   } )->as_query;
 3313 
 3314 You may want to include the B<-weld-nested-containers> flag in this case to keep 
 3315 nested braces and parens together, as in the last line.
 3316 
 3317 =item B<-bos>,  B<--break-at-old-semicolon-breakpoints>
 3318 
 3319 Semicolons are normally placed at the end of a statement.  This means that formatted lines do not normally begin with semicolons.  If the input stream has some lines which begin with semicolons, these can be retained by setting this flag.  For example, consider
 3320 the following two-line input snippet:
 3321 
 3322   $z = sqrt($x**2 + $y**2)
 3323   ;
 3324 
 3325 The default formatting will be:
 3326 
 3327   $z = sqrt( $x**2 + $y**2 );
 3328 
 3329 The result using B<perltidy -bos> keeps the isolated semicolon:
 3330 
 3331   $z = sqrt( $x**2 + $y**2 )
 3332     ;
 3333 
 3334 The default is not to do this, B<-nbos>. 
 3335 
 3336 
 3337 =item B<-bok>,  B<--break-at-old-keyword-breakpoints>
 3338 
 3339 By default, perltidy will retain a breakpoint before keywords which may
 3340 return lists, such as C<sort> and <map>.  This allows chains of these
 3341 operators to be displayed one per line.  Use B<-nbok> to prevent
 3342 retaining these breakpoints.
 3343 
 3344 =item B<-bot>,  B<--break-at-old-ternary-breakpoints>
 3345 
 3346 By default, if a conditional (ternary) operator is broken at a C<:>,
 3347 then it will remain broken.  To prevent this, and thereby
 3348 form longer lines, use B<-nbot>.
 3349 
 3350 =item B<-boa>,  B<--break-at-old-attribute-breakpoints>
 3351 
 3352 By default, if an attribute list is broken at a C<:> in the source file, then
 3353 it will remain broken.  For example, given the following code, the line breaks
 3354 at the ':'s will be retained:
 3355 
 3356                     my @field
 3357                       : field
 3358                       : Default(1)
 3359                       : Get('Name' => 'foo') : Set('Name');
 3360 
 3361 If the attributes are on a single line in the source code then they will remain
 3362 on a single line if possible.
 3363 
 3364 To prevent this, and thereby always form longer lines, use B<-nboa>.  
 3365 
 3366 =item B<Keeping old breakpoints at specific token types>
 3367 
 3368 Two command line parameters provide detailed control over whether
 3369 perltidy should keep an old line break before or after a specific
 3370 token type:
 3371 
 3372 B<-kbb=s> or B<--keep-old-breakpoints-before=s>, and
 3373 
 3374 B<-kba=s> or B<--keep-old-breakpoints-after=s>
 3375 
 3376 These parameters are each followed by a quoted string, B<s>, containing
 3377 a list of token types (separated only by spaces).  No more than one of each
 3378 of these parameters should be specified, because repeating a
 3379 command-line parameter always overwrites the previous one before
 3380 perltidy ever sees it.
 3381 
 3382 For example, -kbb='=>' means that if an input line begins with a '=>' then the
 3383 output script should also have a line break before that token.
 3384 
 3385 For example, given the script:
 3386 
 3387     method 'foo'
 3388       => [ Int, Int ]
 3389       => sub {
 3390         my ( $self, $x, $y ) = ( shift, @_ );
 3391         ...;
 3392       };
 3393 
 3394     # perltidy [default]
 3395     method 'foo' => [ Int, Int ] => sub {
 3396         my ( $self, $x, $y ) = ( shift, @_ );
 3397         ...;
 3398     };
 3399 
 3400     # perltidy -kbb='=>'
 3401     method 'foo'
 3402       => [ Int, Int ]
 3403       => sub {
 3404         my ( $self, $x, $y ) = ( shift, @_ );
 3405         ...;
 3406       };
 3407 
 3408 =item B<-iob>,  B<--ignore-old-breakpoints>
 3409 
 3410 Use this flag to tell perltidy to ignore existing line breaks to the
 3411 maximum extent possible.  This will tend to produce the longest possible
 3412 containers, regardless of type, which do not exceed the line length
 3413 limit. But please note that this parameter has priority over all
 3414 other parameters requesting that certain old breakpoints be kept.
 3415 
 3416 =item B<-kis>,  B<--keep-interior-semicolons>
 3417 
 3418 Use the B<-kis> flag to prevent breaking at a semicolon if
 3419 there was no break there in the input file.  Normally
 3420 perltidy places a newline after each semicolon which
 3421 terminates a statement unless several statements are
 3422 contained within a one-line brace block.  To illustrate,
 3423 consider the following input lines:
 3424 
 3425     dbmclose(%verb_delim); undef %verb_delim;
 3426     dbmclose(%expanded); undef %expanded;
 3427 
 3428 The default is to break after each statement, giving
 3429 
 3430     dbmclose(%verb_delim);
 3431     undef %verb_delim;
 3432     dbmclose(%expanded);
 3433     undef %expanded;
 3434 
 3435 With B<perltidy -kis> the multiple statements are retained:
 3436 
 3437     dbmclose(%verb_delim); undef %verb_delim;
 3438     dbmclose(%expanded);   undef %expanded;
 3439 
 3440 The statements are still subject to the specified value
 3441 of B<maximum-line-length> and will be broken if this 
 3442 maximum is exceeded.
 3443 
 3444 =back
 3445 
 3446 =head2 Blank Line Control
 3447 
 3448 Blank lines can improve the readability of a script if they are carefully
 3449 placed.  Perltidy has several commands for controlling the insertion,
 3450 retention, and removal of blank lines.  
 3451 
 3452 =over 4
 3453 
 3454 =item B<-fbl>,  B<--freeze-blank-lines>
 3455 
 3456 Set B<-fbl> if you want to the blank lines in your script to
 3457 remain exactly as they are.  The rest of the parameters in
 3458 this section may then be ignored.  (Note: setting the B<-fbl> flag
 3459 is equivalent to setting B<-mbl=0> and B<-kbl=2>).
 3460 
 3461 =item B<-bbc>,  B<--blanks-before-comments>
 3462 
 3463 A blank line will be introduced before a full-line comment.  This is the
 3464 default.  Use B<-nbbc> or  B<--noblanks-before-comments> to prevent
 3465 such blank lines from being introduced.
 3466 
 3467 =item B<-blbs=n>,  B<--blank-lines-before-subs=n>
 3468 
 3469 The parameter B<-blbs=n> requests that least B<n> blank lines precede a sub
 3470 definition which does not follow a comment and which is more than one-line
 3471 long.  The default is <-blbs=1>.  B<BEGIN> and B<END> blocks are included.
 3472 
 3473 The requested number of blanks statement will be inserted regardless of the
 3474 value of B<--maximum-consecutive-blank-lines=n> (B<-mbl=n>) with the exception
 3475 that if B<-mbl=0> then no blanks will be output.
 3476 
 3477 This parameter interacts with the value B<k> of the parameter B<--maximum-consecutive-blank-lines=k> (B<-mbl=k>) as follows:
 3478 
 3479 1. If B<-mbl=0> then no blanks will be output.  This allows all blanks to be suppressed with a single parameter.  Otherwise,
 3480 
 3481 2. If the number of old blank lines in the script is less than B<n> then
 3482 additional blanks will be inserted to make the total B<n> regardless of the
 3483 value of B<-mbl=k>.  
 3484 
 3485 3. If the number of old blank lines in the script equals or exceeds B<n> then
 3486 this parameter has no effect, however the total will not exceed
 3487 value specified on the B<-mbl=k> flag.
 3488 
 3489 
 3490 =item B<-blbp=n>,  B<--blank-lines-before-packages=n>
 3491 
 3492 The parameter B<-blbp=n> requests that least B<n> blank lines precede a package
 3493 which does not follow a comment.  The default is B<-blbp=1>.  
 3494 
 3495 This parameter interacts with the value B<k> of the parameter
 3496 B<--maximum-consecutive-blank-lines=k> (B<-mbl=k>) in the same way as described
 3497 for the previous item B<-blbs=n>.
 3498 
 3499 
 3500 =item B<-bbs>,  B<--blanks-before-subs>
 3501 
 3502 For compatibility with previous versions, B<-bbs> or B<--blanks-before-subs>
 3503 is equivalent to F<-blbp=1> and F<-blbs=1>.  
 3504 
 3505 Likewise, B<-nbbs> or B<--noblanks-before-subs> 
 3506 is equivalent to F<-blbp=0> and F<-blbs=0>.  
 3507 
 3508 =item B<-bbb>,  B<--blanks-before-blocks>
 3509 
 3510 A blank line will be introduced before blocks of coding delimited by
 3511 B<for>, B<foreach>, B<while>, B<until>, and B<if>, B<unless>, in the following
 3512 circumstances:
 3513 
 3514 =over 4
 3515 
 3516 =item *
 3517 
 3518 The block is not preceded by a comment.
 3519 
 3520 =item *
 3521 
 3522 The block is not a one-line block.
 3523 
 3524 =item *
 3525 
 3526 The number of consecutive non-blank lines at the current indentation depth is at least B<-lbl>
 3527 (see next section).
 3528 
 3529 =back
 3530 
 3531 This is the default.  The intention of this option is to introduce
 3532 some space within dense coding.
 3533 This is negated with B<-nbbb> or  B<--noblanks-before-blocks>.
 3534 
 3535 =item B<-lbl=n> B<--long-block-line-count=n>
 3536 
 3537 This controls how often perltidy is allowed to add blank lines before 
 3538 certain block types (see previous section).  The default is 8.  Entering
 3539 a value of B<0> is equivalent to entering a very large number.
 3540 
 3541 =item B<-blao=i> or B<--blank-lines-after-opening-block=i>
 3542 
 3543 This control places a minimum of B<i> blank lines B<after> a line which B<ends>
 3544 with an opening block brace of a specified type.  By default, this only applies
 3545 to the block of a named B<sub>, but this can be changed (see B<-blaol> below).
 3546 The default is not to do this (B<i=0>).
 3547 
 3548 Please see the note below on using the B<-blao> and B<-blbc> options.
 3549 
 3550 =item B<-blbc=i> or B<--blank-lines-before-closing-block=i>
 3551 
 3552 This control places a minimum of B<i> blank lines B<before> a line which
 3553 B<begins> with a closing block brace of a specified type.  By default, this
 3554 only applies to the block of a named B<sub>, but this can be changed (see
 3555 B<-blbcl> below).  The default is not to do this (B<i=0>).
 3556 
 3557 =item B<-blaol=s> or B<--blank-lines-after-opening-block-list=s>
 3558 
 3559 The parameter B<s> is a list of block type keywords to which the flag B<-blao>
 3560 should apply.  The section L<"Specifying Block Types"> explains how to list
 3561 block types.
 3562 
 3563 =item B<-blbcl=s> or B<--blank-lines-before-closing-block-list=s>
 3564 
 3565 This parameter is a list of block type keywords to which the flag B<-blbc>
 3566 should apply.  The section L<"Specifying Block Types"> explains how to list
 3567 block types.
 3568 
 3569 =item B<Note on using the> B<-blao> and B<-blbc> options.
 3570 
 3571 These blank line controls introduce a certain minimum number of blank lines in
 3572 the text, but the final number of blank lines may be greater, depending on
 3573 values of the other blank line controls and the number of old blank lines.  A
 3574 consequence is that introducing blank lines with these and other controls
 3575 cannot be exactly undone, so some experimentation with these controls is
 3576 recommended before using them.
 3577 
 3578 For example, suppose that for some reason we decide to introduce one blank
 3579 space at the beginning and ending of all blocks.  We could do
 3580 this using
 3581 
 3582   perltidy -blao=2 -blbc=2 -blaol='*' -blbcl='*' filename
 3583 
 3584 Now suppose the script continues to be developed, but at some later date we
 3585 decide we don't want these spaces after all. We might expect that running with
 3586 the flags B<-blao=0> and B<-blbc=0> will undo them.  However, by default
 3587 perltidy retains single blank lines, so the blank lines remain.  
 3588 
 3589 We can easily fix this by telling perltidy to ignore old blank lines by
 3590 including the added parameter B<-kbl=0> and rerunning. Then the unwanted blank
 3591 lines will be gone.  However, this will cause all old blank lines to be
 3592 ignored, perhaps even some that were added by hand to improve formatting. So
 3593 please be cautious when using these parameters.
 3594 
 3595 =item B<-mbl=n> B<--maximum-consecutive-blank-lines=n>   
 3596 
 3597 This parameter specifies the maximum number of consecutive blank lines which
 3598 will be output within code sections of a script.  The default is n=1.  If the
 3599 input file has more than n consecutive blank lines, the number will be reduced
 3600 to n except as noted above for the B<-blbp> and B<-blbs> parameters.  If B<n=0>
 3601 then no blank lines will be output (unless all old blank lines are retained
 3602 with the B<-kbl=2> flag of the next section).
 3603 
 3604 This flag obviously does not apply to pod sections,
 3605 here-documents, and quotes.  
 3606 
 3607 =item B<-kbl=n>,  B<--keep-old-blank-lines=n>
 3608 
 3609 The B<-kbl=n> flag gives you control over how your existing blank lines are
 3610 treated.  
 3611 
 3612 The possible values of B<n> are:
 3613 
 3614  n=0 ignore all old blank lines
 3615  n=1 stable: keep old blanks, but limited by the value of the B<-mbl=n> flag
 3616  n=2 keep all old blank lines, regardless of the value of the B<-mbl=n> flag
 3617 
 3618 The default is B<n=1>.  
 3619 
 3620 =item B<-sob>,  B<--swallow-optional-blank-lines>
 3621 
 3622 This is equivalent to B<kbl=0> and is included for compatibility with
 3623 previous versions.
 3624 
 3625 =item B<-nsob>,  B<--noswallow-optional-blank-lines>
 3626 
 3627 This is equivalent to B<kbl=1> and is included for compatibility with
 3628 previous versions.
 3629 
 3630 =back
 3631 
 3632 B<Controls for blank lines around lines of consecutive keywords>
 3633 
 3634 The parameters in this section provide some control over the placement of blank
 3635 lines within and around groups of statements beginning with selected keywords.
 3636 These blank lines are called here B<keyword group blanks>, and all of the
 3637 parameters begin with B<--keyword-group-blanks*>, or B<-kgb*> for short.  The
 3638 default settings do not employ these controls but they can be enabled with the
 3639 following parameters:
 3640 
 3641 B<-kgbl=s> or B<--keyword-group-blanks-list=s>; B<s> is a quoted string of keywords
 3642 
 3643 B<-kgbs=s> or B<--keyword-group-blanks-size=s>; B<s> gives the number of keywords required to form a group.  
 3644 
 3645 B<-kgbb=n> or B<--keyword-group-blanks-before=n>; B<n> = (0, 1, or 2) controls a leading blank
 3646 
 3647 B<-kgba=n> or B<--keyword-group-blanks-after=n>; B<n> = (0, 1, or 2) controls a trailing blank
 3648 
 3649 B<-kgbi> or B<--keyword-group-blanks-inside> is a switch for adding blanks between subgroups
 3650 
 3651 B<-kgbd> or B<--keyword-group-blanks-delete> is a switch for removing initial blank lines between keywords
 3652 
 3653 B<-kgbr=n> or B<--keyword-group-blanks-repeat-count=n> can limit the number of times this logic is applied
 3654 
 3655 In addition, the following abbreviations are available to for simplified usage:
 3656 
 3657 B<-kgb> or B<--keyword-group-blanks> is short for B<-kgbb=2 -kgba=2 kgbi>
 3658 
 3659 B<-nkgb> or B<--nokeyword-group-blanks>, is short for B<-kgbb=1 -kgba=1 nkgbi>
 3660 
 3661 Before describing the meaning of the parameters in detail let us look at an
 3662 example which is formatted with default parameter settings.
 3663 
 3664         print "Entering test 2\n";
 3665         use Test;
 3666         use Encode qw(from_to encode decode
 3667           encode_utf8 decode_utf8
 3668           find_encoding is_utf8);
 3669         use charnames qw(greek);
 3670         my @encodings     = grep( /iso-?8859/, Encode::encodings() );
 3671         my @character_set = ( '0' .. '9', 'A' .. 'Z', 'a' .. 'z' );
 3672         my @source        = qw(ascii iso8859-1 cp1250);
 3673         my @destiny       = qw(cp1047 cp37 posix-bc);
 3674         my @ebcdic_sets   = qw(cp1047 cp37 posix-bc);
 3675         my $str           = join( '', map( chr($_), 0x20 .. 0x7E ) );
 3676         return unless ($str);
 3677 
 3678 using B<perltidy -kgb> gives:
 3679 
 3680         print "Entering test 2\n";
 3681                                       <----------this blank controlled by -kgbb
 3682         use Test;
 3683         use Encode qw(from_to encode decode
 3684           encode_utf8 decode_utf8
 3685           find_encoding is_utf8);
 3686         use charnames qw(greek);
 3687                                       <---------this blank controlled by -kgbi
 3688         my @encodings     = grep( /iso-?8859/, Encode::encodings() );
 3689         my @character_set = ( '0' .. '9', 'A' .. 'Z', 'a' .. 'z' );
 3690         my @source        = qw(ascii iso8859-1 cp1250);
 3691         my @destiny       = qw(cp1047 cp37 posix-bc);
 3692         my @ebcdic_sets   = qw(cp1047 cp37 posix-bc);
 3693         my $str           = join( '', map( chr($_), 0x20 .. 0x7E ) );
 3694                                       <----------this blank controlled by -kgba
 3695         return unless ($str);
 3696 
 3697 Blank lines have been introduced around the B<my> and B<use> sequences.  What
 3698 happened is that the default keyword list includes B<my> and B<use> but not
 3699 B<print> and B<return>.  So a continuous sequence of nine B<my> and B<use>
 3700 statements was located.  This number exceeds the default threshold of five, so
 3701 blanks were placed before and after the entire group.  Then, since there was
 3702 also a subsequence of six B<my> lines, a blank line was introduced to separate
 3703 them.
 3704 
 3705 Finer control over blank placement can be achieved by using the individual
 3706 parameters rather than the B<-kgb> flag.  The individual controls are as follows.
 3707 
 3708 B<-kgbl=s> or B<--keyword-group-blanks-list=s>, where B<s> is a quoted string,
 3709 defines the set of keywords which will be formed into groups.  The string is a
 3710 space separated list of keywords.  The default set is B<s="use require local
 3711 our my">, but any list of keywords may be used. Comment lines may also be included in a keyword group, even though they are not keywords.  To include ordinary block comments, include the symbol B<BC>. To include static block comments (which normally begin with '##'), include the symbol B<SBC>.
 3712 
 3713 B<-kgbs=s> or B<--keyword-group-blanks-size=s>, where B<s> is a string
 3714 describing the number of consecutive keyword statements forming a group.  If
 3715 B<s> is an integer then it is the minimum number required for a group.  A
 3716 maximum value may also be given with the format B<s=min.max>, where B<min> is
 3717 the minimum number and B<max> is the maximum number, and the min and max values
 3718 are separated by one or more dots.  No groups will be found if the maximum is
 3719 less than the minimum.  The maximum is unlimited if not given.  The default is
 3720 B<s=5>.  Some examples:
 3721 
 3722     s      min   max         number for group
 3723     3      3     unlimited   3 or more
 3724     1.1    1     1           1
 3725     1..3   1     3           1 to 3
 3726     1.0    1     0           (no match)
 3727     
 3728 
 3729 B<-kgbb=n> or B<--keyword-group-blanks-before=n> specifies whether
 3730 a blank should appear before the first line of the group, as follows:
 3731 
 3732    n=0 => (delete) an existing blank line will be removed
 3733    n=1 => (stable) no change to the input file is made  [DEFAULT]
 3734    n=2 => (insert) a blank line is introduced if possible
 3735 
 3736 B<-kgba=n> or B<--keyword-group-blanks-after=n> likewise specifies
 3737 whether a blank should appear after the last line of the group, using the same
 3738 scheme (0=delete, 1=stable, 2=insert).
 3739 
 3740 B<-kgbi> or B<--keyword-group-blanks-inside> controls
 3741 the insertion of blank lines between the first and last statement of the entire
 3742 group.  If there is a continuous run of a single statement type with more than
 3743 the minimum threshold number (as specified with B<-kgbs=s>) then this
 3744 switch causes a blank line be inserted between this
 3745 subgroup and the others. In the example above this happened between the
 3746 B<use> and B<my> statements.
 3747 
 3748 B<-kgbd> or B<--keyword-group-blanks-delete> controls the deletion of any
 3749 blank lines that exist in the the group when it is first scanned.  When
 3750 statements are initially scanned, any existing blank lines are included in the
 3751 collection.  Any such orignial blank lines will be deleted before any other
 3752 insertions are made when the parameter B<-kgbd> is set.  The default is not to
 3753 do this, B<-nkgbd>.  
 3754 
 3755 B<-kgbr=n> or B<--keyword-group-blanks-repeat-count=n> specifies B<n>, the
 3756 maximum number of times this logic will be applied to any file.  The special
 3757 value B<n=0> is the same as n=infinity which means it will be applied to an
 3758 entire script [Default].  A value B<n=1> could be used to make it apply just
 3759 one time for example.  This might be useful for adjusting just the B<use>
 3760 statements in the top part of a module for example.
 3761 
 3762 B<-kgb> or B<--keyword-group-blanks> is an abbreviation equivalent to setting
 3763 B<-kgbb=1 -kgba=1 -kgbi>.  This turns on keyword group formatting with a set of
 3764 default values.  
 3765 
 3766 B<-nkgb> or B<--nokeyword-group-blanks> is equivalent to B<-kgbb=0 -kgba
 3767 nkgbi>.  This flag turns off keyword group blank lines and is the default
 3768 setting. 
 3769 
 3770 Here are a few notes about the functioning of this technique.  
 3771 
 3772 =over 4
 3773 
 3774 =item *
 3775 
 3776 These parameters are probably more useful as part of a major code reformatting
 3777 operation rather than as a routine formatting operation.
 3778 
 3779 In particular, note that deleting old blank lines with B<-kgbd> is an
 3780 irreversible operation so it should be applied with care.  Existing blank lines
 3781 may be serving an important role in controlling vertical alignment.
 3782 
 3783 =item *
 3784 
 3785 Conflicts which arise among these B<kgb*> parameters and other blank line
 3786 controls are generally resolved by producing the maximum number of blank lines
 3787 implied by any parameter.
 3788 
 3789 For example, if the flags B<--freeze-blank-lines>, or
 3790 B<--keep-old-blank-lines=2>, are set, then they have priority over any blank
 3791 line deletion implied by the B<-kgb> flags of this section, so no blank lines
 3792 will be deleted.
 3793 
 3794 For another example, if a keyword group ends at a B<sub> and the flag B<kgba=0> requests no blank line there, but we also have B<--blank-lines-before-subs=2>, then two blank lines will still be introduced before the sub.
 3795 
 3796 =item *
 3797 
 3798 The introduction of blank lines does not occur if it would conflict with other
 3799 input controls or code validity. For example, a blank line will not be placed
 3800 within a here-doc or within a section of code marked with format skipping
 3801 comments.  And in general, a blank line will only be introduced at the end of a
 3802 group if the next statement is a line of code. 
 3803 
 3804 =item *
 3805 
 3806 The count which is used to determine the group size is not the number of lines
 3807 but rather the total number of keywords which are found.  Individual statements
 3808 with a certain leading keyword may continue on multiple lines, but if any of
 3809 these lines is nested more than one level deep then that group will be ended.
 3810 
 3811 =item *
 3812 
 3813 The search for groups of lines with similar leading keywords is based on the
 3814 input source, not the final formatted source.  Consequently, if the source code
 3815 is badly formatted, it would be best to make a first formatting pass without
 3816 these options.
 3817 
 3818 =back
 3819 
 3820 =head2 Styles
 3821 
 3822 A style refers to a convenient collection of existing parameters.
 3823 
 3824 =over 4
 3825 
 3826 =item B<-gnu>, B<--gnu-style>
 3827 
 3828 B<-gnu> gives an approximation to the GNU Coding Standards (which do
 3829 not apply to perl) as they are sometimes implemented.  At present, this
 3830 style overrides the default style with the following parameters:
 3831 
 3832     -lp -bl -noll -pt=2 -bt=2 -sbt=2 -icp
 3833 
 3834 =item B<-pbp>, B<--perl-best-practices>
 3835 
 3836 B<-pbp> is an abbreviation for the parameters in the book B<Perl Best Practices>
 3837 by Damian Conway:
 3838 
 3839     -l=78 -i=4 -ci=4 -st -se -vt=2 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nsfs -nolq
 3840     -wbb="% + - * / x != == >= <= =~ !~ < > | & = 
 3841           **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x="
 3842 
 3843 Please note that this parameter set includes -st and -se flags, which make
 3844 perltidy act as a filter on one file only.  These can be overridden by placing
 3845 B<-nst> and/or B<-nse> after the -pbp parameter. 
 3846 
 3847 Also note that the value of continuation indentation, -ci=4, is equal to the
 3848 value of the full indentation, -i=4.  It is recommended that the either (1) the
 3849 parameter B<-ci=2> be used instead, or the flag B<-xci> be set.  This will help
 3850 show structure, particularly when there are ternary statements. The following
 3851 snippet illustrates these options.
 3852 
 3853     # perltidy -pbp
 3854     $self->{_text} = (
 3855          !$section        ? ''
 3856         : $type eq 'item' ? "the $section entry"
 3857         :                   "the section on $section"
 3858         )
 3859         . (
 3860         $page
 3861         ? ( $section ? ' in ' : '' ) . "the $page$page_ext manpage"
 3862         : ' elsewhere in this document'
 3863         );
 3864 
 3865     # perltidy -pbp -ci=2
 3866     $self->{_text} = (
 3867          !$section        ? ''
 3868         : $type eq 'item' ? "the $section entry"
 3869         :                   "the section on $section"
 3870       )
 3871       . (
 3872         $page
 3873         ? ( $section ? ' in ' : '' ) . "the $page$page_ext manpage"
 3874         : ' elsewhere in this document'
 3875       );
 3876 
 3877     # perltidy -pbp -xci
 3878     $self->{_text} = (
 3879          !$section        ? ''
 3880         : $type eq 'item' ? "the $section entry"
 3881         :                   "the section on $section"
 3882         )
 3883         . ( $page
 3884             ? ( $section ? ' in ' : '' ) . "the $page$page_ext manpage"
 3885             : ' elsewhere in this document'
 3886         );
 3887 
 3888 The B<-xci> flag was developed after the B<-pbp> parameters were published so you need
 3889 to include it separately.
 3890 
 3891 =item B<One-line blocks>
 3892 
 3893 There are a few points to note regarding one-line blocks.  A one-line
 3894 block is something like this,
 3895 
 3896 
 3897 where the contents within the curly braces is short enough to fit
 3898 on a single line.
 3899 
 3900 With few exceptions, perltidy retains existing one-line blocks, if it
 3901 is possible within the line-length constraint, but it does not attempt
 3902 to form new ones.  In other words, perltidy will try to follow the
 3903 one-line block style of the input file.
 3904 
 3905 If an existing one-line block is longer than the maximum line length,
 3906 however, it will be broken into multiple lines.  When this happens, perltidy
 3907 checks for and adds any optional terminating semicolon (unless the B<-nasc>
 3908 option is used) if the block is a code block.  
 3909 
 3910 The main exception is that perltidy will attempt to form new one-line
 3911 blocks following the keywords C<map>, C<eval>, and C<sort>, because
 3912 these code blocks are often small and most clearly displayed in a single
 3913 line.
 3914 
 3915 One-line block rules can conflict with the cuddled-else option.  When
 3916 the cuddled-else option is used, perltidy retains existing one-line
 3917 blocks, even if they do not obey cuddled-else formatting.
 3918 
 3919 Occasionally, when one-line blocks get broken because they exceed the
 3920 available line length, the formatting will violate the requested brace style.
 3921 If this happens, reformatting the script a second time should correct
 3922 the problem.
 3923 
 3924 Sometimes it might be desirable to convert a script to have one-line blocks
 3925 whenever possible.  Although there is currently no flag for this, a simple
 3926 workaround is to execute perltidy twice, once with the flag B<-noadd-newlines>
 3927 and then once again with normal parameters, like this:  
 3928 
 3929      cat infile | perltidy -nanl | perltidy >outfile
 3930 
 3931 When executed on this snippet
 3932 
 3933     if ( $? == -1 ) {
 3934         die "failed to execute: $!\n";
 3935     }
 3936     if ( $? == -1 ) {
 3937         print "Had enough.\n";
 3938         die "failed to execute: $!\n";
 3939     }
 3940 
 3941 the result is
 3942 
 3943     if ( $? == -1 ) { die "failed to execute: $!\n"; }
 3944     if ( $? == -1 ) {
 3945         print "Had enough.\n";
 3946         die "failed to execute: $!\n";
 3947     }
 3948 
 3949 This shows that blocks with a single statement become one-line blocks.
 3950 
 3951 =item B<-olbs=n>, B<--one-line-block-semicolons=n>
 3952 
 3953 This flag controls the placement of semicolons at the end of one-line blocks.
 3954 Semicolons are optional before a closing block brace, and frequently they are
 3955 omitted at the end of a one-line block containing just a single statement.
 3956 By default, perltidy follows the input file regarding these semicolons, 
 3957 but this behavior can be controlled by this flag.  The values of n are:
 3958 
 3959   n=0 remove terminal semicolons in one-line blocks having a single statement
 3960   n=1 stable; keep input file placement of terminal semicolons [DEFAULT ]
 3961   n=2 add terminal semicolons in all one-line blocks
 3962 
 3963 Note that the B<n=2> option has no effect if adding semicolons is prohibited
 3964 with the B<-nasc> flag.  Also not that while B<n=2> adds missing semicolons to
 3965 all one-line blocks, regardless of complexity, the B<n=0> option only removes
 3966 ending semicolons which terminate one-line blocks containing just one
 3967 semicolon.  So these two options are not exact inverses.
 3968 
 3969 =item B<-olbn=n>, B<--one-line-block-nesting=n>
 3970 
 3971 Nested one-line blocks are lines with code blocks which themselves contain code
 3972 blocks.  For example, the following line is a nested one-line block.
 3973 
 3974          foreach (@list) { if ($_ eq $asked_for) { last } ++$found }
 3975 
 3976 The default behavior is to break such lines into multiple lines, but this
 3977 behavior can be controlled with this flag.  The values of n are:
 3978 
 3979   n=0 break nested one-line blocks into multiple lines [DEFAULT]
 3980   n=1 stable: keep existing nested-one line blocks intact
 3981 
 3982 For the above example, the default formatting (B<-olbn=0>) is
 3983 
 3984     foreach (@list) {
 3985         if ( $_ eq $asked_for ) { last }
 3986         ++$found;
 3987     }
 3988 
 3989 If the parameter B<-olbn=1> is given, then the line will be left intact if it
 3990 is a single line in the source, or it will be broken into multiple lines if it 
 3991 is broken in multiple lines in the source.
 3992 
 3993 
 3994 =back
 3995 
 3996 
 3997 =head2 Controlling Vertical Alignment
 3998 
 3999 Vertical alignment refers to lining up certain symbols in a list of consecutive
 4000 similar lines to improve readability.  For example, the "fat commas" are
 4001 aligned in the following statement:
 4002 
 4003         $data = $pkg->new(
 4004             PeerAddr => join( ".", @port[ 0 .. 3 ] ),   
 4005             PeerPort => $port[4] * 256 + $port[5],
 4006             Proto    => 'tcp'
 4007         );
 4008 
 4009 Vertical alignment can be completely turned off using B<-novalign>, a flag
 4010 mainly intended for debugging.  However, vertical alignment can be forced to
 4011 stop and restart by selectively introducing blank lines.  For example, a blank
 4012 has been inserted in the following code to keep somewhat similar things
 4013 aligned.
 4014 
 4015     %option_range = (
 4016         'format'             => [ 'tidy', 'html', 'user' ],
 4017         'output-line-ending' => [ 'dos',  'win',  'mac', 'unix' ],
 4018         'character-encoding' => [ 'none', 'utf8' ],
 4019 
 4020         'block-brace-tightness'    => [ 0, 2 ],
 4021         'brace-tightness'          => [ 0, 2 ],
 4022         'paren-tightness'          => [ 0, 2 ],
 4023         'square-bracket-tightness' => [ 0, 2 ],
 4024     );
 4025 
 4026 Vertical alignment is implemented by locally increasing an existing blank space
 4027 to produce alignment with an adjacent line.  It cannot occur if there is no
 4028 blank space to increase.  So if a particular space is removed by one of the
 4029 existing controls then vertical alignment cannot occur. Likewise, if a space is
 4030 added with one of the controls, then vertical alignment might occur.
 4031 
 4032 For example, 
 4033 
 4034         # perltidy -nwls='=>'
 4035         $data = $pkg->new(
 4036             PeerAddr=> join( ".", @port[ 0 .. 3 ] ),
 4037             PeerPort=> $port[4] * 256 + $port[5],
 4038             Proto=> 'tcp'
 4039         );
 4040 
 4041 =head2 Other Controls
 4042 
 4043 =over 4
 4044 
 4045 =item B<Deleting selected text>
 4046 
 4047 Perltidy can selectively delete comments and/or pod documentation.  The
 4048 command B<-dac> or  B<--delete-all-comments> will delete all comments
 4049 B<and> all pod documentation, leaving just code and any leading system
 4050 control lines.
 4051 
 4052 The command B<-dp> or B<--delete-pod> will remove all pod documentation
 4053 (but not comments).
 4054 
 4055 Two commands which remove comments (but not pod) are: B<-dbc> or
 4056 B<--delete-block-comments> and B<-dsc> or  B<--delete-side-comments>.
 4057 (Hanging side comments will be deleted with side comments here.)
 4058 
 4059 The negatives of these commands also work, and are the defaults.  When
 4060 block comments are deleted, any leading 'hash-bang' will be retained.
 4061 Also, if the B<-x> flag is used, any system commands before a leading
 4062 hash-bang will be retained (even if they are in the form of comments).
 4063 
 4064 =item B<Writing selected text to a file>
 4065 
 4066 When perltidy writes a formatted text file, it has the ability to also
 4067 send selected text to a file with a F<.TEE> extension.  This text can
 4068 include comments and pod documentation.  
 4069 
 4070 The command B<-tac> or  B<--tee-all-comments> will write all comments
 4071 B<and> all pod documentation.
 4072 
 4073 The command B<-tp> or B<--tee-pod> will write all pod documentation (but
 4074 not comments).
 4075 
 4076 The commands which write comments (but not pod) are: B<-tbc> or
 4077 B<--tee-block-comments> and B<-tsc> or  B<--tee-side-comments>.
 4078 (Hanging side comments will be written with side comments here.)
 4079 
 4080 The negatives of these commands also work, and are the defaults.  
 4081 
 4082 =item B<Using a F<.perltidyrc> command file>
 4083 
 4084 If you use perltidy frequently, you probably won't be happy until you
 4085 create a F<.perltidyrc> file to avoid typing commonly-used parameters.
 4086 Perltidy will first look in your current directory for a command file
 4087 named F<.perltidyrc>.  If it does not find one, it will continue looking
 4088 for one in other standard locations.  
 4089 
 4090 These other locations are system-dependent, and may be displayed with
 4091 the command C<perltidy -dpro>.  Under Unix systems, it will first look
 4092 for an environment variable B<PERLTIDY>.  Then it will look for a
 4093 F<.perltidyrc> file in the home directory, and then for a system-wide
 4094 file F</usr/local/etc/perltidyrc>, and then it will look for
 4095 F</etc/perltidyrc>.  Note that these last two system-wide files do not
 4096 have a leading dot.  Further system-dependent information will be found
 4097 in the INSTALL file distributed with perltidy.
 4098 
 4099 Under Windows, perltidy will also search for a configuration file named perltidy.ini since Windows does not allow files with a leading period (.).
 4100 Use C<perltidy -dpro> to see the possible locations for your system.
 4101 An example might be F<C:\Documents and Settings\All Users\perltidy.ini>.
 4102 
 4103 Another option is the use of the PERLTIDY environment variable.
 4104 The method for setting environment variables depends upon the version of
 4105 Windows that you are using.  Instructions for Windows 95 and later versions can
 4106 be found here:
 4107 
 4108 http://www.netmanage.com/000/20021101_005_tcm21-6336.pdf
 4109 
 4110 Under Windows NT / 2000 / XP the PERLTIDY environment variable can be placed in
 4111 either the user section or the system section.  The later makes the
 4112 configuration file common to all users on the machine.  Be sure to enter the
 4113 full path of the configuration file in the value of the environment variable.
 4114 Ex.  PERLTIDY=C:\Documents and Settings\perltidy.ini
 4115 
 4116 The configuration file is free format, and simply a list of parameters, just as
 4117 they would be entered on a command line.  Any number of lines may be used, with
 4118 any number of parameters per line, although it may be easiest to read with one
 4119 parameter per line.  Comment text begins with a #, and there must
 4120 also be a space before the # for side comments.  It is a good idea to
 4121 put complex parameters in either single or double quotes.
 4122 
 4123 Here is an example of a F<.perltidyrc> file:
 4124 
 4125   # This is a simple of a .perltidyrc configuration file
 4126   # This implements a highly spaced style
 4127   -se    # errors to standard error output
 4128   -w     # show all warnings
 4129   -bl    # braces on new lines
 4130   -pt=0  # parens not tight at all
 4131   -bt=0  # braces not tight
 4132   -sbt=0 # square brackets not tight
 4133 
 4134 The parameters in the F<.perltidyrc> file are installed first, so any
 4135 parameters given on the command line will have priority over them.  
 4136 
 4137 To avoid confusion, perltidy ignores any command in the .perltidyrc
 4138 file which would cause some kind of dump and an exit.  These are:
 4139 
 4140  -h -v -ddf -dln -dop -dsn -dtt -dwls -dwrs -ss
 4141 
 4142 There are several options may be helpful in debugging a F<.perltidyrc>
 4143 file:  
 4144 
 4145 =over 4
 4146 
 4147 =item *
 4148 
 4149 A very helpful command is B<--dump-profile> or B<-dpro>.  It writes a
 4150 list of all configuration filenames tested to standard output, and 
 4151 if a file is found, it dumps the content to standard output before
 4152 exiting.  So, to find out where perltidy looks for its configuration
 4153 files, and which one if any it selects, just enter 
 4154 
 4155   perltidy -dpro
 4156 
 4157 =item *
 4158 
 4159 It may be simplest to develop and test configuration files with
 4160 alternative names, and invoke them with B<-pro=filename> on the command
 4161 line.  Then rename the desired file to F<.perltidyrc> when finished.
 4162 
 4163 =item *
 4164 
 4165 The parameters in the F<.perltidyrc> file can be switched off with 
 4166 the B<-npro> option.
 4167 
 4168 =item *
 4169 
 4170 The commands B<--dump-options>, B<--dump-defaults>, B<--dump-long-names>,
 4171 and B<--dump-short-names>, all described below, may all be helpful.
 4172 
 4173 =back
 4174 
 4175 =item B<Creating a new abbreviation>
 4176 
 4177 A special notation is available for use in a F<.perltidyrc> file
 4178 for creating an abbreviation for a group
 4179 of options.  This can be used to create a
 4180 shorthand for one or more styles which are frequently, but not always,
 4181 used.  The notation is to group the options within curly braces which
 4182 are preceded by the name of the alias (without leading dashes), like this:
 4183 
 4184     newword {
 4185     -opt1
 4186     -opt2
 4187     }
 4188 
 4189 where B<newword> is the abbreviation, and B<opt1>, etc, are existing parameters
 4190 I<or other abbreviations>.  The main syntax requirement is that the new
 4191 abbreviation along with its opening curly brace must begin on a new line.
 4192 Space before and after the curly braces is optional.
 4193 
 4194 For a specific example, the following line
 4195 
 4196         oneliner { --maximum-line-length=0 --noadd-newlines --noadd-terminal-newline}
 4197 
 4198 or equivalently with abbreviations
 4199 
 4200     oneliner { -l=0 -nanl -natnl }
 4201 
 4202 could be placed in a F<.perltidyrc> file to temporarily override the maximum
 4203 line length with a large value, to temporarily prevent new line breaks from
 4204 being added, and to prevent an extra newline character from being added the
 4205 file.  All other settings in the F<.perltidyrc> file still apply.  Thus it
 4206 provides a way to format a long 'one liner' when perltidy is invoked with
 4207 
 4208     perltidy --oneliner ...
 4209 
 4210 (Either C<-oneliner> or C<--oneliner> may be used).   
 4211 
 4212 =item Skipping leading non-perl commands with B<-x> or B<--look-for-hash-bang>
 4213 
 4214 If your script has leading lines of system commands or other text which
 4215 are not valid perl code, and which are separated from the start of the
 4216 perl code by a "hash-bang" line, ( a line of the form C<#!...perl> ),
 4217 you must use the B<-x> flag to tell perltidy not to parse and format any
 4218 lines before the "hash-bang" line.  This option also invokes perl with a
 4219 -x flag when checking the syntax.  This option was originally added to
 4220 allow perltidy to parse interactive VMS scripts, but it should be used
 4221 for any script which is normally invoked with C<perl -x>.
 4222 
 4223 Please note: do not use this flag unless you are sure your script needs it.
 4224 Parsing errors can occur if it does not have a hash-bang, or, for example, if
 4225 the actual first hash-bang is in a here-doc. In that case a parsing error will
 4226 occur because the tokenization will begin in the middle of the here-doc.
 4227 
 4228 =item B<Making a file unreadable>
 4229 
 4230 The goal of perltidy is to improve the readability of files, but there
 4231 are two commands which have the opposite effect, B<--mangle> and
 4232 B<--extrude>.  They are actually
 4233 merely aliases for combinations of other parameters.  Both of these
 4234 strip all possible whitespace, but leave comments and pod documents,
 4235 so that they are essentially reversible.  The
 4236 difference between these is that B<--mangle> puts the fewest possible
 4237 line breaks in a script while B<--extrude> puts the maximum possible.
 4238 Note that these options do not provided any meaningful obfuscation, because
 4239 perltidy can be used to reformat the files.  They were originally
 4240 developed to help test the tokenization logic of perltidy, but they
 4241 have other uses.
 4242 One use for B<--mangle> is the following:
 4243 
 4244   perltidy --mangle myfile.pl -st | perltidy -o myfile.pl.new
 4245 
 4246 This will form the maximum possible number of one-line blocks (see next
 4247 section), and can sometimes help clean up a badly formatted script.
 4248 
 4249 A similar technique can be used with B<--extrude> instead of B<--mangle>
 4250 to make the minimum number of one-line blocks.
 4251 
 4252 Another use for B<--mangle> is to combine it with B<-dac> to reduce
 4253 the file size of a perl script.
 4254 
 4255 =item B<Debugging>
 4256 
 4257 The following flags are available for debugging:
 4258 
 4259 B<--dump-cuddled-block-list> or B<-dcbl> will dump to standard output the
 4260 internal hash of cuddled block types created by a B<-cuddled-block-list> input
 4261 string.
 4262 
 4263 B<--dump-defaults> or B<-ddf> will write the default option set to standard output and quit
 4264 
 4265 B<--dump-profile> or B<-dpro>  will write the name of the current 
 4266 configuration file and its contents to standard output and quit.
 4267 
 4268 B<--dump-options> or B<-dop>  will write current option set to standard
 4269 output and quit.  
 4270 
 4271 B<--dump-long-names> or B<-dln>  will write all command line long names (passed 
 4272 to Get_options) to standard output and quit.
 4273 
 4274 B<--dump-short-names>  or B<-dsn> will write all command line short names 
 4275 to standard output and quit.
 4276 
 4277 B<--dump-token-types> or B<-dtt>  will write a list of all token types 
 4278 to standard output and quit.
 4279 
 4280 B<--dump-want-left-space> or B<-dwls>  will write the hash %want_left_space
 4281 to standard output and quit.  See the section on controlling whitespace
 4282 around tokens.
 4283 
 4284 B<--dump-want-right-space> or B<-dwrs>  will write the hash %want_right_space
 4285 to standard output and quit.  See the section on controlling whitespace
 4286 around tokens.
 4287 
 4288 B<--no-memoize> or B<-nmem>  will turn of memoizing.
 4289 Memoization can reduce run time when running perltidy repeatedly in a 
 4290 single process.  It is on by default but can be deactivated for
 4291 testing with B<-nmem>.
 4292 
 4293 B<--no-timestamp> or B<-nts> will eliminate any time stamps in output files to prevent
 4294 differences in dates from causing test installation scripts to fail. There are just
 4295 a couple of places where timestamps normally occur. One is in the headers of
 4296 html files, and another is when the B<-cscw> option is selected. The default is
 4297 to allow timestamps (B<--timestamp> or B<-ts>).
 4298 
 4299 B<--file-size-order> or B<-fso> will cause files to be processed in order of
 4300 increasing size, when multiple files are being processed.  This is useful
 4301 during program development, when large numbers of files with varying sizes are
 4302 processed, because it can reduce virtual memory usage. 
 4303 
 4304 B<--maximum-file-size-mb=n> or B<-maxfs=n> specifies the maximum file size in
 4305 megabytes that perltidy will attempt to format. This parameter is provided to
 4306 avoid causing system problems by accidentally attempting to format an extremely
 4307 large data file. Most perl scripts are less than about 2 MB in size. The
 4308 integer B<n> has a default value of 10, so perltidy will skip formatting files
 4309 which have a size greater than 10 MB.  The command to increase the limit to 20
 4310 MB for example would be
 4311 
 4312   perltidy -maxfs=20
 4313 
 4314 This only applies to files specified by filename on the command line. 
 4315 
 4316 B<--maximum-level-errors=n> or B<-maxle=n> specifies the maximum number of
 4317 indentation level errors are allowed before perltidy skips formatting and just
 4318 outputs a file verbatim.  The default is B<n=1>.  This means that if the final
 4319 indentation of a script differs from the starting indentation by more than 1
 4320 levels, the file will be output verbatim.  To avoid formatting if there are any
 4321 indentation level errors use -maxle=0. To skip this check you can either set n
 4322 equal to a large number, such as B<n=100>, or set B<n=-1>.
 4323 
 4324 For example, the following script has level error of 3 and will be output verbatim
 4325 
 4326     Input and default output:
 4327     {{{
 4328 
 4329 
 4330     perltidy -maxle=100
 4331     {
 4332         {
 4333             {
 4334 
 4335 B<--maximum-unexpected-errors=n> or B<-maxue=n> specifies the maximum number of
 4336 unexpected tokenization errors are allowed before formatting is skipped and a
 4337 script is output verbatim.  The intention is to avoid accidentally formatting 
 4338 a non-perl script, such as an html file for example.  This check can be turned
 4339 off by setting B<n=0>.
 4340 
 4341 A recommended value is B<n=3>.  However, the default is B<n=0> (skip this check)
 4342 to avoid causing problems with scripts which have extended syntaxes. 
 4343 
 4344 B<-DEBUG>  will write a file with extension F<.DEBUG> for each input file 
 4345 showing the tokenization of all lines of code.
 4346 
 4347 =item B<Working with MakeMaker, AutoLoader and SelfLoader>
 4348 
 4349 The first $VERSION line of a file which might be eval'd by MakeMaker
 4350 is passed through unchanged except for indentation.  
 4351 Use B<--nopass-version-line>, or B<-npvl>, to deactivate this feature.
 4352 
 4353 If the AutoLoader module is used, perltidy will continue formatting
 4354 code after seeing an __END__ line.
 4355 Use B<--nolook-for-autoloader>, or B<-nlal>, to deactivate this feature.
 4356 
 4357 Likewise, if the SelfLoader module is used, perltidy will continue formatting
 4358 code after seeing a __DATA__ line.
 4359 Use B<--nolook-for-selfloader>, or B<-nlsl>, to deactivate this feature.
 4360 
 4361 =item B<Working around problems with older version of Perl>
 4362 
 4363 Perltidy contains a number of rules which help avoid known subtleties
 4364 and problems with older versions of perl, and these rules always
 4365 take priority over whatever formatting flags have been set.  For example,
 4366 perltidy will usually avoid starting a new line with a bareword, because
 4367 this might cause problems if C<use strict> is active.
 4368 
 4369 There is no way to override these rules.
 4370 
 4371 =back
 4372 
 4373 =head1 HTML OPTIONS
 4374 
 4375 =over 4
 4376 
 4377 =item  The B<-html> master switch
 4378 
 4379 The flag B<-html> causes perltidy to write an html file with extension
 4380 F<.html>.  So, for example, the following command
 4381 
 4382     perltidy -html somefile.pl
 4383 
 4384 will produce a syntax-colored html file named F<somefile.pl.html>
 4385 which may be viewed with a browser.
 4386 
 4387 B<Please Note>: In this case, perltidy does not do any formatting to the
 4388 input file, and it does not write a formatted file with extension
 4389 F<.tdy>.  This means that two perltidy runs are required to create a
 4390 fully reformatted, html copy of a script.  
 4391 
 4392 =item  The B<-pre> flag for code snippets
 4393 
 4394 When the B<-pre> flag is given, only the pre-formatted section, within
 4395 the <PRE> and </PRE> tags, will be output.  This simplifies inclusion
 4396 of the output in other files.  The default is to output a complete
 4397 web page.
 4398 
 4399 =item  The B<-nnn> flag for line numbering
 4400 
 4401 When the B<-nnn> flag is given, the output lines will be numbered.
 4402 
 4403 =item  The B<-toc>, or B<--html-table-of-contents> flag
 4404 
 4405 By default, a table of contents to packages and subroutines will be
 4406 written at the start of html output.  Use B<-ntoc> to prevent this.
 4407 This might be useful, for example, for a pod document which contains a
 4408 number of unrelated code snippets.  This flag only influences the code
 4409 table of contents; it has no effect on any table of contents produced by
 4410 pod2html (see next item).
 4411 
 4412 =item  The B<-pod>, or B<--pod2html> flag
 4413 
 4414 There are two options for formatting pod documentation.  The default is
 4415 to pass the pod through the Pod::Html module (which forms the basis of
 4416 the pod2html utility).  Any code sections are formatted by perltidy, and
 4417 the results then merged.  Note: perltidy creates a temporary file when
 4418 Pod::Html is used; see L<"FILES">.  Also, Pod::Html creates temporary
 4419 files for its cache.
 4420 
 4421 NOTE: Perltidy counts the number of C<=cut> lines, and either moves the
 4422 pod text to the top of the html file if there is one C<=cut>, or leaves
 4423 the pod text in its original order (interleaved with code) otherwise.
 4424 
 4425 Most of the flags accepted by pod2html may be included in the perltidy
 4426 command line, and they will be passed to pod2html.  In some cases,
 4427 the flags have a prefix C<pod> to emphasize that they are for the
 4428 pod2html, and this prefix will be removed before they are passed to
 4429 pod2html.  The flags which have the additional C<pod> prefix are:
 4430 
 4431    --[no]podheader --[no]podindex --[no]podrecurse --[no]podquiet 
 4432    --[no]podverbose --podflush
 4433 
 4434 The flags which are unchanged from their use in pod2html are:
 4435 
 4436    --backlink=s --cachedir=s --htmlroot=s --libpods=s --title=s
 4437    --podpath=s --podroot=s 
 4438 
 4439 where 's' is an appropriate character string.  Not all of these flags are
 4440 available in older versions of Pod::Html.  See your Pod::Html documentation for
 4441 more information.
 4442 
 4443 The alternative, indicated with B<-npod>, is not to use Pod::Html, but
 4444 rather to format pod text in italics (or whatever the stylesheet
 4445 indicates), without special html markup.  This is useful, for example,
 4446 if pod is being used as an alternative way to write comments.
 4447 
 4448 =item  The B<-frm>, or B<--frames> flag
 4449 
 4450 By default, a single html output file is produced.  This can be changed
 4451 with the B<-frm> option, which creates a frame holding a table of
 4452 contents in the left panel and the source code in the right side. This
 4453 simplifies code browsing.  Assume, for example, that the input file is
 4454 F<MyModule.pm>.  Then, for default file extension choices, these three
 4455 files will be created:
 4456 
 4457  MyModule.pm.html      - the frame
 4458  MyModule.pm.toc.html  - the table of contents
 4459  MyModule.pm.src.html  - the formatted source code
 4460 
 4461 Obviously this file naming scheme requires that output be directed to a real
 4462 file (as opposed to, say, standard output).  If this is not the
 4463 case, or if the file extension is unknown, the B<-frm> option will be
 4464 ignored.
 4465 
 4466 =item  The B<-text=s>, or B<--html-toc-extension> flag
 4467 
 4468 Use this flag to specify the extra file extension of the table of contents file
 4469 when html frames are used.  The default is "toc".
 4470 See L<Specifying File Extensions>.
 4471 
 4472 =item  The B<-sext=s>, or B<--html-src-extension> flag
 4473 
 4474 Use this flag to specify the extra file extension of the content file when html
 4475 frames are used.  The default is "src".
 4476 See L<Specifying File Extensions>.
 4477 
 4478 =item  The B<-hent>, or B<--html-entities> flag
 4479 
 4480 This flag controls the use of Html::Entities for html formatting.  By
 4481 default, the module Html::Entities is used to encode special symbols.
 4482 This may not be the right thing for some browser/language
 4483 combinations.  Use --nohtml-entities or -nhent to prevent this.
 4484 
 4485 =item  B<Style Sheets>
 4486 
 4487 Style sheets make it very convenient to control and adjust the
 4488 appearance of html pages.  The default behavior is to write a page of
 4489 html with an embedded style sheet.
 4490 
 4491 An alternative to an embedded style sheet is to create a page with a
 4492 link to an external style sheet.  This is indicated with the
 4493 B<-css=filename>,  where the external style sheet is F<filename>.  The
 4494 external style sheet F<filename> will be created if and only if it does
 4495 not exist.  This option is useful for controlling multiple pages from a
 4496 single style sheet.
 4497 
 4498 To cause perltidy to write a style sheet to standard output and exit,
 4499 use the B<-ss>, or B<--stylesheet>, flag.  This is useful if the style
 4500 sheet could not be written for some reason, such as if the B<-pre> flag
 4501 was used.  Thus, for example,
 4502 
 4503   perltidy -html -ss >mystyle.css
 4504 
 4505 will write a style sheet with the default properties to file
 4506 F<mystyle.css>.
 4507 
 4508 The use of style sheets is encouraged, but a web page without a style
 4509 sheets can be created with the flag B<-nss>.  Use this option if you
 4510 must to be sure that older browsers (roughly speaking, versions prior to
 4511 4.0 of Netscape Navigator and Internet Explorer) can display the
 4512 syntax-coloring of the html files.
 4513 
 4514 =item  B<Controlling HTML properties>
 4515 
 4516 Note: It is usually more convenient to accept the default properties
 4517 and then edit the stylesheet which is produced.  However, this section
 4518 shows how to control the properties with flags to perltidy.
 4519 
 4520 Syntax colors may be changed from their default values by flags of the either
 4521 the long form, B<-html-color-xxxxxx=n>, or more conveniently the short form,
 4522 B<-hcx=n>, where B<xxxxxx> is one of the following words, and B<x> is the
 4523 corresponding abbreviation:
 4524 
 4525       Token Type             xxxxxx           x 
 4526       ----------             --------         --
 4527       comment                comment          c
 4528       number                 numeric          n
 4529       identifier             identifier       i
 4530       bareword, function     bareword         w
 4531       keyword                keyword          k
 4532       quite, pattern         quote            q
 4533       here doc text          here-doc-text    h
 4534       here doc target        here-doc-target  hh
 4535       punctuation            punctuation      pu
 4536       parentheses            paren            p
 4537       structural braces      structure        s
 4538       semicolon              semicolon        sc
 4539       colon                  colon            co
 4540       comma                  comma            cm
 4541       label                  label            j
 4542       sub definition name    subroutine       m
 4543       pod text               pod-text         pd
 4544 
 4545 A default set of colors has been defined, but they may be changed by providing
 4546 values to any of the following parameters, where B<n> is either a 6 digit 
 4547 hex RGB color value or an ascii name for a color, such as 'red'.
 4548 
 4549 To illustrate, the following command will produce an html 
 4550 file F<somefile.pl.html> with "aqua" keywords:
 4551 
 4552     perltidy -html -hck=00ffff somefile.pl
 4553 
 4554 and this should be equivalent for most browsers:
 4555 
 4556     perltidy -html -hck=aqua somefile.pl
 4557 
 4558 Perltidy merely writes any non-hex names that it sees in the html file.
 4559 The following 16 color names are defined in the HTML 3.2 standard:
 4560 
 4561     black   => 000000,
 4562     silver  => c0c0c0,
 4563     gray    => 808080,
 4564     white   => ffffff,
 4565     maroon  => 800000,
 4566     red     => ff0000,
 4567     purple  => 800080,
 4568     fuchsia => ff00ff,
 4569     green   => 008000,
 4570     lime    => 00ff00,
 4571     olive   => 808000,
 4572     yellow  => ffff00
 4573     navy    => 000080,
 4574     blue    => 0000ff,
 4575     teal    => 008080,
 4576     aqua    => 00ffff,
 4577 
 4578 Many more names are supported in specific browsers, but it is safest
 4579 to use the hex codes for other colors.  Helpful color tables can be
 4580 located with an internet search for "HTML color tables". 
 4581 
 4582 Besides color, two other character attributes may be set: bold, and italics.
 4583 To set a token type to use bold, use the flag
 4584 B<--html-bold-xxxxxx> or B<-hbx>, where B<xxxxxx> or B<x> are the long
 4585 or short names from the above table.  Conversely, to set a token type to 
 4586 NOT use bold, use B<--nohtml-bold-xxxxxx> or B<-nhbx>.
 4587 
 4588 Likewise, to set a token type to use an italic font, use the flag
 4589 B<--html-italic-xxxxxx> or B<-hix>, where again B<xxxxxx> or B<x> are the
 4590 long or short names from the above table.  And to set a token type to
 4591 NOT use italics, use B<--nohtml-italic-xxxxxx> or B<-nhix>.
 4592 
 4593 For example, to use bold braces and lime color, non-bold, italics keywords the
 4594 following command would be used:
 4595 
 4596     perltidy -html -hbs -hck=00FF00 -nhbk -hik somefile.pl
 4597 
 4598 The background color can be specified with B<--html-color-background=n>,
 4599 or B<-hcbg=n> for short, where n is a 6 character hex RGB value.  The
 4600 default color of text is the value given to B<punctuation>, which is
 4601 black as a default.
 4602 
 4603 Here are some notes and hints:
 4604 
 4605 1. If you find a preferred set of these parameters, you may want
 4606 to create a F<.perltidyrc> file containing them.  See the perltidy man
 4607 page for an explanation.
 4608 
 4609 2. Rather than specifying values for these parameters, it is probably
 4610 easier to accept the defaults and then edit a style sheet.  The style
 4611 sheet contains comments which should make this easy.
 4612 
 4613 3. The syntax-colored html files can be very large, so it may be best to
 4614 split large files into smaller pieces to improve download times.
 4615 
 4616 =back
 4617 
 4618 =head1 SOME COMMON INPUT CONVENTIONS
 4619 
 4620 =head2 Specifying Block Types
 4621 
 4622 Several parameters which refer to code block types may be customized by also
 4623 specifying an associated list of block types.  The type of a block is the name
 4624 of the keyword which introduces that block, such as B<if>, B<else>, or B<sub>.
 4625 An exception is a labeled block, which has no keyword, and should be specified
 4626 with just a colon.  To specify all blocks use B<'*'>.
 4627 
 4628 The keyword B<sub> indicates a named sub.  For anonymous subs, use the special
 4629 keyword B<asub>.
 4630 
 4631 For example, the following parameter specifies C<sub>, labels, C<BEGIN>, and
 4632 C<END> blocks:
 4633 
 4634    -cscl="sub : BEGIN END"
 4635 
 4636 (the meaning of the -cscl parameter is described above.)  Note that
 4637 quotes are required around the list of block types because of the
 4638 spaces.  For another example, the following list specifies all block types
 4639 for vertical tightness:
 4640 
 4641    -bbvtl='*'
 4642 
 4643 =head2 Specifying File Extensions
 4644 
 4645 Several parameters allow default file extensions to be overridden.  For
 4646 example, a backup file extension may be specified with B<-bext=ext>,
 4647 where B<ext> is some new extension.  In order to provides the user some
 4648 flexibility, the following convention is used in all cases to decide if
 4649 a leading '.' should be used.  If the extension C<ext> begins with
 4650 C<A-Z>, C<a-z>, or C<0-9>, then it will be appended to the filename with
 4651 an intermediate '.' (or perhaps a '_' on VMS systems).  Otherwise, it
 4652 will be appended directly.  
 4653 
 4654 For example, suppose the file is F<somefile.pl>.  For C<-bext=old>, a '.' is
 4655 added to give F<somefile.pl.old>.  For C<-bext=.old>, no additional '.' is
 4656 added, so again the backup file is F<somefile.pl.old>.  For C<-bext=~>, then no
 4657 dot is added, and the backup file will be F<somefile.pl~>  .  
 4658 
 4659 =head1 SWITCHES WHICH MAY BE NEGATED
 4660 
 4661 The following list shows all short parameter names which allow a prefix
 4662 'n' to produce the negated form:
 4663 
 4664  D      anl    asbl   asc    ast    asu    atnl   aws    b      baa
 4665  baao   bar    bbao   bbb    bbc    bbs    bl     bli    boa    boc
 4666  bok    bol    bom    bos    bot    cblx   ce     conv   cs     csc
 4667  cscb   cscw   dac    dbc    dcbl   dcsc   ddf    dln    dnl    dop
 4668  dp     dpro   dsc    dsm    dsn    dtt    dwls   dwrs   dws    f
 4669  fll    fpva   frm    fs     fso    gcs    hbc    hbcm   hbco   hbh
 4670  hbhh   hbi    hbj    hbk    hbm    hbn    hbp    hbpd   hbpu   hbq
 4671  hbs    hbsc   hbv    hbw    hent   hic    hicm   hico   hih    hihh
 4672  hii    hij    hik    him    hin    hip    hipd   hipu   hiq    his
 4673  hisc   hiv    hiw    hsc    html   ibc    icb    icp    iob    isbc
 4674  iscl   kgb    kgbd   kgbi   kis    lal    log    lop    lp     lsl
 4675  mem    nib    ohbr   okw    ola    olc    oll    olq    opr    opt
 4676  osbc   osbr   otr    ple    pod    pvl    q      sac    sbc    sbl
 4677  scbb   schb   scp    scsb   sct    se     sfp    sfs    skp    sob
 4678  sobb   sohb   sop    sosb   sot    ssc    st     sts    t      tac
 4679  tbc    toc    tp     tqw    trp    ts     tsc    tso    vmll   w
 4680  wn     x      xci    xs
 4681 
 4682 Equivalently, the prefix 'no' or 'no-' on the corresponding long names may be
 4683 used.
 4684 
 4685 =head1 LIMITATIONS
 4686 
 4687 =over 4
 4688 
 4689 =item  B<Parsing Limitations>
 4690 
 4691 Perltidy should work properly on most perl scripts.  It does a lot of
 4692 self-checking, but still, it is possible that an error could be
 4693 introduced and go undetected.  Therefore, it is essential to make
 4694 careful backups and to test reformatted scripts.
 4695 
 4696 The main current limitation is that perltidy does not scan modules
 4697 included with 'use' statements.  This makes it necessary to guess the
 4698 context of any bare words introduced by such modules.  Perltidy has good
 4699 guessing algorithms, but they are not infallible.  When it must guess,
 4700 it leaves a message in the log file.
 4701 
 4702 If you encounter a bug, please report it.
 4703 
 4704 =item  B<What perltidy does not parse and format>
 4705 
 4706 Perltidy indents but does not reformat comments and C<qw> quotes. 
 4707 Perltidy does not in any way modify the contents of here documents or
 4708 quoted text, even if they contain source code.  (You could, however,
 4709 reformat them separately).  Perltidy does not format 'format' sections
 4710 in any way.  And, of course, it does not modify pod documents.
 4711 
 4712 =back
 4713 
 4714 =head1 FILES
 4715 
 4716 =over 4
 4717 
 4718 =item B<Temporary files>
 4719 
 4720 Under the -html option with the default --pod2html flag, a temporary file is
 4721 required to pass text to Pod::Html.  Unix systems will try to use the POSIX
 4722 tmpnam() function.  Otherwise the file F<perltidy.TMP> will be temporarily
 4723 created in the current working directory.
 4724 
 4725 =item B<Special files when standard input is used>
 4726 
 4727 When standard input is used, the log file, if saved, is F<perltidy.LOG>,
 4728 and any errors are written to F<perltidy.ERR> unless the B<-se> flag is
 4729 set.  These are saved in the current working directory.  
 4730 
 4731 =item B<Files overwritten>
 4732 
 4733 The following file extensions are used by perltidy, and files with these
 4734 extensions may be overwritten or deleted: F<.ERR>, F<.LOG>, F<.TEE>,
 4735 and/or F<.tdy>, F<.html>, and F<.bak>, depending on the run type and
 4736 settings.
 4737 
 4738 =item  B<Files extensions limitations>
 4739 
 4740 Perltidy does not operate on files for which the run could produce a file with
 4741 a duplicated file extension.  These extensions include F<.LOG>, F<.ERR>,
 4742 F<.TEE>, and perhaps F<.tdy> and F<.bak>, depending on the run type.  The
 4743 purpose of this rule is to prevent generating confusing filenames such as
 4744 F<somefile.tdy.tdy.tdy>.
 4745 
 4746 =back
 4747 
 4748 =head1 ERROR HANDLING
 4749 
 4750 An exit value of 0, 1, or 2 is returned by perltidy to indicate the status of the result.
 4751 
 4752 A exit value of 0 indicates that perltidy ran to completion with no error messages.
 4753 
 4754 A non-zero exit value indicates some kind of problem was detected. 
 4755 
 4756 An exit value of 1 indicates that perltidy terminated prematurely, usually due
 4757 to some kind of errors in the input parameters.  This can happen for example if
 4758 a parameter is misspelled or given an invalid value.  Error messages in the
 4759 standard error output will indicate the cause of any problem.  If perltidy
 4760 terminates prematurely then no output files will be produced.
 4761 
 4762 An exit value of 2 indicates that perltidy was able to run to completion but
 4763 there there are (1) warning messages in the standard error output related to
 4764 parameter errors or problems and/or (2) warning messages in the perltidy error
 4765 file(s) relating to possible syntax errors in one or more of the source
 4766 script(s) being tidied.  When multiple files are being processed, an error
 4767 detected in any single file will produce this type of exit condition.
 4768 
 4769 =head1 SEE ALSO
 4770 
 4771 perlstyle(1), Perl::Tidy(3)
 4772 
 4773 =head1 INSTALLATION
 4774 
 4775 The perltidy binary uses the Perl::Tidy module and is installed when that module is installed.  The module name is case-sensitive.  For example, the basic command for installing with cpanm is 'cpanm Perl::Tidy'.
 4776 
 4777 =head1 VERSION
 4778 
 4779 This man page documents perltidy version 20210717
 4780 
 4781 =head1 BUG REPORTS
 4782 
 4783 A list of current bugs and issues can be found at the CPAN site L<https://rt.cpan.org/Public/Dist/Display.html?Name=Perl-Tidy>
 4784 
 4785 To report a new bug or problem, use the link on this page.  
 4786 
 4787 The source code repository is at L<https://github.com/perltidy/perltidy>.
 4788 
 4789 =head1 COPYRIGHT
 4790 
 4791 Copyright (c) 2000-2021 by Steve Hancock
 4792 
 4793 =head1 LICENSE
 4794 
 4795 This package is free software; you can redistribute it and/or modify it
 4796 under the terms of the "GNU General Public License".
 4797 
 4798 Please refer to the file "COPYING" for details.
 4799 
 4800 =head1 DISCLAIMER
 4801 
 4802 This package is distributed in the hope that it will be useful,
 4803 but WITHOUT ANY WARRANTY; without even the implied warranty of
 4804 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 4805 
 4806 See the "GNU General Public License" for more details.