]> git.donarmstrong.com Git - perltidy.git/blobdiff - bin/perltidy
* Fix FTBFS on perl 5.10
[perltidy.git] / bin / perltidy
index 0822508e06a5955aacc9b0fc4ae7b93d17055a4f..1f1529f00b9529c5c31c32bec8e679f1cfce4c46 100755 (executable)
@@ -419,8 +419,6 @@ where s=C<win>, C<dos>, C<unix>, or C<mac>.  This flag tells perltidy
 to output line endings for a specific system.  Normally,
 perltidy writes files with the line separator character of the host
 system.  The C<win> and C<dos> flags have an identical result.
-B<NOTE>: This only works under unix-like systems and is ignored under
-other systems.
 
 =item B<-ple>,  B<--preserve-line-endings>
 
@@ -430,8 +428,6 @@ B<dos>, B<unix>, and B<mac> line endings.  It will only work if perltidy
 input comes from a filename (rather than stdin, for example).  If
 perltidy has trouble determining the input file line ending, it will
 revert to the default behavior of using the line ending of the host system.
-B<NOTE>: This only works under unix-like systems and is ignored under
-other systems.
 
 =back
 
@@ -784,7 +780,7 @@ a space takes priority.
 
 It is necessary to have a list of all token types in order to create
 this type of input.  Such a list can be obtained by the command
-B<--dump-token-types>.  Also try the -D flag on a short snippet of code
+B<--dump-token-types>.  Also try the B<-D> flag on a short snippet of code
 and look at the .DEBUG file to see the tokenization. 
 
 B<WARNING> Be sure to put these tokens in quotes to avoid having them
@@ -892,6 +888,11 @@ Side comments look best when lined up several spaces to the right of
 code.  Perltidy will try to keep comments at least n spaces to the
 right.  The default is n=4 spaces.
 
+=item B<-fpsc=n>,  B<--fixed-position-side-comment=n>
+
+This parameter tells perltidy to line up side comments in column number B<n>
+whenever possible.  The default, n=0, is not do do this.
+
 =item B<-hsc>, B<--hanging-side-comments>
 
 By default, perltidy tries to identify and align "hanging side
@@ -1153,6 +1154,17 @@ please be aware that since this string is used in a perl regular expression
 which identifies these comments, it must enable a valid regular expression to
 be formed.
 
+A pattern which can be useful is:
+
+    -sbcp=^#{2,}[^\s#] 
+
+This pattern requires a static block comment to have at least one character
+which is neither a # nor a space.  It allows a line containing only '#'
+characters to be rejected as a static block comment.  Such lines are often used
+at the start and end of header information in subroutines and should not be
+separated from the intervening comments, which typically begin with just a
+single '#'.
+
 =item B<-osbc>, B<--outdent-static-block-comments>
 
 The command B<-osbc> will will cause static block comments to be outdented by 2
@@ -1577,7 +1589,7 @@ There is no vertical tightness control for closing block braces; with
 the exception of one-line blocks, they will normally remain on a 
 separate line.
 
-=item B<-sot>,  B<--stack-opening-token> and related flags
+=item B<-sot>,  B<--stack-opening-tokens> and related flags
 
 The B<-sot> flag tells perltidy to "stack" opening tokens
 when possible to avoid lines with isolated opening tokens.
@@ -1610,7 +1622,7 @@ controls can be used:
 
 The flag B<-sot> is a synonym for B<-sop -sohb -sosb>.
 
-=item B<-sct>,  B<--stack-closing-token> and related flags
+=item B<-sct>,  B<--stack-closing-tokens> and related flags
 
 The B<-sct> flag tells perltidy to "stack" closing tokens
 when possible to avoid lines with isolated closing tokens.
@@ -1676,8 +1688,9 @@ break points.
 
 =item Controlling whether perltidy breaks before or after operators
 
-Two command line parameters provide some control over whether
+Four command line parameters provide some control over whether
 a line break should be before or after specific token types.
+Two parameters give detailed control:
 
 B<-wba=s> or B<--want-break-after=s>, and
 
@@ -1690,11 +1703,11 @@ command-line parameter always overwrites the previous one before
 perltidy ever sees it.
 
 By default, perltidy breaks B<after> these token types:
-  % + - * / x != == >= <= =~ !~ < >  | & >= <
-  = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x=
+  % + - * / x != == >= <= =~ !~ < >  | & 
+  = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=
 
 And perltidy breaks B<before> these token types by default:
-  . << >> -> && ||
+  . << >> -> && || //
 
 To illustrate, to cause a break after a concatenation operator, C<'.'>,
 rather than before it, the command line would be
@@ -1707,7 +1720,7 @@ math operators C<'+'>, C<'-'>, C<'/'>, and C<'*'>:
   -wbb="+ - / *"
 
 These commands should work well for most of the token types that perltidy uses
-(use B<--dump-token-types> for a list).  Also try the -D flag on a short
+(use B<--dump-token-types> for a list).  Also try the B<-D> flag on a short
 snippet of code and look at the .DEBUG file to see the tokenization.  However,
 for a few token types there may be conflicts with hardwired logic which cause
 unexpected results.  One example is curly braces, which should be controlled
@@ -1716,6 +1729,25 @@ with the parameter B<bl> provided for that purpose.
 B<WARNING> Be sure to put these tokens in quotes to avoid having them
 misinterpreted by your command shell.
 
+Two additional parameters are available which, though they provide no further
+capability, can simplify input are:
+
+B<-baao> or B<--break-after-all-operators>,
+
+B<-bbao> or B<--break-before-all-operators>.
+
+The -baao sets the default to be to break after all of the following operators:
+
+    % + - * / x != == >= <= =~ !~ < > | & 
+    = **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x=
+    . : ? && || and or err xor
+
+and the B<-bbao> flag sets the default to break before all of these operators.
+These can be used to define an initial break preference which can be fine-tuned
+with the B<-wba> and B<-wbb> flags.  For example, to break before all operators
+except an B<=> one could use --bbao -wba='=' rather than listing every
+single perl operator except B<=> on a -wbb flag.
+
 =back
 
 =head2 Controlling List Formatting
@@ -1873,6 +1905,34 @@ maximum extent possible.  This will tend to produce the longest possible
 containers, regardless of type, which do not exceed the line length
 limit.
 
+=item B<-kis>,  B<--keep-interior-semicolons>
+
+Use the B<-kis> flag to prevent breaking at a semicolon if
+there was no break there in the input file.  Normally
+perltidy places a newline after each semicolon which
+terminates a statement unless several statements are
+contained within a one-line brace block.  To illustrate,
+consider the following input lines:
+
+    dbmclose(%verb_delim); undef %verb_delim;
+    dbmclose(%expanded); undef %expanded;
+
+The default is to break after each statement, giving
+
+    dbmclose(%verb_delim);
+    undef %verb_delim;
+    dbmclose(%expanded);
+    undef %expanded;
+
+With B<perltidy -kis> the multiple statements are retained:
+
+    dbmclose(%verb_delim); undef %verb_delim;
+    dbmclose(%expanded);   undef %expanded;
+
+The statements are still subject to the specified value
+of B<maximum-line-length> and will be broken if this 
+maximum is exceeed.
+
 =back
 
 =head2 Blank Line Control
@@ -1973,8 +2033,8 @@ B<-pbp> is an abbreviation for the parameters in the book B<Perl Best Practices>
 by Damian Conway:
 
     -l=78 -i=4 -ci=4 -st -se -vt=2 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nsfs -nolq
-    -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < 
-          **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
+    -wbb="% + - * / x != == >= <= =~ !~ < > | & = 
+          **= += *= &= <<= &&= -= /= |= >>= ||= //= .= %= ^= x="
 
 Note that the -st and -se flags make perltidy act as a filter on one file only.  
 These can be overridden with -nst and -nse if necessary.
@@ -2031,7 +2091,8 @@ named F<.perltidyrc>.  If it does not find one, it will continue looking
 for one in other standard locations.  
 
 These other locations are system-dependent, and may be displayed with
-the command C<perltidy -dpro>.  Under Unix systems, it will look for a
+the command C<perltidy -dpro>.  Under Unix systems, it will first look
+for an environment variable B<PERLTIDY>.  Then it will look for a
 F<.perltidyrc> file in the home directory, and then for a system-wide
 file F</usr/local/etc/perltidyrc>, and then it will look for
 F</etc/perltidyrc>.  Note that these last two system-wide files do not
@@ -2545,7 +2606,7 @@ The following list shows all short parameter names which allow a prefix
  dwrs dws f    fll  frm  fs  hsc html ibc  icb  icp iob  isbc lal  log
  lp   lsl ohbr okw  ola  oll opr opt  osbr otr  ple ple  pod  pvl  q
  sbc  sbl schb scp  scsb sct se  sfp  sfs  skp  sob sohb sop  sosb sot
- ssc  st  sts  syn  t    tac tbc toc  tp   tqw  tsc w    x
+ ssc  st  sts  syn  t    tac tbc toc  tp   tqw  tsc w    x    bar  kis
 
 Equivalently, the prefix 'no' or 'no-' on the corresponding long names may be
 used.
@@ -2619,7 +2680,7 @@ perlstyle(1), Perl::Tidy(3)
 
 =head1 VERSION
 
-This man page documents perltidy version 20060719.
+This man page documents perltidy version 20071205.
 
 =head1 CREDITS