]> git.donarmstrong.com Git - perltidy.git/blob - docs/perltidy.1
[svn-inject] Installing original source of perltidy
[perltidy.git] / docs / perltidy.1
1 .\" Automatically generated by Pod::Man v1.3, Pod::Parser v1.13
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sh \" Subsection heading
6 .br
7 .if t .Sp
8 .ne 5
9 .PP
10 \fB\\$1\fR
11 .PP
12 ..
13 .de Sp \" Vertical space (when we can't use .PP)
14 .if t .sp .5v
15 .if n .sp
16 ..
17 .de Vb \" Begin verbatim text
18 .ft CW
19 .nf
20 .ne \\$1
21 ..
22 .de Ve \" End verbatim text
23 .ft R
24
25 .fi
26 ..
27 .\" Set up some character translations and predefined strings.  \*(-- will
28 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
29 .\" double quote, and \*(R" will give a right double quote.  | will give a
30 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
31 .\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
32 .\" expand to `' in nroff, nothing in troff, for use with C<>.
33 .tr \(*W-|\(bv\*(Tr
34 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
35 .ie n \{\
36 .    ds -- \(*W-
37 .    ds PI pi
38 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
39 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
40 .    ds L" ""
41 .    ds R" ""
42 .    ds C` ""
43 .    ds C' ""
44 'br\}
45 .el\{\
46 .    ds -- \|\(em\|
47 .    ds PI \(*p
48 .    ds L" ``
49 .    ds R" ''
50 'br\}
51 .\"
52 .\" If the F register is turned on, we'll generate index entries on stderr for
53 .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
54 .\" entries marked with X<> in POD.  Of course, you'll have to process the
55 .\" output yourself in some meaningful fashion.
56 .if \nF \{\
57 .    de IX
58 .    tm Index:\\$1\t\\n%\t"\\$2"
59 ..
60 .    nr % 0
61 .    rr F
62 .\}
63 .\"
64 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
65 .\" way too many mistakes in technical documents.
66 .hy 0
67 .if n .na
68 .\"
69 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
70 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
71 .    \" fudge factors for nroff and troff
72 .if n \{\
73 .    ds #H 0
74 .    ds #V .8m
75 .    ds #F .3m
76 .    ds #[ \f1
77 .    ds #] \fP
78 .\}
79 .if t \{\
80 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
81 .    ds #V .6m
82 .    ds #F 0
83 .    ds #[ \&
84 .    ds #] \&
85 .\}
86 .    \" simple accents for nroff and troff
87 .if n \{\
88 .    ds ' \&
89 .    ds ` \&
90 .    ds ^ \&
91 .    ds , \&
92 .    ds ~ ~
93 .    ds /
94 .\}
95 .if t \{\
96 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
97 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
98 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
99 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
100 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
101 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
102 .\}
103 .    \" troff and (daisy-wheel) nroff accents
104 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
105 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
106 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
107 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
108 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
109 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
110 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
111 .ds ae a\h'-(\w'a'u*4/10)'e
112 .ds Ae A\h'-(\w'A'u*4/10)'E
113 .    \" corrections for vroff
114 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
115 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
116 .    \" for low resolution devices (crt and lpr)
117 .if \n(.H>23 .if \n(.V>19 \
118 \{\
119 .    ds : e
120 .    ds 8 ss
121 .    ds o a
122 .    ds d- d\h'-1'\(ga
123 .    ds D- D\h'-1'\(hy
124 .    ds th \o'bp'
125 .    ds Th \o'LP'
126 .    ds ae ae
127 .    ds Ae AE
128 .\}
129 .rm #[ #] #H #V #F C
130 .\" ========================================================================
131 .\"
132 .IX Title "PERLTIDY 1"
133 .TH PERLTIDY 1 "2003-10-22" "perl v5.6.1" "User Contributed Perl Documentation"
134 .UC
135 .SH "NAME"
136 perltidy \- a perl script indenter and reformatter
137 .SH "SYNOPSIS"
138 .IX Header "SYNOPSIS"
139 .Vb 5
140 \&    perltidy [ options ] file1 file2 file3 ...
141 \&            (output goes to file1.tdy, file2.tdy, file3.tdy, ...)
142 \&    perltidy [ options ] file1 -o outfile
143 \&    perltidy [ options ] file1 -st >outfile
144 \&    perltidy [ options ] <infile >outfile
145 .Ve
146 .SH "DESCRIPTION"
147 .IX Header "DESCRIPTION"
148 Perltidy reads a perl script and writes an indented, reformatted script.
149 .PP
150 Many users will find enough information in \*(L"\s-1EXAMPLES\s0\*(R" to get 
151 started.  New users may benefit from the short tutorial 
152 which can be found at
153 http://perltidy.sourceforge.net/tutorial.html
154 .PP
155 A convenient aid to systematically defining a set of style parameters
156 can be found at
157 http://perltidy.sourceforge.net/stylekey.html
158 .PP
159 Perltidy can produce output on either of two modes, depending on the
160 existence of an \fB\-html\fR flag.  Without this flag, the output is passed
161 through a formatter.  The default formatting tries to follow the
162 recommendations in \fIperlstyle\fR\|(1), but it can be controlled in detail with
163 numerous input parameters, which are described in \*(L"\s-1FORMATTING\s0 \s-1OPTIONS\s0\*(R".  
164 .PP
165 When the \fB\-html\fR flag is given, the output is passed through an \s-1HTML\s0
166 formatter which is described in \*(L"\s-1HTML\s0 \s-1OPTIONS\s0\*(R".  
167 .SH "EXAMPLES"
168 .IX Header "EXAMPLES"
169 .Vb 1
170 \&  perltidy somefile.pl
171 .Ve
172 This will produce a file \fIsomefile.pl.tdy\fR containing the script reformatted
173 using the default options, which approximate the style suggested in 
174 \&\fIperlstyle\fR\|(1).  Perltidy never changes the input file.
175 .PP
176 .Vb 1
177 \&  perltidy *.pl
178 .Ve
179 Execute perltidy on all \fI.pl\fR files in the current directory with the
180 default options.  The output will be in files with an appended \fI.tdy\fR
181 extension.  For any file with an error, there will be a file with extension
182 \&\fI.ERR\fR.
183 .PP
184 .Vb 1
185 \&  perltidy -b file1.pl file2.pl
186 .Ve
187 Modify \fIfile1.pl\fR and \fIfile1.pl\fR in place, and backup the originals to
188 \&\fIfile1.pl.bak\fR and \fIfile2.pl.bak\fR.  If \fIfile1.pl.bak\fR and/or \fIfile2.pl.bak\fR
189 already exist, they will be overwritten.
190 .PP
191 .Vb 1
192 \&  perltidy -gnu somefile.pl
193 .Ve
194 Execute perltidy on file \fIsomefile.pl\fR with a style which approximates the
195 \&\s-1GNU\s0 Coding Standards for C programs.  The output will be \fIsomefile.pl.tdy\fR.
196 .PP
197 .Vb 1
198 \&  perltidy -i=3 somefile.pl
199 .Ve
200 Execute perltidy on file \fIsomefile.pl\fR, with 3 columns for each level of
201 indentation (\fB\-i=3\fR) instead of the default 4 columns.  There will not be any
202 tabs in the reformatted script, except for any which already exist in comments,
203 pod documents, quotes, and here documents.  Output will be \fIsomefile.pl.tdy\fR. 
204 .PP
205 .Vb 1
206 \&  perltidy -i=3 -et=8 somefile.pl
207 .Ve
208 Same as the previous example, except that leading whitespace will
209 be entabbed with one tab character per 8 spaces.
210 .PP
211 .Vb 1
212 \&  perltidy -ce -l=72 somefile.pl
213 .Ve
214 Execute perltidy on file \fIsomefile.pl\fR with all defaults except use \*(L"cuddled
215 elses\*(R" (\fB\-ce\fR) and a maximum line length of 72 columns (\fB\-l=72\fR) instead of
216 the default 80 columns.  
217 .PP
218 .Vb 1
219 \&  perltidy -g somefile.pl
220 .Ve
221 Execute perltidy on file \fIsomefile.pl\fR and save a log file \fIsomefile.pl.LOG\fR
222 which shows the nesting of braces, parentheses, and square brackets at
223 the start of every line.
224 .PP
225 .Vb 1
226 \&  perltidy -html somefile.pl
227 .Ve
228 This will produce a file \fIsomefile.pl.html\fR containing the script with
229 html markup.  The output file will contain an embedded style sheet in
230 the <\s-1HEAD\s0> section which may be edited to change the appearance.
231 .PP
232 .Vb 1
233 \&  perltidy -html -css=mystyle.css somefile.pl
234 .Ve
235 This will produce a file \fIsomefile.pl.html\fR containing the script with
236 html markup.  This output file will contain a link to a separate style
237 sheet file \fImystyle.css\fR.  If the file \fImystyle.css\fR does not exist,
238 it will be created.  If it exists, it will not be overwritten.
239 .PP
240 .Vb 1
241 \&  perltidy -html -pre somefile.pl
242 .Ve
243 Write an html snippet with only the \s-1PRE\s0 section to \fIsomefile.pl.html\fR.
244 This is useful when code snippets are being formatted for inclusion in a
245 larger web page.  No style sheet will be written in this case.  
246 .PP
247 .Vb 1
248 \&  perltidy -html -ss >mystyle.css
249 .Ve
250 Write a style sheet to \fImystyle.css\fR and exit.
251 .PP
252 .Vb 1
253 \&  perltidy -html -frm mymodule.pm
254 .Ve
255 Write html with a frame holding a table of contents and the source code.  The
256 output files will be \fImymodule.pm.html\fR (the frame), \fImymodule.pm.toc.html\fR
257 (the table of contents), and \fImymodule.pm.src.html\fR (the source code).
258 .SH "OPTIONS \- OVERVIEW"
259 .IX Header "OPTIONS - OVERVIEW"
260 The entire command line is scanned for options, and they are processed
261 before any files are processed.  As a result, it does not matter
262 whether flags are before or after any filenames.  However, the relative
263 order of parameters is important, with later parameters overriding the
264 values of earlier parameters.
265 .PP
266 For each parameter, there is a long name and a short name.  The short
267 names are convenient for keyboard input, while the long names are
268 self-documenting and therefore useful in scripts.  It is customary to
269 use two leading dashes for long names, but one may be used.
270 .PP
271 Most parameters which serve as on/off flags can be negated with a
272 leading \*(L"n\*(R" (for the short name) or a leading \*(L"no\*(R" or \*(L"no\-\*(R" (for the
273 long name).  For example, the flag to outdent long quotes is is \fB\-olq\fR
274 or \fB\-\-outdent\-long\-quotes\fR.  The flag to skip this is \fB\-nolq\fR
275 or \fB\-\-nooutdent\-long\-quotes\fR or \fB\-\-no\-outdent\-long\-quotes\fR.
276 .PP
277 Options may not be bundled together.  In other words, options \fB\-q\fR and
278 \&\fB\-g\fR may \s-1NOT\s0 be entered as \fB\-qg\fR.
279 .PP
280 Option names may be terminated early as long as they are uniquely identified.
281 For example, instead of \fB\-dump\-token\-types\fR, it would be sufficient to enter
282 \&\fB\-dump\-tok\fR, or even \fB\-dump\-t\fR, to uniquely identify this command.
283 .Sh "I/O control"
284 .IX Subsection "I/O control"
285 The following parameters concern the files which are read and written.
286 .IP "\fB\-h\fR,    \fB\-\-help\fR" 4
287 .IX Item "-h,    --help"
288 Show summary of usage and exit.
289 .IP "\fB\-o\fR=filename,    \fB\-\-outfile\fR=filename" 4
290 .IX Item "-o=filename,    --outfile=filename"
291 Name of the output file (only if a single input file is being
292 processed).  If no output file is specified, and output is not
293 redirected to the standard output, the output will go to \fIfilename.tdy\fR.
294 .IP "\fB\-st\fR,    \fB\-\-standard\-output\fR" 4
295 .IX Item "-st,    --standard-output"
296 Perltidy must be able to operate on an arbitrarily large number of files
297 in a single run, with each output being directed to a different output
298 file.  Obviously this would conflict with outputting to the single
299 standard output device, so a special flag, \fB\-st\fR, is required to
300 request outputting to the standard output.  For example,
301 .Sp
302 .Vb 1
303 \&  perltidy somefile.pl -st >somefile.new.pl
304 .Ve
305 This option may only be used if there is just a single input file.  
306 The default is \fB\-nst\fR or \fB\-nostandard\-output\fR.
307 .IP "\fB\-se\fR,    \fB\-\-standard\-error\-output\fR" 4
308 .IX Item "-se,    --standard-error-output"
309 If perltidy detects an error when processing file \fIsomefile.pl\fR, its
310 default behavior is to write error messages to file \fIsomefile.pl.ERR\fR.
311 Use \fB\-se\fR to cause all error messages to be sent to the standard error
312 output stream instead.  This directive may be negated with \fB\-nse\fR.
313 Thus, you may place \fB\-se\fR in a \fI.perltidyrc\fR and override it when
314 desired with \fB\-nse\fR on the command line.
315 .IP "\fB\-oext\fR=ext,    \fB\-\-output\-file\-extension\fR=ext" 4
316 .IX Item "-oext=ext,    --output-file-extension=ext"
317 Change the extension of the output file to be \fIext\fR instead of the
318 default \fItdy\fR (or \fIhtml\fR in case the \-\fB\-html\fR option is used).
319 See \*(L"Specifying File Extensions\*(R".
320 .IP "\fB\-opath\fR=path,    \fB\-\-output\-path\fR=path" 4
321 .IX Item "-opath=path,    --output-path=path"
322 When perltidy creates a filename for an output file, by default it merely
323 appends an extension to the path and basename of the input file.  This
324 parameter causes the path to be changed to \fIpath\fR instead.
325 .Sp
326 The path should end in a valid path separator character, but perltidy will try
327 to add one if it is missing.
328 .Sp
329 For example
330 .Sp
331 .Vb 1
332 \& perltidy somefile.pl -opath=/tmp/
333 .Ve
334 will produce \fI/tmp/somefile.pl.tdy\fR.  Otherwise, \fIsomefile.pl.tdy\fR will
335 appear in whatever directory contains \fIsomefile.pl\fR.
336 .Sp
337 If the path contains spaces, it should be placed in quotes.
338 .Sp
339 This parameter will be ignored if output is being directed to standard output,
340 or if it is being specified explicitly with the \fB\-o=s\fR parameter.
341 .IP "\fB\-b\fR,    \fB\-\-backup\-and\-modify\-in\-place\fR" 4
342 .IX Item "-b,    --backup-and-modify-in-place"
343 Modify the input file or files in-place and save the original with the
344 extension \fI.bak\fR.  Any existing \fI.bak\fR file will be deleted.  See next item
345 for changing the default backup extension.  
346 .Sp
347 A \fB\-b\fR flag will be ignored if input is from standard input, or
348 if the \fB\-html\fR flag is set. 
349 .IP "\fB\-bext\fR=ext,    \fB\-\-backup\-file\-extension\fR=ext" 4
350 .IX Item "-bext=ext,    --backup-file-extension=ext"
351 Change the extension of the backup file to be something other than the
352 default \fI.bak\fR.  See \*(L"Specifying File Extensions\*(R".
353 .IP "\fB\-w\fR,    \fB\-\-warning\-output\fR" 4
354 .IX Item "-w,    --warning-output"
355 Setting \fB\-w\fR causes any non-critical warning
356 messages to be reported as errors.  These include messages
357 about possible pod problems, possibly bad starting indentation level,
358 and cautions about indirect object usage.  The default, \fB\-nw\fR or
359 \&\fB\-\-nowarning\-output\fR, is not to include these warnings.
360 .IP "\fB\-q\fR,    \fB\-\-quiet\fR" 4
361 .IX Item "-q,    --quiet"
362 Deactivate error messages and syntax checking (for running under
363 an editor). 
364 .Sp
365 For example, if you use a vi-style editor, such as vim, you may execute
366 perltidy as a filter from within the editor using something like
367 .Sp
368 .Vb 1
369 \& :n1,n2!perltidy -q
370 .Ve
371 where \f(CW\*(C`n1,n2\*(C'\fR represents the selected text.  Without the \fB\-q\fR flag,
372 any error message may mess up your screen, so be prepared to use your
373 \&\*(L"undo\*(R" key.
374 .IP "\fB\-log\fR,    \fB\-\-logfile\fR" 4
375 .IX Item "-log,    --logfile"
376 Save the \fI.LOG\fR file, which has many useful diagnostics.  Perltidy always
377 creates a \fI.LOG\fR file, but by default it is deleted unless a program bug is
378 suspected.  Setting the \fB\-log\fR flag forces the log file to be saved.
379 .IP "\fB\-g=n\fR, \fB\-\-logfile\-gap=n\fR" 4
380 .IX Item "-g=n, --logfile-gap=n"
381 Set maximum interval between input code lines in the logfile.  This purpose of
382 this flag is to assist in debugging nesting errors.  The value of \f(CW\*(C`n\*(C'\fR is
383 optional.  If you set the flag \fB\-g\fR without the value of \f(CW\*(C`n\*(C'\fR, it will be
384 taken to be 1, meaning that every line will be written to the log file.  This
385 can be helpful if you are looking for a brace, paren, or bracket nesting error. 
386 .Sp
387 Setting \fB\-g\fR also causes the logfile to be saved, so it is not necessary to
388 also include \fB\-log\fR. 
389 .Sp
390 If no \fB\-g\fR flag is given, a value of 50 will be used, meaning that at least
391 every 50th line will be recorded in the logfile.  This helps prevent
392 excessively long log files.  
393 .Sp
394 Setting a negative value of \f(CW\*(C`n\*(C'\fR is the same as not setting \fB\-g\fR at all.
395 .IP "\fB\-npro\fR  \fB\-\-noprofile\fR" 4
396 .IX Item "-npro  --noprofile"
397 Ignore any \fI.perltidyrc\fR command file.  Normally, perltidy looks first in
398 your current directory for a \fI.perltidyrc\fR file of parameters.  (The format
399 is described below).  If it finds one, it applies those options to the
400 initial default values, and then it applies any that have been defined
401 on the command line.  If no \fI.perltidyrc\fR file is found, it looks for one
402 in your home directory.
403 .Sp
404 If you set the \fB\-npro\fR flag, perltidy will not look for this file.
405 .IP "\fB\-pro=filename\fR or  \fB\-\-profile=filename\fR" 4
406 .IX Item "-pro=filename or  --profile=filename"
407 To simplify testing and switching .perltidyrc files, this command may be
408 used to specify a configuration file which will override the default
409 name of .perltidyrc.  There must not be a space on either side of the
410 \&'=' sign.  For example, the line
411 .Sp
412 .Vb 1
413 \&   perltidy -pro=testcfg
414 .Ve
415 would cause file \fItestcfg\fR to be used instead of the 
416 default \fI.perltidyrc\fR.
417 .IP "\fB\-opt\fR,   \fB\-\-show\-options\fR" 4
418 .IX Item "-opt,   --show-options"
419 Write a list of all options used to the \fI.LOG\fR file.  
420 Please see \fB\-\-dump\-options\fR for a simpler way to do this.
421 .IP "\fB\-f\fR,   \fB\-\-force\-read\-binary\fR" 4
422 .IX Item "-f,   --force-read-binary"
423 Force perltidy to process binary files.  To avoid producing excessive
424 error messages, perltidy skips files identified by the system as non\-text.
425 However, valid perl scripts containing binary data may sometimes be identified
426 as non\-text, and this flag forces perltidy to process them.
427 .SH "FORMATTING OPTIONS"
428 .IX Header "FORMATTING OPTIONS"
429 .Sh "Basic Options"
430 .IX Subsection "Basic Options"
431 .IP "\fB\-l=n\fR, \fB\-\-maximum\-line\-length=n\fR" 4
432 .IX Item "-l=n, --maximum-line-length=n"
433 The default maximum line length is n=80 characters.  Perltidy will try
434 to find line break points to keep lines below this length. However, long
435 quotes and side comments may cause lines to exceed this length. 
436 Setting \fB\-l=0\fR is equivalent to setting \fB\-l=(a large number)\fR. 
437 .IP "\fB\-i=n\fR,  \fB\-\-indent\-columns=n\fR" 4
438 .IX Item "-i=n,  --indent-columns=n"
439 Use n columns per indentation level (default n=4).
440 .IP "tabs" 4
441 .IX Item "tabs"
442 Using tab characters will almost certainly lead to future portability
443 and maintenance problems, so the default and recommendation is not to
444 use them.  For those who prefer tabs, however, there are two different
445 options.  
446 .Sp
447 Except for possibly introducing tab indentation characters, as outlined
448 below, perltidy does not introduce any tab characters into your file,
449 and it removes any tabs from the code (unless requested not to do so
450 with \fB\-fws\fR).  If you have any tabs in your comments, quotes, or
451 here\-documents, they will remain.
452 .RS 4
453 .IP "\fB\-et=n\fR,   \fB\-\-entab\-leading\-whitespace\fR" 4
454 .IX Item "-et=n,   --entab-leading-whitespace"
455 This flag causes each \fBn\fR initial space characters to be replaced by
456 one tab character.  Note that the integer \fBn\fR is completely independent
457 of the integer specified for indentation parameter, \fB\-i=n\fR.
458 .IP "\fB\-t\fR,   \fB\-\-tabs\fR" 4
459 .IX Item "-t,   --tabs"
460 This flag causes one leading tab character to be inserted for each level
461 of indentation.  Certain other features are incompatible with this
462 option, and if these options are also given, then a warning message will
463 be issued and this flag will be unset.  One example is the \fB\-lp\fR
464 option.
465 .RE
466 .RS 4
467 .RE
468 .IP "\fB\-syn\fR,   \fB\-\-check\-syntax\fR" 4
469 .IX Item "-syn,   --check-syntax"
470 This flag causes perltidy to run \f(CW\*(C`perl \-c \-T\*(C'\fR to check syntax of input
471 and output.  (To change the flags passed to perl, see the next
472 item, \fB\-pscf\fR).  The results are written to the \fI.LOG\fR file, which
473 will be saved if an error is detected in the output script.  The output
474 script is not checked if the input script has a syntax error.  Perltidy
475 does its own checking, but this option employs perl to get a \*(L"second
476 opinion\*(R".
477 .Sp
478 If perl reports errors in the input file, they will not be reported in
479 the error output unless the \fB\-warning\-output\fR flag is given. 
480 .Sp
481 The default is \fBnot\fR to do this type of syntax checking (although
482 perltidy will still do as much self-checking as possible).  The reason
483 is that it causes all code in \s-1BEGIN\s0 blocks to be executed, for all
484 modules being used, and this opens the door to security issues and
485 infinite loops when running perltidy.
486 .IP "\fB\-pscf=s\fR, \fB\-perl\-syntax\-check\-flags=s\fR" 4
487 .IX Item "-pscf=s, -perl-syntax-check-flags=s"
488 When perl is invoked to check syntax, the normal flags are \f(CW\*(C`\-c \-T\*(C'\fR.  In
489 addition, if the \fB\-x\fR flag is given to perltidy, then perl will also be
490 passed a \fB\-x\fR flag.  It should not normally be necessary to change
491 these flags, but it can be done with the \fB\-pscf=s\fR flag.  For example,
492 if the taint flag, \f(CW\*(C`\-T\*(C'\fR, is not wanted, the flag could be set to be just
493 \&\fB\-pscf=\-c\fR.  
494 .Sp
495 Perltidy will pass your string to perl with the exception that it will
496 add a \fB\-c\fR and \fB\-x\fR if appropriate.  The \fI.LOG\fR file will show
497 exactly what flags were passed to perl.
498 .IP "\fB\-io\fR,   \fB\-\-indent\-only\fR" 4
499 .IX Item "-io,   --indent-only"
500 This flag is used to deactivate all formatting and line break changes.
501 When it is in effect, the only change to the script will be indentation.
502 And any flags controlling whitespace and newlines will be ignored.  You
503 might want to use this if you are perfectly happy with your whitespace
504 and line breaks, and merely want perltidy to handle the indentation.
505 (This also speeds up perltidy by well over a factor of two, so it might be
506 useful when perltidy is merely being used to help find a brace error in
507 a large script).
508 .Sp
509 Setting this flag is equivalent to setting \fB\-\-freeze\-newlines\fR and
510 \&\fB\-\-freeze\-whitespace\fR.
511 .IP "\fB\-ole=s\fR,  \fB\-\-output\-line\-ending=s\fR" 4
512 .IX Item "-ole=s,  --output-line-ending=s"
513 where s=\f(CW\*(C`win\*(C'\fR, \f(CW\*(C`dos\*(C'\fR, \f(CW\*(C`unix\*(C'\fR, or \f(CW\*(C`mac\*(C'\fR.  This flag tells perltidy
514 to output line endings for a specific system.  Normally,
515 perltidy writes files with the line separator character of the host
516 system.  The \f(CW\*(C`win\*(C'\fR and \f(CW\*(C`dos\*(C'\fR flags have an identical result.
517 \&\fB\s-1NOTE\s0\fR: This only works under unix-like systems and is ignored under
518 other systems.
519 .IP "\fB\-ple\fR,  \fB\-\-preserve\-line\-endings\fR" 4
520 .IX Item "-ple,  --preserve-line-endings"
521 This flag tells perltidy to write its output files with the same line
522 endings as the input file, if possible.  It should work for
523 \&\fBdos\fR, \fBunix\fR, and \fBmac\fR line endings.  It will only work if perltidy
524 input comes from a filename (rather than stdin, for example).  If
525 perltidy has trouble determining the input file line ending, it will
526 revert to the default behavior of using the line ending of the host system.
527 \&\fB\s-1NOTE\s0\fR: This only works under unix-like systems and is ignored under
528 other systems.
529 .Sh "Code Indentation Control"
530 .IX Subsection "Code Indentation Control"
531 .IP "\fB\-ci=n\fR, \fB\-\-continuation\-indentation=n\fR" 4
532 .IX Item "-ci=n, --continuation-indentation=n"
533 Continuation indentation is extra indentation spaces applied when
534 a long line is broken.  The default is n=2, illustrated here:
535 .Sp
536 .Vb 2
537 \& my $level =   # -ci=2      
538 \&   ( $max_index_to_go >= 0 ) ? $levels_to_go[0] : $last_output_level;
539 .Ve
540 The same example, with n=0, is a little harder to read:
541 .Sp
542 .Vb 2
543 \& my $level =   # -ci=0    
544 \& ( $max_index_to_go >= 0 ) ? $levels_to_go[0] : $last_output_level;
545 .Ve
546 The value given to \fB\-ci\fR is also used by some commands when a small
547 space is required.  Examples are commands for outdenting labels,
548 \&\fB\-ola\fR, and control keywords, \fB\-okw\fR.  
549 .Sp
550 When default values are not used, it is suggested that the value \fBn\fR
551 given with \fB\-ci=n\fR be no more than about one-half of the number of
552 spaces assigned to a full indentation level on the \fB\-i=n\fR command.
553 .IP "\fB\-sil=n\fR \fB\-\-starting\-indentation\-level=n\fR" 4
554 .IX Item "-sil=n --starting-indentation-level=n"
555 By default, perltidy examines the input file and tries to determine the
556 starting indentation level.  While it is often zero, it may not be
557 zero for a code snippet being sent from an editing session.  If the
558 default method does not work correctly, or you want to change the
559 starting level, use \fB\-sil=n\fR, to force the starting level to be n.
560 .IP "List indentation using \fB\-lp\fR, \fB\-\-line\-up\-parentheses\fR" 4
561 .IX Item "List indentation using -lp, --line-up-parentheses"
562 By default, perltidy indents lists with 4 spaces, or whatever value
563 is specified with \fB\-i=n\fR.  Here is a small list formatted in this way:
564 .Sp
565 .Vb 5
566 \&    # perltidy (default)
567 \&    @month_of_year = (
568 \&        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
569 \&        'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
570 \&    );
571 .Ve
572 Use the \fB\-lp\fR flag to add extra indentation to cause the data to begin
573 past the opening parentheses of a sub call or list, or opening square
574 bracket of an anonymous array, or opening curly brace of an anonymous
575 hash.  With this option, the above list would become:
576 .Sp
577 .Vb 5
578 \&    # perltidy -lp
579 \&    @month_of_year = (
580 \&                       'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
581 \&                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
582 \&    );
583 .Ve
584 If the available line length (see \fB\-l=n\fR ) does not permit this much 
585 space, perltidy will use less.   For alternate placement of the
586 closing paren, see the next section.
587 .Sp
588 This option has no effect on code \s-1BLOCKS\s0, such as if/then/else blocks,
589 which always use whatever is specified with \fB\-i=n\fR.  Also, the
590 existence of line breaks and/or block comments between the opening and
591 closing parens may cause perltidy to temporarily revert to its default
592 method.
593 .Sp
594 Note: The \fB\-lp\fR option may not be used together with the \fB\-t\fR tabs option.
595 It may, however, be used with the \fB\-et=n\fR tab method.
596 .Sp
597 In addition, any parameter which significantly restricts the ability of
598 perltidy to choose newlines will conflict with \fB\-lp\fR and will cause
599 \&\fB\-lp\fR to be deactivated.  These include \fB\-io\fR, \fB\-fnl\fR, \fB\-nanl\fR, and
600 \&\fB\-ndnl\fR.  The reason is that the \fB\-lp\fR indentation style can require
601 the careful coordination of an arbitrary number of break points in
602 hierarchical lists, and these flags may prevent that.
603 .IP "\fB\-cti=n\fR, \fB\-\-closing\-token\-indentation\fR" 4
604 .IX Item "-cti=n, --closing-token-indentation"
605 The \fB\-cti=n\fR flag controls the indentation of a line beginning with 
606 a \f(CW\*(C`)\*(C'\fR, \f(CW\*(C`]\*(C'\fR, or a non-block \f(CW\*(C`}\*(C'\fR.  Such a line receives:
607 .Sp
608 .Vb 5
609 \& -cti = 0 no extra indentation (default)
610 \& -cti = 1 extra indentation such that the closing token
611 \&        aligns with its opening token.
612 \& -cti = 2 one extra indentation level if the line looks like:
613 \&        );  or  ];  or  };
614 .Ve
615 The flags \fB\-cti=1\fR and \fB\-cti=2\fR work well with the \fB\-lp\fR flag (previous
616 section).
617 .Sp
618 .Vb 5
619 \&    # perltidy -lp -cti=1
620 \&    @month_of_year = (
621 \&                       'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
622 \&                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
623 \&                     );
624 .Ve
625 .Vb 5
626 \&    # perltidy -lp -cti=2
627 \&    @month_of_year = (
628 \&                       'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
629 \&                       'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
630 \&                       );
631 .Ve
632 These flags are merely hints to the formatter and they may not always be
633 followed.  In particular, if \-lp is not being used, the indentation for
634 \&\fBcti=1\fR is constrained to be no more than one indentation level.
635 .Sp
636 If desired, this control can be applied independently to each of the
637 closing container token types.  In fact, \fB\-cti=n\fR is merely an
638 abbreviation for \fB\-cpi=n \-csbi=n \-cbi=n\fR, where:  
639 \&\fB\-cpi\fR or \fB\-closing\-paren\-indentation\fR controls \fB)\fR's,
640 \&\fB\-csbi\fR or \fB\-closing\-square\-bracket\-indentation\fR controls \fB]\fR's, 
641 \&\fB\-cbi\fR or \fB\-closing\-brace\-indentation\fR controls non-block \fB}\fR's. 
642 .IP "\fB\-icp\fR, \fB\-\-indent\-closing\-paren\fR" 4
643 .IX Item "-icp, --indent-closing-paren"
644 The \fB\-icp\fR flag is equivalent to
645 \&\fB\-cti=2\fR, described in the previous section.  The \fB\-nicp\fR flag is
646 equivalent \fB\-cti=0\fR.  They are included for backwards compatability.
647 .IP "\fB\-icb\fR, \fB\-\-indent\-closing\-brace\fR" 4
648 .IX Item "-icb, --indent-closing-brace"
649 The \fB\-icb\fR option leaves a brace which terminates a code block 
650 indented with the same indentation as the previous line.  For example,
651 .Sp
652 .Vb 6
653 \&        if ($task) {
654 \&            yyy();
655 \&            }    # -icb
656 \&        else {
657 \&            zzz();
658 \&            }
659 .Ve
660 The default is not to do this, indicated by \fB\-nicb\fR.
661 .IP "\fB\-olq\fR, \fB\-\-outdent\-long\-quotes\fR" 4
662 .IX Item "-olq, --outdent-long-quotes"
663 When \fB\-olq\fR is set, lines which is a quoted string longer than the
664 value \fBmaximum-line-length\fR will have their indentation removed to make
665 them more readable.  This is the default.  To prevent such out\-denting,
666 use \fB\-nolq\fR or \fB\-\-nooutdent\-long\-lines\fR.
667 .IP "\fB\-oll\fR, \fB\-\-outdent\-long\-lines\fR" 4
668 .IX Item "-oll, --outdent-long-lines"
669 This command is equivalent to \fB\-\-outdent\-long\-quotes\fR and
670 \&\fB\-\-outdent\-long\-comments\fR, and it is included for compatibility with previous
671 versions of perltidy.  The negation of this also works, \fB\-noll\fR or
672 \&\fB\-\-nooutdent\-long\-lines\fR, and is equivalent to setting \fB\-nolq\fR and \fB\-nolc\fR.
673 .IP "Outdenting Labels: \fB\-ola\fR,  \fB\-\-outdent\-labels\fR" 4
674 .IX Item "Outdenting Labels: -ola,  --outdent-labels"
675 This command will cause labels to be outdented by 2 spaces (or whatever \fB\-ci\fR
676 has been set to), if possible.  This is the default.  For example:
677 .Sp
678 .Vb 6
679 \&        my $i;
680 \&      LOOP: while ( $i = <FOTOS> ) {
681 \&            chomp($i);
682 \&            next unless $i;
683 \&            fixit($i);
684 \&        }
685 .Ve
686 Use \fB\-nola\fR to not outdent labels. 
687 .IP "Outdenting Keywords" 4
688 .IX Item "Outdenting Keywords"
689 .RS 4
690 .PD 0
691 .IP "\fB\-okw\fR,  \fB\-\-outdent\-keywords\fR" 4
692 .IX Item "-okw,  --outdent-keywords"
693 .PD
694 The command \fB\-okw\fR will will cause certain leading control keywords to
695 be outdented by 2 spaces (or whatever \fB\-ci\fR has been set to), if
696 possible.  By default, these keywords are \f(CW\*(C`redo\*(C'\fR, \f(CW\*(C`next\*(C'\fR, \f(CW\*(C`last\*(C'\fR,
697 \&\f(CW\*(C`goto\*(C'\fR, and \f(CW\*(C`return\*(C'\fR.  The intention is to make these control keywords
698 easier to see.  To change this list of keywords being outdented, see
699 the next section.
700 .Sp
701 For example, using \f(CW\*(C`perltidy \-okw\*(C'\fR on the previous example gives:
702 .Sp
703 .Vb 6
704 \&        my $i;
705 \&      LOOP: while ( $i = <FOTOS> ) {
706 \&            chomp($i);
707 \&          next unless $i;
708 \&            fixit($i);
709 \&        }
710 .Ve
711 The default is not to do this.  
712 .IP "Specifying Outdented Keywords: \fB\-okwl=string\fR,  \fB\-\-outdent\-keyword\-list=string\fR" 4
713 .IX Item "Specifying Outdented Keywords: -okwl=string,  --outdent-keyword-list=string"
714 This command can be used to change the keywords which are outdented with
715 the \fB\-okw\fR command.  The parameter \fBstring\fR is a required list of perl
716 keywords, which should be placed in quotes if there are more than one.
717 By itself, it does not cause any outdenting to occur, so the \fB\-okw\fR
718 command is still required.
719 .Sp
720 For example, the commands \f(CW\*(C`\-okwl="next last redo goto" \-okw\*(C'\fR will cause
721 those four keywords to be outdented.  It is probably simplest to place
722 any \fB\-okwl\fR command in a \fI.perltidyrc\fR file.
723 .RE
724 .RS 4
725 .RE
726 .Sh "Whitespace Control"
727 .IX Subsection "Whitespace Control"
728 Whitespace refers to the blank space between variables, operators,
729 and other code tokens.
730 .IP "\fB\-fws\fR,  \fB\-\-freeze\-whitespace\fR" 4
731 .IX Item "-fws,  --freeze-whitespace"
732 This flag causes your original whitespace to remain unchanged, and
733 causes the rest of the whitespace commands in this section, the
734 Code Indentation section, and
735 the Comment Control section to be ignored.
736 .IP "Tightness of curly braces, parentheses, and square brackets." 4
737 .IX Item "Tightness of curly braces, parentheses, and square brackets."
738 Here the term \*(L"tightness\*(R" will mean the closeness with which
739 pairs of enclosing tokens, such as parentheses, contain the quantities
740 within.  A numerical value of 0, 1, or 2 defines the tightness, with
741 0 being least tight and 2 being most tight.  Spaces within containers
742 are always symmetric, so if there is a space after a \f(CW\*(C`(\*(C'\fR then there
743 will be a space before the corresponding \f(CW\*(C`)\*(C'\fR.
744 .Sp
745 The \fB\-pt=n\fR or \fB\-\-paren\-tightness=n\fR parameter controls the space within
746 parens.  The example below shows the effect of the three possible
747 values, 0, 1, and 2:
748 .Sp
749 .Vb 3
750 \& if ( ( my $len_tab = length( $tabstr ) ) > 0 ) {  # -pt=0
751 \& if ( ( my $len_tab = length($tabstr) ) > 0 ) {    # -pt=1 (default)
752 \& if ((my $len_tab = length($tabstr)) > 0) {        # -pt=2
753 .Ve
754 When n is 0, there is always a space to the right of a '(' and to the left
755 of a ')'.  For n=2 there is never a space.  For n=1, the default, there
756 is a space unless the quantity within the parens is a single token, such
757 as an identifier or quoted string.  
758 .Sp
759 Likewise, the parameter \fB\-sbt=n\fR or \fB\-\-square\-bracket\-tightness=n\fR
760 controls the space within square brackets, as illustrated below.
761 .Sp
762 .Vb 3
763 \& $width = $col[ $j + $k ] - $col[ $j ];  # -sbt=0
764 \& $width = $col[ $j + $k ] - $col[$j];    # -sbt=1 (default)
765 \& $width = $col[$j + $k] - $col[$j];      # -sbt=2
766 .Ve
767 Curly braces which do not contain code blocks are controlled by
768 the parameter \fB\-bt=n\fR or \fB\-\-brace\-tightness=n\fR. 
769 .Sp
770 .Vb 3
771 \& $obj->{ $parsed_sql->{ 'table' }[0] };    # -bt=0
772 \& $obj->{ $parsed_sql->{'table'}[0] };      # -bt=1 (default)
773 \& $obj->{$parsed_sql->{'table'}[0]};        # -bt=2
774 .Ve
775 And finally, curly braces which contain blocks of code are controlled by the
776 parameter \fB\-bbt=n\fR or \fB\-\-block\-brace\-tightness=n\fR as illustrated in the
777 example below.   
778 .Sp
779 .Vb 3
780 \& %bf = map { $_ => -M $_ } grep { /\e.deb$/ } dirents '.'; # -bbt=0 (default)
781 \& %bf = map { $_ => -M $_ } grep {/\e.deb$/} dirents '.';   # -bbt=1
782 \& %bf = map {$_ => -M $_} grep {/\e.deb$/} dirents '.';     # -bbt=2
783 .Ve
784 .IP "\fB\-sts\fR,   \fB\-\-space\-terminal\-semicolon\fR" 4
785 .IX Item "-sts,   --space-terminal-semicolon"
786 Some programmers prefer a space before all terminal semicolons.  The
787 default is for no such space, and is indicated with \fB\-nsts\fR or
788 \&\fB\-\-nospace\-terminal\-semicolon\fR.
789 .Sp
790 .Vb 2
791 \&        $i = 1 ;     #  -sts
792 \&        $i = 1;      #  -nsts   (default)
793 .Ve
794 .IP "\fB\-sfs\fR,   \fB\-\-space\-for\-semicolon\fR" 4
795 .IX Item "-sfs,   --space-for-semicolon"
796 Semicolons within \fBfor\fR loops may sometimes be hard to see,
797 particularly when commas are also present.  This option places spaces on
798 both sides of these special semicolons, and is the default.  Use
799 \&\fB\-nsfs\fR or \fB\-\-nospace\-for\-semicolon\fR to deactivate it.
800 .Sp
801 .Vb 2
802 \& for ( @a = @$ap, $u = shift @a ; @a ; $u = $v ) {  # -sfs (default)
803 \& for ( @a = @$ap, $u = shift @a; @a; $u = $v ) {    # -nsfs
804 .Ve
805 .IP "\fB\-asc\fR,  \fB\-\-add\-semicolons\fR" 4
806 .IX Item "-asc,  --add-semicolons"
807 Setting \fB\-asc\fR allows perltidy to add any missing optional semicolon at the end 
808 of a line which is followed by a closing curly brace on the next line.  This
809 is the default, and may be deactivated with \fB\-nasc\fR or \fB\-\-noadd\-semicolons\fR.
810 .IP "\fB\-dsm\fR,  \fB\-\-delete\-semicolons\fR" 4
811 .IX Item "-dsm,  --delete-semicolons"
812 Setting \fB\-dsm\fR allows perltidy to delete extra semicolons which are
813 simply empty statements.  This is the default, and may be deactivated
814 with \fB\-ndsm\fR or \fB\-\-nodelete\-semicolons\fR.  (Such semicolons are not
815 deleted, however, if they would promote a side comment to a block
816 comment).
817 .IP "\fB\-aws\fR,  \fB\-\-add\-whitespace\fR" 4
818 .IX Item "-aws,  --add-whitespace"
819 Setting this option allows perltidy to add certain whitespace improve
820 code readability.  This is the default. If you do not want any
821 whitespace added, but are willing to have some whitespace deleted, use
822 \&\fB\-naws\fR.  (Use \fB\-fws\fR to leave whitespace completely unchanged).
823 .IP "\fB\-dws\fR,  \fB\-\-delete\-old\-whitespace\fR" 4
824 .IX Item "-dws,  --delete-old-whitespace"
825 Setting this option allows perltidy to remove some old whitespace
826 between characters, if necessary.  This is the default.  If you
827 do not want any old whitespace removed, use \fB\-ndws\fR or
828 \&\fB\-\-nodelete\-old\-whitespace\fR.
829 .IP "Detailed whitespace controls around tokens" 4
830 .IX Item "Detailed whitespace controls around tokens"
831 For those who want more detailed control over the whitespace around
832 tokens, there are four parameters which can directly modify the default
833 whitespace rules built into perltidy for any token.  They are:
834 .Sp
835 \&\fB\-wls=s\fR or \fB\-\-want\-left\-space=s\fR,
836 .Sp
837 \&\fB\-nwls=s\fR or \fB\-\-nowant\-left\-space=s\fR,
838 .Sp
839 \&\fB\-wrs=s\fR or \fB\-\-want\-right\-space=s\fR,
840 .Sp
841 \&\fB\-nwrs=s\fR or \fB\-\-nowant\-right\-space=s\fR.
842 .Sp
843 These parameters are each followed by a quoted string, \fBs\fR, containing a
844 list of token types.  No more than one of each of these parameters
845 should be specified, because repeating a command-line parameter
846 always overwrites the previous one before perltidy ever sees it.
847 .Sp
848 To illustrate how these are used, suppose it is desired that there be no
849 space on either side of the token types \fB= + \- / *\fR.  The following two
850 parameters would specify this desire:
851 .Sp
852 .Vb 1
853 \&  -nwls="= + - / *"    -nwrs="= + - / *"
854 .Ve
855 (Note that the token types are in quotes, and that they are separated by
856 spaces).  With these modified whitespace rules, the following line of math:
857 .Sp
858 .Vb 1
859 \&  $root = -$b + sqrt( $b * $b - 4. * $a * $c ) / ( 2. * $a );
860 .Ve
861 becomes this:
862 .Sp
863 .Vb 1
864 \&  $root=-$b+sqrt( $b*$b-4.*$a*$c )/( 2.*$a );
865 .Ve
866 These parameters should be considered to be hints to perltidy rather
867 than fixed rules, because perltidy must try to resolve conflicts that
868 arise between them and all of the other rules that it uses.  One
869 conflict that can arise is if, between two tokens, the left token wants
870 a space and the right one doesn't.  In this case, the token not wanting
871 a space takes priority.  
872 .Sp
873 It is necessary to have a list of all token types in order to create
874 this type of input.  Such a list can be obtained by the command
875 \&\fB\-dump\-token\-types\fR.
876 .IP "Space between keyword and opening paren" 4
877 .IX Item "Space between keyword and opening paren"
878 When an opening paren follows a keyword, no space is introduced after the
879 keyword, unless it is (by default) one of these:
880 .Sp
881 .Vb 2
882 \&   my local our and or eq ne if else elsif until unless 
883 \&   while for foreach return switch case given when
884 .Ve
885 These defaults can be modified with two commands:
886 .Sp
887 \&\fB\-sak=s\fR  or \fB\-\-space\-after\-keyword=s\fR  adds keywords.
888 .Sp
889 \&\fB\-nsak=s\fR  or \fB\-\-nospace\-after\-keyword=s\fR  removes keywords.
890 .Sp
891 where \fBs\fR is a list of keywords (in quotes if necessary).  For example, 
892 .Sp
893 .Vb 2
894 \&  my ( $a, $b, $c ) = @_;    # default
895 \&  my( $a, $b, $c ) = @_;     # -nsak="my local our"
896 .Ve
897 .ie n .IP "Trimming whitespace around ""qw"" quotes" 4
898 .el .IP "Trimming whitespace around \f(CWqw\fR quotes" 4
899 .IX Item "Trimming whitespace around qw quotes"
900 \&\fB\-tqw\fR or \fB\-\-trim\-qw\fR provide the default behavior of trimming
901 spaces around multi-line \f(CW\*(C`qw\*(C'\fR quotes and indenting them appropriately.
902 .Sp
903 \&\fB\-ntqw\fR or \fB\-\-notrim\-qw\fR cause leading and trailing whitespace around
904 multi-line \f(CW\*(C`qw\*(C'\fR quotes to be left unchanged.  This option will not
905 normally be necessary, but was added for testing purposes, because in
906 some versions of perl, trimming \f(CW\*(C`qw\*(C'\fR quotes changes the syntax tree.
907 .Sh "Comment Controls"
908 .IX Subsection "Comment Controls"
909 Perltidy has a number of ways to control the appearance of both block comments
910 and side comments.  The term \fBblock comment\fR here refers to a full-line
911 comment, whereas \fBside comment\fR will refer to a comment which appears on a
912 line to the right of some code.
913 .IP "\fB\-ibc\fR,  \fB\-\-indent\-block\-comments\fR" 4
914 .IX Item "-ibc,  --indent-block-comments"
915 Block comments normally look best when they are indented to the same
916 level as the code which follows them.  This is the default behavior, but
917 you may use \fB\-nibc\fR to keep block comments left\-justified.  Here is an
918 example:
919 .Sp
920 .Vb 2
921 \&             # this comment is indented      (-ibc, default)
922 \&             if ($task) { yyy(); }
923 .Ve
924 The alternative is \fB\-nibc\fR:
925 .Sp
926 .Vb 2
927 \& # this comment is not indented              (-nibc)
928 \&             if ($task) { yyy(); }
929 .Ve
930 See also the next item, \fB\-isbc\fR, as well as \fB\-sbc\fR, for other ways to
931 have some indented and some outdented block comments.
932 .IP "\fB\-isbc\fR,  \fB\-\-indent\-spaced\-block\-comments\fR" 4
933 .IX Item "-isbc,  --indent-spaced-block-comments"
934 If there is no leading space on the line, then the comment will not be
935 indented, and otherwise it may be.
936 .Sp
937 If both \fB\-ibc\fR and \fB\-isbc\fR are set, then \fB\-isbc\fR takes priority.
938 .IP "\fB\-olc\fR, \fB\-\-outdent\-long\-comments\fR" 4
939 .IX Item "-olc, --outdent-long-comments"
940 When \fB\-olc\fR is set, lines which are full-line (block) comments longer
941 than the value \fBmaximum-line-length\fR will have their indentation
942 removed.  The default is not to do this.  
943 .IP "\fB\-msc=n\fR,  \fB\-\-minimum\-space\-to\-comment=n\fR" 4
944 .IX Item "-msc=n,  --minimum-space-to-comment=n"
945 Side comments look best when lined up several spaces to the right of
946 code.  Perltidy will try to keep comments at least n spaces to the
947 right.  The default is n=4 spaces.
948 .IP "\fB\-hsc\fR, \fB\-\-hanging\-side\-comments\fR" 4
949 .IX Item "-hsc, --hanging-side-comments"
950 By default, perltidy tries to identify and align \*(L"hanging side
951 comments\*(R", which are something like this:
952 .Sp
953 .Vb 3
954 \&        my $IGNORE = 0;    # This is a side comment
955 \&                           # This is a hanging side comment
956 \&                           # And so is this
957 .Ve
958 A comment is considered to be a hanging side comment if (1) it immediately
959 follows a line with a side comment, or another hanging side comment, and
960 (2) there is some leading whitespace on the line.
961 To deactivate this feature, use \fB\-nhsc\fR or \fB\-\-nohanging\-side\-comments\fR.  
962 If block comments are preceded by a blank line, or have no leading
963 whitespace, they will not be mistaken as hanging side comments.
964 .IP "Closing Side Comments" 4
965 .IX Item "Closing Side Comments"
966 A closing side comment is a special comment which perltidy can
967 automatically create and place after the closing brace of a code block.
968 They can be useful for code maintenance and debugging.  The command
969 \&\fB\-csc\fR (or \fB\-closing\-side\-comments\fR) adds or updates closing side
970 comments.  For example, here is a small code snippet
971 .Sp
972 .Vb 8
973 \&        sub message {
974 \&            if ( !defined( $_[0] ) ) {
975 \&                print("Hello, World\en");
976 \&            }
977 \&            else {
978 \&                print( $_[0], "\en" );
979 \&            }
980 \&        }
981 .Ve
982 And here is the result of processing with \f(CW\*(C`perltidy \-csc\*(C'\fR:
983 .Sp
984 .Vb 8
985 \&        sub message {
986 \&            if ( !defined( $_[0] ) ) {
987 \&                print("Hello, World\en");
988 \&            }
989 \&            else {
990 \&                print( $_[0], "\en" );
991 \&            }
992 \&        } ## end sub message
993 .Ve
994 A closing side comment was added for \f(CW\*(C`sub message\*(C'\fR in this case, but not
995 for the \f(CW\*(C`if\*(C'\fR and \f(CW\*(C`else\*(C'\fR blocks, because they were below the 6 line
996 cutoff limit for adding closing side comments.  This limit may be
997 changed with the \fB\-csci\fR command, described below.
998 .Sp
999 The command \fB\-dcsc\fR (or \fB\-\-delete\-closing\-side\-comments\fR) reverses this 
1000 process and removes these comments.
1001 .Sp
1002 Several commands are available to modify the behavior of these two basic
1003 commands, \fB\-csc\fR and \fB\-dcsc\fR:
1004 .RS 4
1005 .IP "\fB\-csci=n\fR, or \fB\-closing\-side\-comment\-interval=n\fR" 4
1006 .IX Item "-csci=n, or -closing-side-comment-interval=n"
1007 where \f(CW\*(C`n\*(C'\fR is the minimum number of lines that a block must have in
1008 order for a closing side comment to be added.  The default value is
1009 \&\f(CW\*(C`n=6\*(C'\fR.  To illustrate:
1010 .Sp
1011 .Vb 9
1012 \&        # perltidy -csci=2 -csc
1013 \&        sub message {
1014 \&            if ( !defined( $_[0] ) ) {
1015 \&                print("Hello, World\en");
1016 \&            } ## end if ( !defined( $_[0] ))
1017 \&            else {
1018 \&                print( $_[0], "\en" );
1019 \&            } ## end else [ if ( !defined( $_[0] ))
1020 \&        } ## end sub message
1021 .Ve
1022 Now the \f(CW\*(C`if\*(C'\fR and \f(CW\*(C`else\*(C'\fR blocks are commented.  However, now this has
1023 become very cluttered.
1024 .IP "\fB\-cscp=string\fR, or \fB\-closing\-side\-comment\-prefix=string\fR" 4
1025 .IX Item "-cscp=string, or -closing-side-comment-prefix=string"
1026 where string is the prefix used before the name of the block type.  The
1027 default prefix, shown above, is \f(CW\*(C`## end\*(C'\fR.  This string will be added to
1028 closing side comments, and it will also be used to recognize them in
1029 order to update, delete, and format them.  Any comment identified as a
1030 closing side comment will be placed just a single space to the right of
1031 its closing brace.
1032 .IP "\fB\-cscl=string\fR, or \fB\-closing\-side\-comment\-list\-string\fR" 4
1033 .IX Item "-cscl=string, or -closing-side-comment-list-string"
1034 where \f(CW\*(C`string\*(C'\fR is a list of block types to be tagged with closing side
1035 comments.  By default, all code block types preceded by a keyword or
1036 label (such as \f(CW\*(C`if\*(C'\fR, \f(CW\*(C`sub\*(C'\fR, and so on) will be tagged.  The \fB\-cscl\fR
1037 command changes the default list to be any selected block types; see
1038 \&\*(L"Specifying Block Types\*(R".
1039 For example, the following command
1040 requests that only \f(CW\*(C`sub\*(C'\fR's, labels, \f(CW\*(C`BEGIN\*(C'\fR, and \f(CW\*(C`END\*(C'\fR blocks be
1041 affected by any \fB\-csc\fR or \fB\-dcsc\fR operation:
1042 .Sp
1043 .Vb 1
1044 \&   -cscl="sub : BEGIN END"
1045 .Ve
1046 .IP "\fB\-csct=n\fR, or \fB\-closing\-side\-comment\-maximum\-text=n\fR" 4
1047 .IX Item "-csct=n, or -closing-side-comment-maximum-text=n"
1048 The text appended to certain block types, such as an \f(CW\*(C`if\*(C'\fR block, is
1049 whatever lies between the keyword introducing the block, such as \f(CW\*(C`if\*(C'\fR,
1050 and the opening brace.  Since this might be too much text for a side
1051 comment, there needs to be a limit, and that is the purpose of this
1052 parameter.  The default value is \f(CW\*(C`n=20\*(C'\fR, meaning that no additional
1053 tokens will be appended to this text after its length reaches 20
1054 characters.  Omitted text is indicated with \f(CW...\fR.  (Tokens, including
1055 sub names, are never truncated, however, so actual lengths may exceed
1056 this).  To illustrate, in the above example, the appended text of the
1057 first block is \f(CW\*(C` ( !defined( $_[0] )...\*(C'\fR.  The existing limit of
1058 \&\f(CW\*(C`n=20\*(C'\fR caused this text to be truncated, as indicated by the \f(CW...\fR.
1059 .IP "\fB\-csce=n\fR, or \fB\-closing\-side\-comment\-else\-flag=n\fR" 4
1060 .IX Item "-csce=n, or -closing-side-comment-else-flag=n"
1061 The default, \fBn=0\fR, places the text of the opening \f(CW\*(C`if\*(C'\fR statement after any
1062 terminal \f(CW\*(C`else\*(C'\fR.
1063 .Sp
1064 If \fBn=2\fR is used, then each \f(CW\*(C`elsif\*(C'\fR is also given the text of the opening
1065 \&\f(CW\*(C`if\*(C'\fR statement.  Also, an \f(CW\*(C`else\*(C'\fR will include the text of a preceding
1066 \&\f(CW\*(C`elsif\*(C'\fR statement.  Note that this may result some long closing
1067 side comments.
1068 .Sp
1069 If \fBn=1\fR is used, the results will be the same as \fBn=2\fR whenever the
1070 resulting line length is less than the maximum allowed.
1071 .IP "\fB\-cscw\fR, or \fB\-closing\-side\-comment\-warnings\fR" 4
1072 .IX Item "-cscw, or -closing-side-comment-warnings"
1073 This parameter is intended to help make the initial transition to the use of
1074 closing side comments.  
1075 It causes two
1076 things to happen if a closing side comment replaces an existing, different
1077 closing side comment:  first, an error message will be issued, and second, the
1078 original side comment will be placed alone on a new specially marked comment
1079 line for later attention. 
1080 .Sp
1081 The intent is to avoid clobbering existing hand-written side comments
1082 which happen to match the pattern of closing side comments. This flag
1083 should only be needed on the first run with \fB\-csc\fR.
1084 .RE
1085 .RS 4
1086 .Sp
1087 \&\fBImportant Notes on Closing Side Comments:\fR 
1088 .IP "\(bu" 4
1089 Closing side comments are only placed on lines terminated with a closing
1090 brace.  Certain closing styles, such as the use of cuddled elses
1091 (\fB\-ce\fR), preclude the generation of some closing side comments.
1092 .IP "\(bu" 4
1093 Please note that adding or deleting of closing side comments takes
1094 place only through the commands \fB\-csc\fR or \fB\-dcsc\fR.  The other commands,
1095 if used, merely modify the behavior of these two commands.  
1096 .IP "\(bu" 4
1097 It is recommended that the \fB\-cscw\fR flag be used along with \fB\-csc\fR on
1098 the first use of perltidy on a given file.  This will prevent loss of
1099 any existing side comment data which happens to have the csc prefix.
1100 .IP "\(bu" 4
1101 Once you use \fB\-csc\fR, you should continue to use it so that any
1102 closing side comments remain correct as code changes.  Otherwise, these
1103 comments will become incorrect as the code is updated.
1104 .IP "\(bu" 4
1105 If you edit the closing side comments generated by perltidy, you must also
1106 change the prefix to be different from the closing side comment prefix.
1107 Otherwise, your edits will be lost when you rerun perltidy with \fB\-csc\fR.   For
1108 example, you could simply change \f(CW\*(C`## end\*(C'\fR to be \f(CW\*(C`## End\*(C'\fR, since the test is
1109 case sensitive.  You may also want to use the \fB\-ssc\fR flag to keep these
1110 modified closing side comments spaced the same as actual closing side comments.
1111 .IP "\(bu" 4
1112 Temporarily generating closing side comments is a useful technique for
1113 exploring and/or debugging a perl script, especially one written by someone
1114 else.  You can always remove them with \fB\-dcsc\fR.
1115 .RE
1116 .RS 4
1117 .RE
1118 .IP "Static Block Comments" 4
1119 .IX Item "Static Block Comments"
1120 Static block comments are block comments with a special leading pattern,
1121 \&\f(CW\*(C`##\*(C'\fR by default, which will be treated slightly differently from other
1122 block comments.  They effectively behave as if they had glue along their
1123 left and top edges, because they stick to the left edge and previous line
1124 when there is no blank spaces in those places.  This option is
1125 particularly useful for controlling how commented code is displayed.
1126 .RS 4
1127 .IP "\fB\-sbc\fR, \fB\-\-static\-block\-comments\fR" 4
1128 .IX Item "-sbc, --static-block-comments"
1129 When \fB\-sbc\fR is used, a block comment with a special leading pattern, \f(CW\*(C`##\*(C'\fR by
1130 default, will be treated specially. 
1131 .Sp
1132 Comments so identified  are treated as follows: 
1133 .RS 4
1134 .IP "\(bu" 4
1135 If there is no leading space on the line, then the comment will not
1136 be indented, and otherwise it may be,
1137 .IP "\(bu" 4
1138 no new blank line will be
1139 inserted before such a comment, and 
1140 .IP "\(bu" 4
1141 such a comment will never become
1142 a hanging side comment.  
1143 .RE
1144 .RS 4
1145 .Sp
1146 For example, assuming \f(CW@month_of_year\fR is
1147 left\-adjusted:
1148 .Sp
1149 .Vb 4
1150 \&    @month_of_year = (    # -sbc (default)
1151 \&        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
1152 \&    ##  'Dec', 'Nov'
1153 \&        'Nov', 'Dec');
1154 .Ve
1155 Without this convention, the above code would become
1156 .Sp
1157 .Vb 2
1158 \&    @month_of_year = (   # -nsbc
1159 \&        'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
1160 .Ve
1161 .Vb 3
1162 \&        ##  'Dec', 'Nov'
1163 \&        'Nov', 'Dec'
1164 \&    );
1165 .Ve
1166 which is not as clear.
1167 The default is to use \fB\-sbc\fR.  This may be deactivated with \fB\-nsbc\fR.
1168 .RE
1169 .IP "\fB\-sbcp=string\fR, \fB\-\-static\-block\-comment\-prefix=string\fR" 4
1170 .IX Item "-sbcp=string, --static-block-comment-prefix=string"
1171 This parameter defines the prefix used to identify static block comments
1172 when the \fB\-sbc\fR parameter is set.  The default prefix is \f(CW\*(C`##\*(C'\fR,
1173 corresponding to \f(CW\*(C`\-sbcp=##\*(C'\fR.  The first character must be a \f(CW\*(C`#\*(C'\fR
1174 symbol, since this must only match comments.  As a simple example, to
1175 identify all comments as static block comments, one would use \f(CW\*(C`\-sbcp=#\*(C'\fR.
1176 .Sp
1177 Please note that \fB\-sbcp\fR merely defines the pattern used to identify static
1178 block comments; it will not be used unless the switch \fB\-sbc\fR is set.  Also,
1179 please be aware that this string is used in a perl regular expression which
1180 identifies these comments, so it must enable a valid regular expression to be
1181 formed.
1182 .IP "\fB\-osbc\fR, \fB\-\-outdent\-static\-block\-comments\fR" 4
1183 .IX Item "-osbc, --outdent-static-block-comments"
1184 The command \fB\-osbc\fR will will cause static block comments to be outdented by 2
1185 spaces (or whatever \fB\-ci=n\fR has been set to), if possible.
1186 .RE
1187 .RS 4
1188 .RE
1189 .IP "Static Side Comments" 4
1190 .IX Item "Static Side Comments"
1191 Static side comments are side comments with a special leading pattern.
1192 This option can be useful for controlling how commented code is displayed
1193 when it is a side comment.
1194 .RS 4
1195 .IP "\fB\-ssc\fR, \fB\-\-static\-side\-comments\fR" 4
1196 .IX Item "-ssc, --static-side-comments"
1197 When \fB\-ssc\fR is used, a side comment with a static leading pattern, which is
1198 \&\f(CW\*(C`##\*(C'\fR by default, will be be spaced only a single space from previous
1199 character, and it will not be vertically aligned with other side comments.
1200 .Sp
1201 The default is \fB\-nssc\fR.
1202 .IP "\fB\-sscp=string\fR, \fB\-\-static\-side\-comment\-prefix=string\fR" 4
1203 .IX Item "-sscp=string, --static-side-comment-prefix=string"
1204 This parameter defines the prefix used to identify static side comments
1205 when the \fB\-ssc\fR parameter is set.  The default prefix is \f(CW\*(C`##\*(C'\fR,
1206 corresponding to \f(CW\*(C`\-sscp=##\*(C'\fR.  
1207 .Sp
1208 Please note that \fB\-sscp\fR merely defines the pattern used to identify
1209 static side comments; it will not be used unless the switch \fB\-ssc\fR is
1210 set.  Also, note that this string is used in a perl regular expression
1211 which identifies these comments, so it must enable a valid regular
1212 expression to be formed.
1213 .RE
1214 .RS 4
1215 .RE
1216 .Sh "Line Break Control"
1217 .IX Subsection "Line Break Control"
1218 .IP "\fB\-fnl\fR,  \fB\-\-freeze\-newlines\fR" 4
1219 .IX Item "-fnl,  --freeze-newlines"
1220 If you do not want any changes to the line breaks in your script, set
1221 \&\fB\-fnl\fR, and they will remain fixed, and the rest of the commands in
1222 this section and sections 
1223 \&\*(L"Controlling List Formatting\*(R",
1224 \&\*(L"Retaining or Ignoring Existing Line Breaks\*(R", and
1225 \&\*(L"Blank Line Control\*(R" will be ignored.  You may want to use \fB\-noll\fR
1226 with this.
1227 .IP "\fB\-ce\fR,   \fB\-\-cuddled\-else\fR" 4
1228 .IX Item "-ce,   --cuddled-else"
1229 Enable the \*(L"cuddled else\*(R" style, in which \f(CW\*(C`else\*(C'\fR and \f(CW\*(C`elsif\*(C'\fR are
1230 follow immediately after the curly brace closing the previous block.
1231 The default is not to use cuddled elses, and is indicated with the flag
1232 \&\fB\-nce\fR or \fB\-\-nocuddled\-else\fR.  Here is a comparison of the
1233 alternatives:
1234 .Sp
1235 .Vb 5
1236 \&  if ($task) {
1237 \&      yyy();
1238 \&  } else {    # -ce
1239 \&      zzz();
1240 \&  }
1241 .Ve
1242 .Vb 6
1243 \&  if ($task) {
1244 \&        yyy();
1245 \&  }
1246 \&  else {    # -nce  (default)
1247 \&        zzz();
1248 \&  }
1249 .Ve
1250 .IP "\fB\-bl\fR,    \fB\-\-opening\-brace\-on\-new\-line\fR" 4
1251 .IX Item "-bl,    --opening-brace-on-new-line"
1252 Use the flag \fB\-bl\fR to place the opening brace on a new line:
1253 .Sp
1254 .Vb 4
1255 \&  if ( $input_file eq '-' )    # -bl 
1256 \&  {                          
1257 \&      important_function();
1258 \&  }
1259 .Ve
1260 This flag applies to all structural blocks, including sub's (unless
1261 the \fB\-sbl\fR flag is set \*(-- see next item).
1262 .Sp
1263 The default style, \fB\-nbl\fR, places an opening brace on the same line as
1264 the keyword introducing it.  For example,
1265 .Sp
1266 .Vb 1
1267 \&  if ( $input_file eq '-' ) {   # -nbl (default)
1268 .Ve
1269 .IP "\fB\-sbl\fR,    \fB\-\-opening\-sub\-brace\-on\-new\-line\fR" 4
1270 .IX Item "-sbl,    --opening-sub-brace-on-new-line"
1271 The flag \fB\-sbl\fR can be used to override the value of \fB\-bl\fR for
1272 opening sub braces.  For example, 
1273 .Sp
1274 .Vb 1
1275 \& perltidy -sbl
1276 .Ve
1277 produces this result:
1278 .Sp
1279 .Vb 9
1280 \& sub message
1281 \& {
1282 \&    if (!defined($_[0])) {
1283 \&        print("Hello, World\en");
1284 \&    }
1285 \&    else {
1286 \&        print($_[0], "\en");
1287 \&    }
1288 \& }
1289 .Ve
1290 This flag is negated with \fB\-nsbl\fR.  If \fB\-sbl\fR is not specified,
1291 the value of \fB\-bl\fR is used.
1292 .IP "\fB\-bli\fR,    \fB\-\-brace\-left\-and\-indent\fR" 4
1293 .IX Item "-bli,    --brace-left-and-indent"
1294 The flag \fB\-bli\fR is the same as \fB\-bl\fR but in addition it causes one 
1295 unit of continuation indentation ( see \fB\-ci\fR ) to be placed before 
1296 an opening and closing block braces.
1297 .Sp
1298 For example,
1299 .Sp
1300 .Vb 4
1301 \&        if ( $input_file eq '-' )    # -bli
1302 \&          {
1303 \&            important_function();
1304 \&          }
1305 .Ve
1306 By default, this extra indentation occurs for blocks of type:
1307 \&\fBif\fR, \fBelsif\fR, \fBelse\fR, \fBunless\fR, \fBfor\fR, \fBforeach\fR, \fBsub\fR, 
1308 \&\fBwhile\fR, \fBuntil\fR, and also with a preceding label.  The next item
1309 shows how to change this.
1310 .IP "\fB\-blil=s\fR,    \fB\-\-brace\-left\-and\-indent\-list=s\fR" 4
1311 .IX Item "-blil=s,    --brace-left-and-indent-list=s"
1312 Use this parameter to change the types of block braces for which the
1313 \&\fB\-bli\fR flag applies; see \*(L"Specifying Block Types\*(R".  For example,
1314 \&\fB\-blil='if elsif else'\fR would apply it to only \f(CW\*(C`if/elsif/else\*(C'\fR blocks.
1315 .IP "\fB\-bar\fR,    \fB\-\-opening\-brace\-always\-on\-right\fR" 4
1316 .IX Item "-bar,    --opening-brace-always-on-right"
1317 The default style, \fB\-nbl\fR places the opening brace on a new
1318 line if it does not fit on the same line as the opening keyword, like
1319 this:
1320 .Sp
1321 .Vb 5
1322 \&        if ( $bigwasteofspace1 && $bigwasteofspace2
1323 \&          || $bigwasteofspace3 && $bigwasteofspace4 )
1324 \&        {
1325 \&            big_waste_of_time();
1326 \&        }
1327 .Ve
1328 To force the opening brace to always be on the right, use the \fB\-bar\fR
1329 flag.  In this case, the above example becomes
1330 .Sp
1331 .Vb 4
1332 \&        if ( $bigwasteofspace1 && $bigwasteofspace2
1333 \&          || $bigwasteofspace3 && $bigwasteofspace4 ) {
1334 \&            big_waste_of_time();
1335 \&        }
1336 .Ve
1337 A conflict occurs if both \fB\-bl\fR and \fB\-bar\fR are specified.
1338 .IP "Vertical tightness of non-block curly braces, parentheses, and square brackets." 4
1339 .IX Item "Vertical tightness of non-block curly braces, parentheses, and square brackets."
1340 These parameters control what shall be called vertical tightness.  Here are the
1341 main points:
1342 .RS 4
1343 .IP "\(bu" 4
1344 Opening tokens (except for block braces) are controlled by \fB\-vt=n\fR, or
1345 \&\fB\-\-vertical\-tightness=n\fR, where
1346 .Sp
1347 .Vb 4
1348 \& -vt=0 always break a line after opening token (default). 
1349 \& -vt=1 do not break unless this would produce more than one 
1350 \&         step in indentation in a line.
1351 \& -vt=2 never break a line after opening token
1352 .Ve
1353 .IP "\(bu" 4
1354 You must also use the \fB\-lp\fR flag when you use the \fB\-vt\fR flag; the
1355 reason is explained below.
1356 .IP "\(bu" 4
1357 Closing tokens (except for block braces) are controlled by \fB\-vtc=n\fR, or
1358 \&\fB\-\-vertical\-tightness\-closing=n\fR, where
1359 .Sp
1360 .Vb 5
1361 \& -vtc=0 always break a line before a closing token (default), 
1362 \& -vtc=1 do not break before a closing token which is followed 
1363 \&        by a semicolon or another closing token, and is not in 
1364 \&        a list environment.
1365 \& -vtc=2 never break before a closing token.
1366 .Ve
1367 The rules for \fB\-vtc=1\fR are designed to maintain a reasonable balance
1368 between tightness and readability in complex lists.
1369 .IP "\(bu" 4
1370 Different controls may be applied to to different token types,
1371 and it is also possible to control block braces; see below.
1372 .IP "\(bu" 4
1373 Finally, please note that these vertical tightness flags are merely
1374 hints to the formatter, and it cannot always follow them.  Things which
1375 make it difficult or impossible include comments, blank lines, blocks of
1376 code within a list, and possibly the lack of the \fB\-lp\fR parameter.
1377 Also, these flags may be ignored for very small lists (2 or 3 lines in
1378 length).
1379 .RE
1380 .RS 4
1381 .Sp
1382 Here are some examples: 
1383 .Sp
1384 .Vb 7
1385 \&    # perltidy -lp -vt=0 -vtc=0
1386 \&    %romanNumerals = (
1387 \&                       one   => 'I',
1388 \&                       two   => 'II',
1389 \&                       three => 'III',
1390 \&                       four  => 'IV',
1391 \&    );
1392 .Ve
1393 .Vb 6
1394 \&    # perltidy -lp -vt=1 -vtc=0
1395 \&    %romanNumerals = ( one   => 'I',
1396 \&                       two   => 'II',
1397 \&                       three => 'III',
1398 \&                       four  => 'IV',
1399 \&    );
1400 .Ve
1401 .Vb 5
1402 \&    # perltidy -lp -vt=1 -vtc=1
1403 \&    %romanNumerals = ( one   => 'I',
1404 \&                       two   => 'II',
1405 \&                       three => 'III',
1406 \&                       four  => 'IV', );
1407 .Ve
1408 The difference between \fB\-vt=1\fR and \fB\-vt=2\fR is shown here:
1409 .Sp
1410 .Vb 6
1411 \&    # perltidy -lp -vt=1 
1412 \&    $init->add(
1413 \&                mysprintf( "(void)find_threadsv(%s);",
1414 \&                           cstring( $threadsv_names[ $op->targ ] )
1415 \&                )
1416 \&    );
1417 .Ve
1418 .Vb 5
1419 \&    # perltidy -lp -vt=2 
1420 \&    $init->add( mysprintf( "(void)find_threadsv(%s);",
1421 \&                           cstring( $threadsv_names[ $op->targ ] )
1422 \&                )
1423 \&    );
1424 .Ve
1425 With \fB\-vt=1\fR, the line ending in \f(CW\*(C`add(\*(C'\fR does not combine with the next
1426 line because the next line is not balanced.  This can help with
1427 readability, but \fB\-vt=2\fR can be used to ignore this rule.
1428 .Sp
1429 The tightest, and least readable, code is produced with both \f(CW\*(C`\-vt=2\*(C'\fR and
1430 \&\f(CW\*(C`\-vtc=2\*(C'\fR:
1431 .Sp
1432 .Vb 3
1433 \&    # perltidy -lp -vt=2 -vtc=2
1434 \&    $init->add( mysprintf( "(void)find_threadsv(%s);",
1435 \&                           cstring( $threadsv_names[ $op->targ ] ) ) );
1436 .Ve
1437 Notice how the code in all of these examples collapses vertically as
1438 \&\fB\-vt\fR increases, but the indentation remains unchanged.  This is
1439 because perltidy implements the \fB\-vt\fR parameter by first formatting as
1440 if \fB\-vt=0\fR, and then simply overwriting one output line on top of the
1441 next, if possible, to achieve the desired vertical tightness.  The
1442 \&\fB\-lp\fR indentation style has been designed to allow this vertical
1443 collapse to occur, which is why it is required for the \fB\-vt\fR parameter.
1444 .Sp
1445 The \fB\-vt=n\fR and \fB\-vtc=n\fR parameters apply to each type of container
1446 token.  If desired, vertical tightness controls can be applied
1447 independently to each of the closing container token types.
1448 .Sp
1449 The parameters for controlling parentheses are \fB\-pvt=n\fR or
1450 \&\fB\-\-paren\-vertical\-tightness=n\fR, and \fB\-pcvt=n\fR or
1451 \&\fB\-\-paren\-vertical\-tightness\-closing=n\fR.
1452 .Sp
1453 Likewise, the parameters for square brackets are \fB\-sbvt=n\fR or
1454 \&\fB\-\-square\-bracket\-vertical\-tightness=n\fR, and \fB\-sbcvt=n\fR or
1455 \&\fB\-\-square\-bracket\-vertical\-tightness\-closing=n\fR.
1456 .Sp
1457 Finally, the parameters for controlling non-code block braces are
1458 \&\fB\-bvt=n\fR or \fB\-\-brace\-vertical\-tightness=n\fR, and \fB\-bcvt=n\fR or
1459 \&\fB\-\-brace\-vertical\-tightness\-closing=n\fR.
1460 .Sp
1461 In fact, the parameter \fB\-vt=n\fR is actually just an abbreviation for
1462 \&\fB\-pvt=n \-bvt=n sbvt=n\fR, and likewise \fB\-vtc=n\fR is an abbreviation
1463 for \fB\-pvtc=n \-bvtc=n sbvtc=n\fR.
1464 .RE
1465 .IP "\fB\-bbvt=n\fR or \fB\-\-block\-brace\-vertical\-tightness=n\fR" 4
1466 .IX Item "-bbvt=n or --block-brace-vertical-tightness=n"
1467 The \fB\-bbvt=n\fR flag is just like the \fB\-vt=n\fR flag but applies
1468 to opening code block braces.
1469 .Sp
1470 .Vb 4
1471 \& -bbvt=0 break after opening block brace (default). 
1472 \& -bbvt=1 do not break unless this would produce more than one 
1473 \&         step in indentation in a line.
1474 \& -bbvt=2 do not break after opening block brace.
1475 .Ve
1476 It is necessary to also use either \fB\-bl\fR or \fB\-bli\fR for this to work,
1477 because, as with other vertical tightness controls, it is implemented by
1478 simply overwriting a line ending with an opening block brace with the
1479 subsequent line.  For example:
1480 .Sp
1481 .Vb 10
1482 \&    # perltidy -bli -bbvt=0
1483 \&    if ( open( FILE, "< $File" ) )
1484 \&      {
1485 \&        while ( $File = <FILE> )
1486 \&          {
1487 \&            $In .= $File;
1488 \&            $count++;
1489 \&          }
1490 \&        close(FILE);
1491 \&      }
1492 .Ve
1493 .Vb 8
1494 \&    # perltidy -bli -bbvt=1
1495 \&    if ( open( FILE, "< $File" ) )
1496 \&      { while ( $File = <FILE> )
1497 \&          { $In .= $File;
1498 \&            $count++;
1499 \&          }
1500 \&        close(FILE);
1501 \&      }
1502 .Ve
1503 By default this applies to blocks associated with keywords \fBif\fR,
1504 \&\fBelsif\fR, \fBelse\fR, \fBunless\fR, \fBfor\fR, \fBforeach\fR, \fBsub\fR, \fBwhile\fR,
1505 \&\fBuntil\fR, and also with a preceding label.  This can be changed with
1506 the parameter \fB\-bbvtl=string\fR, or
1507 \&\fB\-\-block\-brace\-vertical\-tightness\-list=string\fR, where \fBstring\fR is a
1508 space-separated list of block types.  For more information on the
1509 possible values of this string, see \*(L"Specifying Block Types\*(R"
1510 .Sp
1511 For example, if we want to just apply this style to \f(CW\*(C`if\*(C'\fR,
1512 \&\f(CW\*(C`elsif\*(C'\fR, and \f(CW\*(C`else\*(C'\fR blocks, we could use 
1513 \&\f(CW\*(C`perltidy \-bli \-bbvt \-bbvtl='if elsif else'\*(C'\fR.
1514 .Sp
1515 There is no vertical tightness control for closing block braces; with
1516 the exception of one-line blocks, they will normally remain on a 
1517 separate line.
1518 .IP "\fB\-dnl\fR,  \fB\-\-delete\-old\-newlines\fR" 4
1519 .IX Item "-dnl,  --delete-old-newlines"
1520 By default, perltidy first deletes all old line break locations, and then it
1521 looks for good break points to match the desired line length.  Use \fB\-ndnl\fR
1522 or  \fB\-\-nodelete\-old\-newlines\fR to force perltidy to retain all old line break
1523 points.  
1524 .IP "\fB\-anl\fR,  \fB\-\-add\-newlines\fR" 4
1525 .IX Item "-anl,  --add-newlines"
1526 By default, perltidy will add line breaks when necessary to create
1527 continuations of long lines and to improve the script appearance.  Use
1528 \&\fB\-nanl\fR or \fB\-noadd\-newlines\fR to prevent any new line breaks.  
1529 .Sp
1530 This flag does not prevent perltidy from eliminating existing line
1531 breaks; see \fB\-freeze\-newlines\fR to completely prevent changes to line
1532 break points.
1533 .IP "Controlling whether perltidy breaks before or after operators" 4
1534 .IX Item "Controlling whether perltidy breaks before or after operators"
1535 Two command line parameters provide some control over whether
1536 a line break should be before or after specific token types.
1537 .Sp
1538 \&\fB\-wba=s\fR or \fB\-\-want\-break\-after=s\fR, and
1539 .Sp
1540 \&\fB\-wbb=s\fR or \fB\-\-want\-break\-before=s\fR.
1541 .Sp
1542 These parameters are each followed by a quoted string, \fBs\fR, containing
1543 a list of token types (separated only by spaces).  No more than one of each
1544 of these parameters should be specified, because repeating a
1545 command-line parameter always overwrites the previous one before
1546 perltidy ever sees it.
1547 .Sp
1548 By default, perltidy breaks \fBafter\fR these token types:
1549   % + \- * / x != == >= <= =~ !~ < >  | & >= <
1550   = **= += *= &= <<= &&= \-= /= |= >>= ||= .= %= ^= x=
1551 .Sp
1552 And perltidy breaks \fBbefore\fR these token types by default:
1553   . << >> \-> && ||
1554 .Sp
1555 To illustrate, to cause a break after a concatenation operator, \f(CW'.'\fR,
1556 rather than before it, the command line would be
1557 .Sp
1558 .Vb 1
1559 \&  -wba="."
1560 .Ve
1561 As another example, the following command would cause a break before 
1562 math operators \f(CW'+'\fR, \f(CW'\-'\fR, \f(CW'/'\fR, and \f(CW'*'\fR:
1563 .Sp
1564 .Vb 1
1565 \&  -wbb="+ - / *"
1566 .Ve
1567 These commands should work well for most of the token types that
1568 perltidy uses (use \fB\-\-dump\-token\-types\fR for a list).  However, for a
1569 few token types there may be conflicts with hardwired logic which cause
1570 unexpected results.  One example is curly braces, which should be
1571 controlled with the parameter \fBbl\fR provided for that purpose.
1572 .Sh "Controlling List Formatting"
1573 .IX Subsection "Controlling List Formatting"
1574 Perltidy attempts to place comma-separated arrays of values in tables
1575 which look good.  Its default algorithms usually work well, and they
1576 have been improving with each release, but several parameters are
1577 available to control list formatting.
1578 .IP "\fB\-boc\fR,  \fB\-\-break\-at\-old\-comma\-breakpoints\fR" 4
1579 .IX Item "-boc,  --break-at-old-comma-breakpoints"
1580 This flag tells perltidy to try to break at all old commas.  This is not
1581 the default.  Normally, perltidy makes a best guess at list formatting,
1582 and seldom uses old comma breakpoints.  Usually this works well,
1583 but consider:
1584 .Sp
1585 .Vb 5
1586 \&    my @list = (1,
1587 \&                1, 1,
1588 \&                1, 2, 1,
1589 \&                1, 3, 3, 1,
1590 \&                1, 4, 6, 4, 1,);
1591 .Ve
1592 The default formatting will flatten this down to one line:
1593 .Sp
1594 .Vb 2
1595 \&    # perltidy (default)
1596 \&    my @list = ( 1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 4, 6, 4, 1, );
1597 .Ve
1598 which hides the structure. Using \fB\-boc\fR, plus additional flags
1599 to retain the original style, yields
1600 .Sp
1601 .Vb 6
1602 \&    # perltidy -boc -lp -pt=2 -vt=1 -vtc=1
1603 \&    my @list = (1,
1604 \&                1, 1,
1605 \&                1, 2, 1,
1606 \&                1, 3, 3, 1,
1607 \&                1, 4, 6, 4, 1,);
1608 .Ve
1609 A disadvantage of this flag is that all tables in the file
1610 must already be nicely formatted.
1611 .IP "\fB\-mft=n\fR,  \fB\-\-maximum\-fields\-per\-table=n\fR" 4
1612 .IX Item "-mft=n,  --maximum-fields-per-table=n"
1613 If the computed number of fields for any table exceeds \fBn\fR, then it
1614 will be reduced to \fBn\fR.  The default value for \fBn\fR is a large number,
1615 40.  While this value should probably be left unchanged as a general
1616 rule, it might be used on a small section of code to force a list to
1617 have a particular number of fields per line, and then either the \fB\-boc\fR
1618 flag could be used to retain this formatting, or a single comment could
1619 be introduced somewhere to freeze the formatting in future applications
1620 of perltidy.
1621 .Sp
1622 .Vb 9
1623 \&    # perltidy -mft=2
1624 \&    @month_of_year = (    
1625 \&        'Jan', 'Feb',
1626 \&        'Mar', 'Apr',
1627 \&        'May', 'Jun',
1628 \&        'Jul', 'Aug',
1629 \&        'Sep', 'Oct',
1630 \&        'Nov', 'Dec'
1631 \&    );
1632 .Ve
1633 .IP "\fB\-cab=n\fR,  \fB\-\-comma\-arrow\-breakpoints=n\fR" 4
1634 .IX Item "-cab=n,  --comma-arrow-breakpoints=n"
1635 A comma which follows a comma arrow, '=>', requires special
1636 consideration.  In a long list, it is common to break at all such
1637 commas.  This parameter can be used to control how perltidy breaks at
1638 these commas.  (However, it will have no effect if old comma breaks are
1639 being forced because \fB\-boc\fR is used).  The possible values of \fBn\fR are:
1640 .Sp
1641 .Vb 6
1642 \& n=0 break at all commas after =>  
1643 \& n=1 stable: break at all commas after => unless this would break
1644 \&     an existing one-line container (default)
1645 \& n=2 break at all commas after =>, but try to form the maximum
1646 \&     maximum one-line container lengths
1647 \& n=3 do not treat commas after => specially at all
1648 .Ve
1649 For example, given the following single line, perltidy by default will
1650 not add any line breaks because it would break the existing one-line
1651 container:
1652 .Sp
1653 .Vb 1
1654 \&    bless { B => $B, Root => $Root } => $package;
1655 .Ve
1656 Using \fB\-cab=0\fR will force a break after each comma-arrow item:
1657 .Sp
1658 .Vb 5
1659 \&    # perltidy -cab=0:
1660 \&    bless {
1661 \&        B    => $B,
1662 \&        Root => $Root
1663 \&    } => $package;
1664 .Ve
1665 If perltidy is subsequently run with this container broken, then by
1666 default it will break after each '=>' because the container is now
1667 broken.  To reform a one-line container, the parameter \fB\-cab=2\fR would
1668 be needed.
1669 .Sp
1670 The flag \fB\-cab=3\fR can be used to prevent these commas from being
1671 treated specially.  In this case, an item such as \*(L"01\*(R" => 31 is
1672 treated as a single item in a table.  The number of fields in this table
1673 will be determined by the same rules that are used for any other table.
1674 Here is an example.
1675 .Sp
1676 .Vb 6
1677 \&    # perltidy -cab=3
1678 \&    my %last_day = (
1679 \&        "01" => 31, "02" => 29, "03" => 31, "04" => 30,
1680 \&        "05" => 31, "06" => 30, "07" => 31, "08" => 31,
1681 \&        "09" => 30, "10" => 31, "11" => 30, "12" => 31
1682 \&    );
1683 .Ve
1684 .Sh "Retaining or Ignoring Existing Line Breaks"
1685 .IX Subsection "Retaining or Ignoring Existing Line Breaks"
1686 Several additional parameters are available for controlling the extent
1687 to which line breaks in the input script influence the output script.
1688 In most cases, the default parameter values are set so that, if a choice
1689 is possible, the output style follows the input style.  For example, if
1690 a short logical container is broken in the input script, then the
1691 default behavior is for it to remain broken in the output script.
1692 .PP
1693 Most of the parameters in this section would only be required for a
1694 one-time conversion of a script from short container lengths to longer
1695 container lengths.  The opposite effect, of converting long container
1696 lengths to shorter lengths, can be obtained by temporarily using a short
1697 maximum line length.
1698 .IP "\fB\-bol\fR,  \fB\-\-break\-at\-old\-logical\-breakpoints\fR" 4
1699 .IX Item "-bol,  --break-at-old-logical-breakpoints"
1700 By default, if a logical expression is broken at a \f(CW\*(C`&&\*(C'\fR, \f(CW\*(C`||\*(C'\fR, \f(CW\*(C`and\*(C'\fR,
1701 or \f(CW\*(C`or\*(C'\fR, then the container will remain broken.  Also, breaks
1702 at internal keywords \f(CW\*(C`if\*(C'\fR and \f(CW\*(C`unless\*(C'\fR will normally be retained.
1703 To prevent this, and thus form longer lines, use \fB\-nbol\fR.
1704 .IP "\fB\-bok\fR,  \fB\-\-break\-at\-old\-keyword\-breakpoints\fR" 4
1705 .IX Item "-bok,  --break-at-old-keyword-breakpoints"
1706 By default, perltidy will retain a breakpoint before keywords which may
1707 return lists, such as \f(CW\*(C`sort\*(C'\fR and <map>.  This allows chains of these
1708 operators to be displayed one per line.  Use \fB\-nbok\fR to prevent
1709 retaining these breakpoints.
1710 .IP "\fB\-bot\fR,  \fB\-\-break\-at\-old\-trinary\-breakpoints\fR" 4
1711 .IX Item "-bot,  --break-at-old-trinary-breakpoints"
1712 By default, if a conditional (trinary) operator is broken at a \f(CW\*(C`:\*(C'\fR,
1713 then it will remain broken.  To prevent this, and thereby
1714 form longer lines, use \fB\-nbot\fR.
1715 .IP "\fB\-iob\fR,  \fB\-\-ignore\-old\-breakpoints\fR" 4
1716 .IX Item "-iob,  --ignore-old-breakpoints"
1717 Use this flag to tell perltidy to ignore existing line breaks to the
1718 maximum extent possible.  This will tend to produce the longest possible
1719 containers, regardless of type, which do not exceed the line length
1720 limit.
1721 .Sh "Blank Line Control"
1722 .IX Subsection "Blank Line Control"
1723 Blank lines can improve the readability of a script if they are carefully
1724 placed.  Perltidy has several commands for controlling the insertion,
1725 retention, and removal of blank lines.
1726 .IP "\fB\-bbc\fR,  \fB\-\-blanks\-before\-comments\fR" 4
1727 .IX Item "-bbc,  --blanks-before-comments"
1728 A blank line will be introduced before a full-line comment.  This is the
1729 default.  Use \fB\-nbbc\fR or  \fB\-\-noblanks\-before\-comments\fR to prevent
1730 such blank lines from being introduced.
1731 .IP "\fB\-bbs\fR,  \fB\-\-blanks\-before\-subs\fR" 4
1732 .IX Item "-bbs,  --blanks-before-subs"
1733 A blank line will be introduced before a \fBsub\fR definition, unless it is a
1734 one-liner or preceded by a comment.  A blank line will also be introduced
1735 before a \fBpackage\fR statement and a \fB\s-1BEGIN\s0\fR and \fB\s-1END\s0\fR block.  This is the
1736 default.  The intention is to help display the structure of a program by
1737 setting off certain key sections of code.  This is negated with \fB\-nbbs\fR or
1738 \&\fB\-\-noblanks\-before\-subs\fR.  
1739 .IP "\fB\-bbb\fR,  \fB\-\-blanks\-before\-blocks\fR" 4
1740 .IX Item "-bbb,  --blanks-before-blocks"
1741 A blank line will be introduced before blocks of coding delimited by
1742 \&\fBfor\fR, \fBforeach\fR, \fBwhile\fR, \fBuntil\fR, and \fBif\fR, \fBunless\fR, in the following
1743 circumstances:
1744 .RS 4
1745 .IP "\(bu" 4
1746 The block is not preceded by a comment.
1747 .IP "\(bu" 4
1748 The block is not a one-line block.
1749 .IP "\(bu" 4
1750 The number of consecutive non-blank lines at the current indentation depth is at least \fB\-lbl\fR
1751 (see next section).
1752 .RE
1753 .RS 4
1754 .Sp
1755 This is the default.  The intention of this option is to introduce
1756 some space within dense coding.
1757 This is negated with \fB\-nbbb\fR or  \fB\-\-noblanks\-before\-blocks\fR.
1758 .RE
1759 .IP "\fB\-lbl=n\fR \fB\-\-long\-block\-line\-count=n\fR" 4
1760 .IX Item "-lbl=n --long-block-line-count=n"
1761 This controls how often perltidy is allowed to add blank lines before 
1762 certain block types (see previous section).  The default is 8.  Entering
1763 a value of \fB0\fR is equivalent to entering a very large number.
1764 .IP "\fB\-mbl=n\fR \fB\-\-maximum\-consecutive\-blank\-lines=n\fR" 4
1765 .IX Item "-mbl=n --maximum-consecutive-blank-lines=n"
1766 This parameter specifies the maximum number of consecutive blank lines
1767 in the output script.  The default is n=1.  If the input file has more
1768 than n consecutive blank lines, the number will be reduced to n.
1769 (This obviously does not apply to pod sections, here\-documents, and quotes).
1770 .IP "\fB\-sob\fR,  \fB\-\-swallow\-optional\-blank\-lines\fR" 4
1771 .IX Item "-sob,  --swallow-optional-blank-lines"
1772 All blank lines not required by the above flags, \fB\-bbb\fR, \fB\-bbs\fR, and \fB\-bbc\fR,
1773 will be deleted.  (But essential blank lines above pod documents will be
1774 retained).  This is \s-1NOT\s0 the default.
1775 .IP "\fB\-nsob\fR,  \fB\-\-noswallow\-optional\-blank\-lines\fR" 4
1776 .IX Item "-nsob,  --noswallow-optional-blank-lines"
1777 Retain blank lines, including those which do not corresponding to flags
1778 \&\fB\-bbb\fR, \fB\-bbs\fR, and \fB\-bbc\fR.  This is the default.  The number of
1779 blanks retained is subject to the limit imposed by
1780 \&\fB\-\-maximum\-consecutive\-blank\-lines\fR, however.
1781 .Sh "Styles"
1782 .IX Subsection "Styles"
1783 A style refers to a convenient collection of existing parameters.
1784 .IP "\fB\-gnu\fR, \fB\-\-gnu\-style\fR" 4
1785 .IX Item "-gnu, --gnu-style"
1786 \&\fB\-gnu\fR gives an approximation to the \s-1GNU\s0 Coding Standards (which do
1787 not apply to perl) as they are sometimes implemented.  At present, this
1788 style overrides the default style with the following parameters:
1789 .Sp
1790 .Vb 1
1791 \&    -lp -bl -noll -pt=2 -bt=2 -sbt=2 -icp
1792 .Ve
1793 .Sh "Other Controls"
1794 .IX Subsection "Other Controls"
1795 .IP "Deleting selected text" 4
1796 .IX Item "Deleting selected text"
1797 Perltidy can selectively delete comments and/or pod documentation.  The
1798 command \fB\-dac\fR or  \fB\-\-delete\-all\-comments\fR will delete all comments
1799 \&\fBand\fR all pod documentation, leaving just code and any leading system
1800 control lines.
1801 .Sp
1802 The command \fB\-dp\fR or \fB\-\-delete\-pod\fR will remove all pod documentation
1803 (but not comments).
1804 .Sp
1805 Two commands which remove comments (but not pod) are: \fB\-dbc\fR or
1806 \&\fB\-\-delete\-block\-comments\fR and \fB\-dsc\fR or  \fB\-\-delete\-side\-comments\fR.
1807 (Hanging side comments will be deleted with block comments here.)
1808 .Sp
1809 The negatives of these commands also work, and are the defaults.  When
1810 block comments are deleted, any leading 'hash\-bang' will be retained.
1811 Also, if the \fB\-x\fR flag is used, any system commands before a leading
1812 hash-bang will be retained (even if they are in the form of comments).
1813 .IP "Writing selected text to a file" 4
1814 .IX Item "Writing selected text to a file"
1815 When perltidy writes a formatted text file, it has the ability to also
1816 send selected text to a file with a \fI.TEE\fR extension.  This text can
1817 include comments and pod documentation.  
1818 .Sp
1819 The command \fB\-tac\fR or  \fB\-\-tee\-all\-comments\fR will write all comments
1820 \&\fBand\fR all pod documentation.
1821 .Sp
1822 The command \fB\-tp\fR or \fB\-\-tee\-pod\fR will write all pod documentation (but
1823 not comments).
1824 .Sp
1825 The commands which write comments (but not pod) are: \fB\-tbc\fR or
1826 \&\fB\-\-tee\-block\-comments\fR and \fB\-tsc\fR or  \fB\-\-tee\-side\-comments\fR.
1827 (Hanging side comments will be written with block comments here.)
1828 .Sp
1829 The negatives of these commands also work, and are the defaults.  
1830 .IP "Using a \fI.perltidyrc\fR command file" 4
1831 .IX Item "Using a .perltidyrc command file"
1832 If you use perltidy frequently, you probably won't be happy until you
1833 create a \fI.perltidyrc\fR file to avoid typing commonly-used parameters.
1834 Perltidy will first look in your current directory for a command file
1835 named \fI.perltidyrc\fR.  If it does not find one, it will continue looking
1836 for one in other standard locations.  
1837 .Sp
1838 These other locations are system\-dependent, and may be displayed with
1839 the command \f(CW\*(C`perltidy \-dpro\*(C'\fR.  Under Unix systems, it will look for a
1840 \&\fI.perltidyrc\fR file in the home directory, and then for a system-wide
1841 file \fI/usr/local/etc/perltidyrc\fR, and then it will look for
1842 \&\fI/etc/perltidyrc\fR.  Note that these last two system-wide files do not
1843 have a leading dot.  Further system-dependent information will be found
1844 in the \s-1INSTALL\s0 file distributed with perltidy.
1845 .Sp
1846 This file is free format, and simply a list of parameters, just as they
1847 would be entered on a command line.  Any number of lines may be used,
1848 with any number of parameters per line, although it may be easiest to
1849 read with one parameter per line.  Blank lines are ignored, and text
1850 after a '#' is ignored to the end of a line.
1851 .Sp
1852 Here is an example of a \fI.perltidyrc\fR file:
1853 .Sp
1854 .Vb 8
1855 \&  # This is a simple of a .perltidyrc configuration file
1856 \&  # This implements a highly spaced style
1857 \&  -se    # errors to standard error output
1858 \&  -w     # show all warnings
1859 \&  -bl    # braces on new lines
1860 \&  -pt=0  # parens not tight at all
1861 \&  -bt=0  # braces not tight
1862 \&  -sbt=0 # square brackets not tight
1863 .Ve
1864 The parameters in the \fI.perltidyrc\fR file are installed first, so any
1865 parameters given on the command line will have priority over them.  
1866 .Sp
1867 To avoid confusion, perltidy ignores any command in the .perltidyrc
1868 file which would cause some kind of dump and an exit.  These are:
1869 .Sp
1870 .Vb 1
1871 \& -h -v -ddf -dln -dop -dsn -dtt -dwls -dwrs -ss
1872 .Ve
1873 There are several options may be helpful in debugging a \fI.perltidyrc\fR
1874 file:  
1875 .RS 4
1876 .IP "\(bu" 4
1877 A very helpful command is \fB\-\-dump\-profile\fR or \fB\-dpro\fR.  It writes a
1878 list of all configuration filenames tested to standard output, and 
1879 if a file is found, it dumps the content to standard output before
1880 exiting.  So, to find out where perltidy looks for its configuration
1881 files, and which one if any it selects, just enter 
1882 .Sp
1883 .Vb 1
1884 \&  perltidy -dpro
1885 .Ve
1886 .IP "\(bu" 4
1887 It may be simplest to develop and test configuration files with
1888 alternative names, and invoke them with \fB\-pro=filename\fR on the command
1889 line.  Then rename the desired file to \fI.perltidyrc\fR when finished.
1890 .IP "\(bu" 4
1891 The parameters in the \fI.perltidyrc\fR file can be switched off with 
1892 the \fB\-npro\fR option.
1893 .IP "\(bu" 4
1894 The commands \fB\-dump\-options\fR, \fB\-dump\-defaults\fR, \fB\-dump\-long\-names\fR,
1895 and \fB\-dump\-short\-names\fR, all described below, may all be helpful.
1896 .RE
1897 .RS 4
1898 .RE
1899 .IP "Creating a new abbreviation" 4
1900 .IX Item "Creating a new abbreviation"
1901 A special notation is available for use in a \fI.perltidyrc\fR file
1902 for creating an abbreviation for a group
1903 of options.  This can be used to create a
1904 shorthand for one or more styles which are frequently, but not always,
1905 used.  The notation is to group the options within curly braces which
1906 are preceded by the name of the alias (without leading dashes), like this:
1907 .Sp
1908 .Vb 4
1909 \&        newword {
1910 \&        -opt1
1911 \&        -opt2
1912 \&        }
1913 .Ve
1914 where \fBnewword\fR is the abbreviation, and \fBopt1\fR, etc, are existing parameters
1915 \&\fIor other abbreviations\fR.  The main syntax requirement is that
1916 the new abbreviation must begin on a new line.
1917 Space before and after the curly braces is optional.
1918 For a
1919 specific example, the following line
1920 .Sp
1921 .Vb 1
1922 \&        airy {-bl -pt=0 -bt=0 -sbt=0}
1923 .Ve
1924 could be placed in a \fI.perltidyrc\fR file, and then invoked at will with
1925 .Sp
1926 .Vb 1
1927 \&        perltidy -airy somefile.pl
1928 .Ve
1929 (Either \f(CW\*(C`\-airy\*(C'\fR or \f(CW\*(C`\-\-airy\*(C'\fR may be used).
1930 .IP "Skipping leading non-perl commands with \fB\-x\fR or \fB\-\-look\-for\-hash\-bang\fR" 4
1931 .IX Item "Skipping leading non-perl commands with -x or --look-for-hash-bang"
1932 If your script has leading lines of system commands or other text which
1933 are not valid perl code, and which are separated from the start of the
1934 perl code by a \*(L"hash\-bang\*(R" line, ( a line of the form \f(CW\*(C`#!...perl\*(C'\fR ),
1935 you must use the \fB\-x\fR flag to tell perltidy not to parse and format any
1936 lines before the \*(L"hash\-bang\*(R" line.  This option also invokes perl with a
1937 \&\-x flag when checking the syntax.  This option was originally added to
1938 allow perltidy to parse interactive \s-1VMS\s0 scripts, but it should be used
1939 for any script which is normally invoked with \f(CW\*(C`perl \-x\*(C'\fR.
1940 .IP "Making a file unreadable" 4
1941 .IX Item "Making a file unreadable"
1942 The goal of perltidy is to improve the readability of files, but there
1943 are two commands which have the opposite effect, \fB\-\-mangle\fR and
1944 \&\fB\-\-extrude\fR.  They are actually
1945 merely aliases for combinations of other parameters.  Both of these
1946 strip all possible whitespace, but leave comments and pod documents,
1947 so that they are essentially reversible.  The
1948 difference between these is that \fB\-\-mangle\fR puts the fewest possible
1949 line breaks in a script while \fB\-\-extrude\fR puts the maximum possible.
1950 Note that these options do not provided any meaningful obfuscation, because
1951 perltidy can be used to reformat the files.  They were originally
1952 developed to help test the tokenization logic of perltidy, but they
1953 have other uses.
1954 One use for \fB\-\-mangle\fR is the following:
1955 .Sp
1956 .Vb 1
1957 \&  perltidy --mangle myfile.pl -st | perltidy -o myfile.pl.new
1958 .Ve
1959 This will form the maximum possible number of one-line blocks (see next
1960 section), and can sometimes help clean up a badly formatted script.
1961 .Sp
1962 A similar technique can be used with \fB\-\-extrude\fR instead of \fB\-\-mangle\fR
1963 to make the minimum number of one-line blocks.
1964 .Sp
1965 Another use for \fB\-\-mangle\fR is to combine it with \fB\-dac\fR to reduce
1966 the file size of a perl script.
1967 .IP "One-line blocks" 4
1968 .IX Item "One-line blocks"
1969 There are a few points to note regarding one-line blocks.  A one-line
1970 block is something like this,
1971 .Sp
1972 .Vb 1
1973 \&        if ($x > 0) { $y = 1 / $x }
1974 .Ve
1975 where the contents within the curly braces is short enough to fit
1976 on a single line.
1977 .Sp
1978 With few exceptions, perltidy retains existing one-line blocks, if it
1979 is possible within the line-length constraint, but it does not attempt
1980 to form new ones.  In other words, perltidy will try to follow the
1981 one-line block style of the input file.
1982 .Sp
1983 If an existing one-line block is longer than the maximum line length,
1984 however, it will be broken into multiple lines.  When this happens, perltidy
1985 checks for and adds any optional terminating semicolon (unless the \fB\-nasc\fR
1986 option is used) if the block is a code block.  
1987 .Sp
1988 The main exception is that perltidy will attempt to form new one-line
1989 blocks following the keywords \f(CW\*(C`map\*(C'\fR, \f(CW\*(C`eval\*(C'\fR, and \f(CW\*(C`sort\*(C'\fR, because
1990 these code blocks are often small and most clearly displayed in a single
1991 line.
1992 .Sp
1993 One-line block rules can conflict with the cuddled-else option.  When
1994 the cuddled-else option is used, perltidy retains existing one-line
1995 blocks, even if they do not obey cuddled-else formatting.
1996 .Sp
1997 Occasionally, when one-line blocks get broken because they exceed the
1998 available line length, the formatting will violate the requested brace style.
1999 If this happens, reformatting the script a second time should correct
2000 the problem.
2001 .IP "Debugging" 4
2002 .IX Item "Debugging"
2003 The following flags are available for debugging:
2004 .Sp
2005 \&\fB\-\-dump\-defaults\fR or \fB\-ddf\fR will write the default option set to standard output and quit
2006 .Sp
2007 \&\fB\-\-dump\-profile\fR or \fB\-dpro\fR  will write the name of the current 
2008 configuration file and its contents to standard output and quit.
2009 .Sp
2010 \&\fB\-\-dump\-options\fR or \fB\-dop\fR  will write current option set to standard
2011 output and quit.  
2012 .Sp
2013 \&\fB\-\-dump\-long\-names\fR or \fB\-dln\fR  will write all command line long names (passed 
2014 to Get_options) to standard output and quit.
2015 .Sp
2016 \&\fB\-\-dump\-short\-names\fR  or \fB\-dsn\fR will write all command line short names 
2017 to standard output and quit.
2018 .Sp
2019 \&\fB\-\-dump\-token\-types\fR or \fB\-dtt\fR  will write a list of all token types 
2020 to standard output and quit.
2021 .Sp
2022 \&\fB\-\-dump\-want\-left\-space\fR or \fB\-dwls\fR  will write the hash \f(CW%want_left_space\fR
2023 to standard output and quit.  See the section on controlling whitespace
2024 around tokens.
2025 .Sp
2026 \&\fB\-\-dump\-want\-right\-space\fR or \fB\-dwrs\fR  will write the hash \f(CW%want_right_space\fR
2027 to standard output and quit.  See the section on controlling whitespace
2028 around tokens.
2029 .Sp
2030 \&\fB\-DEBUG\fR  will write a file with extension \fI.DEBUG\fR for each input file 
2031 showing the tokenization of all lines of code.
2032 .IP "Working with MakeMaker, AutoLoader and SelfLoader" 4
2033 .IX Item "Working with MakeMaker, AutoLoader and SelfLoader"
2034 The first \f(CW$VERSION\fR line of a file which might be eval'd by MakeMaker
2035 is passed through unchanged except for indentation.  
2036 Use \fB\-\-nopass\-version\-line\fR, or \fB\-npvl\fR, to deactivate this feature.
2037 .Sp
2038 If the AutoLoader module is used, perltidy will continue formatting
2039 code after seeing an _\|_END_\|_ line.
2040 Use \fB\-\-nolook\-for\-autoloader\fR, or \fB\-nlal\fR, to deactivate this feature.
2041 .Sp
2042 Likewise, if the SelfLoader module is used, perltidy will continue formatting
2043 code after seeing a _\|_DATA_\|_ line.
2044 Use \fB\-\-nolook\-for\-selfloader\fR, or \fB\-nlsl\fR, to deactivate this feature.
2045 .IP "Working around problems with older version of Perl" 4
2046 .IX Item "Working around problems with older version of Perl"
2047 Perltidy contains a number of rules which help avoid known subtleties
2048 and problems with older versions of perl, and these rules always
2049 take priority over whatever formatting flags have been set.  For example,
2050 perltidy will usually avoid starting a new line with a bareword, because
2051 this might cause problems if \f(CW\*(C`use strict\*(C'\fR is active.
2052 .Sp
2053 There is no way to override these rules.
2054 .SH "HTML OPTIONS"
2055 .IX Header "HTML OPTIONS"
2056 .IP "The \fB\-html\fR master switch" 4
2057 .IX Item "The -html master switch"
2058 The flag \fB\-html\fR causes perltidy to write an html file with extension
2059 \&\fI.html\fR.  So, for example, the following command
2060 .Sp
2061 .Vb 1
2062 \&        perltidy -html somefile.pl
2063 .Ve
2064 will produce a syntax-colored html file named \fIsomefile.pl.html\fR
2065 which may be viewed with a browser.
2066 .Sp
2067 \&\fBPlease Note\fR: In this case, perltidy does not do any formatting to the
2068 input file, and it does not write a formatted file with extension
2069 \&\fI.tdy\fR.  This means that two perltidy runs are required to create a
2070 fully reformatted, html copy of a script.  
2071 .IP "The \fB\-pre\fR flag for code snippets" 4
2072 .IX Item "The -pre flag for code snippets"
2073 When the \fB\-pre\fR flag is given, only the pre-formatted section, within
2074 the <\s-1PRE\s0> and </PRE> tags, will be output.  This simplifies inclusion
2075 of the output in other files.  The default is to output a complete
2076 web page.
2077 .IP "The \fB\-nnn\fR flag for line numbering" 4
2078 .IX Item "The -nnn flag for line numbering"
2079 When the \fB\-nnn\fR flag is given, the output lines will be numbered.
2080 .IP "The \fB\-toc\fR, or \fB\-\-html\-table\-of\-contents\fR flag" 4
2081 .IX Item "The -toc, or --html-table-of-contents flag"
2082 By default, a table of contents to packages and subroutines will be
2083 written at the start of html output.  Use \fB\-ntoc\fR to prevent this.
2084 This might be useful, for example, for a pod document which contains a
2085 number of unrelated code snippets.  This flag only influences the code
2086 table of contents; it has no effect on any table of contents produced by
2087 pod2html (see next item).
2088 .IP "The \fB\-pod\fR, or \fB\-\-pod2html\fR flag" 4
2089 .IX Item "The -pod, or --pod2html flag"
2090 There are two options for formatting pod documentation.  The default is
2091 to pass the pod through the Pod::Html module (which forms the basis of
2092 the pod2html utility).  Any code sections are formatted by perltidy, and
2093 the results then merged.  Note: perltidy creates a temporary file when
2094 Pod::Html is used; see \*(L"\s-1FILES\s0\*(R".  Also, Pod::Html creates temporary
2095 files for its cache.
2096 .Sp
2097 \&\s-1NOTE:\s0 Perltidy counts the number of \f(CW\*(C`=cut\*(C'\fR lines, and either moves the
2098 pod text to the top of the html file if there is one \f(CW\*(C`=cut\*(C'\fR, or leaves
2099 the pod text in its original order (interleaved with code) otherwise.
2100 .Sp
2101 Most of the flags accepted by pod2html may be included in the perltidy
2102 command line, and they will be passed to pod2html.  In some cases,
2103 the flags have a prefix \f(CW\*(C`pod\*(C'\fR to emphasize that they are for the
2104 pod2html, and this prefix will be removed before they are passed to
2105 pod2html.  The flags which have the additional \f(CW\*(C`pod\*(C'\fR prefix are:
2106 .Sp
2107 .Vb 2
2108 \&   --[no]podheader --[no]podindex --[no]podrecurse --[no]podquiet 
2109 \&   --[no]podverbose --podflush
2110 .Ve
2111 The flags which are unchanged from their use in pod2html are:
2112 .Sp
2113 .Vb 2
2114 \&   --backlink=s --cachedir=s --htmlroot=s --libpods=s --title=s
2115 \&   --podpath=s --podroot=s
2116 .Ve
2117 where 's' is an appropriate character string.  Not all of these flags are
2118 available in older versions of Pod::Html.  See your Pod::Html documentation for
2119 more information.
2120 .Sp
2121 The alternative, indicated with \fB\-npod\fR, is not to use Pod::Html, but
2122 rather to format pod text in italics (or whatever the stylesheet
2123 indicates), without special html markup.  This is useful, for example,
2124 if pod is being used as an alternative way to write comments.
2125 .IP "The \fB\-frm\fR, or \fB\-\-frames\fR flag" 4
2126 .IX Item "The -frm, or --frames flag"
2127 By default, a single html output file is produced.  This can be changed
2128 with the \fB\-frm\fR option, which creates a frame holding a table of
2129 contents in the left panel and the source code in the right side. This
2130 simplifies code browsing.  Assume, for example, that the input file is
2131 \&\fIMyModule.pm\fR.  Then, for default file extension choices, these three
2132 files will be created:
2133 .Sp
2134 .Vb 3
2135 \& MyModule.pm.html      - the frame
2136 \& MyModule.pm.toc.html  - the table of contents
2137 \& MyModule.pm.src.html  - the formatted source code
2138 .Ve
2139 Obviously this file naming scheme requires that output be directed to a real
2140 file (as opposed to, say, standard output).  If this is not the
2141 case, or if the file extension is unknown, the \fB\-frm\fR option will be
2142 ignored.
2143 .IP "The \fB\-text=s\fR, or \fB\-\-html\-toc\-extension\fR flag" 4
2144 .IX Item "The -text=s, or --html-toc-extension flag"
2145 Use this flag to specify the extra file extension of the table of contents file
2146 when html frames are used.  The default is \*(L"toc\*(R".
2147 See \*(L"Specifying File Extensions\*(R".
2148 .IP "The \fB\-sext=s\fR, or \fB\-\-html\-src\-extension\fR flag" 4
2149 .IX Item "The -sext=s, or --html-src-extension flag"
2150 Use this flag to specify the extra file extension of the content file when html
2151 frames are used.  The default is \*(L"src\*(R".
2152 See \*(L"Specifying File Extensions\*(R".
2153 .IP "The \fB\-hent\fR, or \fB\-\-html\-entities\fR flag" 4
2154 .IX Item "The -hent, or --html-entities flag"
2155 This flag controls the use of Html::Entities for html formatting.  By
2156 default, the module Html::Entities is used to encode special symbols.
2157 This may not be the right thing for some browser/language
2158 combinations.  Use \-\-nohtml\-entities or \-nhent to prevent this.
2159 .IP "Style Sheets" 4
2160 .IX Item "Style Sheets"
2161 Style sheets make it very convenient to control and adjust the
2162 appearance of html pages.  The default behavior is to write a page of
2163 html with an embedded style sheet.
2164 .Sp
2165 An alternative to an embedded style sheet is to create a page with a
2166 link to an external style sheet.  This is indicated with the
2167 \&\fB\-css=filename\fR,  where the external style sheet is \fIfilename\fR.  The
2168 external style sheet \fIfilename\fR will be created if and only if it does
2169 not exist.  This option is useful for controlling multiple pages from a
2170 single style sheet.
2171 .Sp
2172 To cause perltidy to write a style sheet to standard output and exit,
2173 use the \fB\-ss\fR, or \fB\-\-stylesheet\fR, flag.  This is useful if the style
2174 sheet could not be written for some reason, such as if the \fB\-pre\fR flag
2175 was used.  Thus, for example,
2176 .Sp
2177 .Vb 1
2178 \&  perltidy -html -ss >mystyle.css
2179 .Ve
2180 will write a style sheet with the default properties to file
2181 \&\fImystyle.css\fR.
2182 .Sp
2183 The use of style sheets is encouraged, but a web page without a style
2184 sheets can be created with the flag \fB\-nss\fR.  Use this option if you
2185 must to be sure that older browsers (roughly speaking, versions prior to
2186 4.0 of Netscape Navigator and Internet Explorer) can display the
2187 syntax-coloring of the html files.
2188 .IP "Controlling \s-1HTML\s0 properties" 4
2189 .IX Item "Controlling HTML properties"
2190 Note: It is usually more convenient to accept the default properties
2191 and then edit the stylesheet which is produced.  However, this section
2192 shows how to control the properties with flags to perltidy.
2193 .Sp
2194 Syntax colors may be changed from their default values by flags of the either
2195 the long form, \fB\-html\-color\-xxxxxx=n\fR, or more conveniently the short form,
2196 \&\fB\-hcx=n\fR, where \fBxxxxxx\fR is one of the following words, and \fBx\fR is the
2197 corresponding abbreviation:
2198 .Sp
2199 .Vb 19
2200 \&      Token Type             xxxxxx           x 
2201 \&      ----------             --------         --
2202 \&      comment                comment          c
2203 \&      number                 numeric          n
2204 \&      identifier             identifier       i
2205 \&      bareword, function     bareword         w
2206 \&      keyword                keyword          k
2207 \&      quite, pattern         quote            q
2208 \&      here doc text          here-doc-text    h
2209 \&      here doc target        here-doc-target  hh
2210 \&      punctuation            punctuation      pu
2211 \&      parentheses            paren            p
2212 \&      structural braces      structure        s
2213 \&      semicolon              semicolon        sc
2214 \&      colon                  colon            co
2215 \&      comma                  comma            cm
2216 \&      label                  label            j
2217 \&      sub definition name    subroutine       m
2218 \&      pod text               pod-text         pd
2219 .Ve
2220 A default set of colors has been defined, but they may be changed by providing
2221 values to any of the following parameters, where \fBn\fR is either a 6 digit 
2222 hex \s-1RGB\s0 color value or an ascii name for a color, such as 'red'.
2223 .Sp
2224 To illustrate, the following command will produce an html 
2225 file \fIsomefile.pl.html\fR with \*(L"aqua\*(R" keywords:
2226 .Sp
2227 .Vb 1
2228 \&        perltidy -html -hck=00ffff somefile.pl
2229 .Ve
2230 and this should be equivalent for most browsers:
2231 .Sp
2232 .Vb 1
2233 \&        perltidy -html -hck=aqua somefile.pl
2234 .Ve
2235 Perltidy merely writes any non-hex names that it sees in the html file.
2236 The following 16 color names are defined in the \s-1HTML\s0 3.2 standard:
2237 .Sp
2238 .Vb 16
2239 \&        black   => 000000,
2240 \&        silver  => c0c0c0,
2241 \&        gray    => 808080,
2242 \&        white   => ffffff,
2243 \&        maroon  => 800000,
2244 \&        red     => ff0000,
2245 \&        purple  => 800080,
2246 \&        fuchsia => ff00ff,
2247 \&        green   => 008000,
2248 \&        lime    => 00ff00,
2249 \&        olive   => 808000,
2250 \&        yellow  => ffff00
2251 \&        navy    => 000080,
2252 \&        blue    => 0000ff,
2253 \&        teal    => 008080,
2254 \&        aqua    => 00ffff,
2255 .Ve
2256 Many more names are supported in specific browsers, but it is safest
2257 to use the hex codes for other colors.  Helpful color tables can be
2258 located with an internet search for \*(L"\s-1HTML\s0 color tables\*(R". 
2259 .Sp
2260 Besides color, two other character attributes may be set: bold, and italics.
2261 To set a token type to use bold, use the flag
2262 \&\fB\-html\-bold\-xxxxxx\fR or \fB\-hbx\fR, where \fBxxxxxx\fR or \fBx\fR are the long
2263 or short names from the above table.  Conversely, to set a token type to 
2264 \&\s-1NOT\s0 use bold, use \fB\-nohtml\-bold\-xxxxxx\fR or \fB\-nhbx\fR.
2265 .Sp
2266 Likewise, to set a token type to use an italic font, use the flag
2267 \&\fB\-html\-italic\-xxxxxx\fR or \fB\-hix\fR, where again \fBxxxxxx\fR or \fBx\fR are the
2268 long or short names from the above table.  And to set a token type to
2269 \&\s-1NOT\s0 use italics, use \fB\-nohtml\-italic\-xxxxxx\fR or \fB\-nhix\fR.
2270 .Sp
2271 For example, to use bold braces and lime color, non\-bold, italics keywords the
2272 following command would be used:
2273 .Sp
2274 .Vb 1
2275 \&        perltidy -html -hbs -hck=00FF00 -nhbk -hik somefile.pl
2276 .Ve
2277 The background color can be specified with \fB\-html\-color\-background=n\fR,
2278 or \fB\-hcbg=n\fR for short, where n is a 6 character hex \s-1RGB\s0 value.  The
2279 default color of text is the value given to \fBpunctuation\fR, which is
2280 black as a default.
2281 .Sp
2282 Here are some notes and hints:
2283 .Sp
2284 1. If you find a preferred set of these parameters, you may want
2285 to create a \fI.perltidyrc\fR file containing them.  See the perltidy man
2286 page for an explanation.
2287 .Sp
2288 2. Rather than specifying values for these parameters, it is probably
2289 easier to accept the defaults and then edit a style sheet.  The style
2290 sheet contains comments which should make this easy.
2291 .Sp
2292 3. The syntax-colored html files can be very large, so it may be best to
2293 split large files into smaller pieces to improve download times.
2294 .SH "SOME COMMON INPUT CONVENTIONS"
2295 .IX Header "SOME COMMON INPUT CONVENTIONS"
2296 .Sh "Specifying Block Types"
2297 .IX Subsection "Specifying Block Types"
2298 Several parameters which refer to code block types may be customized by also
2299 specifying an associated list of block types.  The type of a block is the name
2300 of the keyword which introduces that block, such as \fBif\fR, \fBelse\fR, or \fBsub\fR.
2301 An exception is a labeled block, which has no keyword, and should be specified
2302 with just a colon.
2303 .PP
2304 For example, the following parameter specifies \f(CW\*(C`sub\*(C'\fR, labels, \f(CW\*(C`BEGIN\*(C'\fR, and
2305 \&\f(CW\*(C`END\*(C'\fR blocks:
2306 .PP
2307 .Vb 1
2308 \&   -cscl="sub : BEGIN END"
2309 .Ve
2310 (the meaning of the \-cscl parameter is described above.)  Note that
2311 quotes are required around the list of block types because of the
2312 spaces.
2313 .Sh "Specifying File Extensions"
2314 .IX Subsection "Specifying File Extensions"
2315 Several parameters allow default file extensions to be overridden.  For
2316 example, a backup file extension may be specified with \fB\-bext=ext\fR,
2317 where \fBext\fR is some new extension.  In order to provides the user some
2318 flexibility, the following convention is used in all cases to decide if
2319 a leading '.' should be used.  If the extension \f(CW\*(C`ext\*(C'\fR begins with
2320 \&\f(CW\*(C`A\-Z\*(C'\fR, \f(CW\*(C`a\-z\*(C'\fR, or \f(CW\*(C`0\-9\*(C'\fR, then it will be appended to the filename with
2321 an intermediate '.' (or perhaps an '_' on \s-1VMS\s0 systems).  Otherwise, it
2322 will be appended directly.  
2323 .PP
2324 For example, suppose the file is \fIsomefile.pl\fR.  For \f(CW\*(C`\-bext=old\*(C'\fR, a '.' is
2325 added to give \fIsomefile.pl.old\fR.  For \f(CW\*(C`\-bext=.old\*(C'\fR, no additional '.' is
2326 added, so again the backup file is \fIsomefile.pl.old\fR.  For \f(CW\*(C`\-bext=~\*(C'\fR, then no
2327 dot is added, and the backup file will be \fIsomefile.pl~\fR  .  
2328 .SH "SWITCHES WHICH MAY BE NEGATED"
2329 .IX Header "SWITCHES WHICH MAY BE NEGATED"
2330 The following list shows all short parameter names which allow a prefix
2331 \&'n' to produce the negated form:
2332 .PP
2333 .Vb 5
2334 \&    D anl asc aws b bbb bbc bbs bli boc bok bol bot syn ce csc 
2335 \&    dac dbc dcsc dnl dws dp dpro dsm dsc ddf dln dop dsn dtt dwls dwrs 
2336 \&    f fll frm hsc html ibc icb icp iob isbc lp log lal x lsl ple pod bl 
2337 \&    sbl okw ola oll ple pvl q opt sbc sfs ssc sts se st sob 
2338 \&    t tac tbc toc tp tsc tqw w
2339 .Ve
2340 Equivalently, the prefix 'no' or 'no\-' on the corresponding long names may be
2341 used.
2342 .SH "LIMITATIONS"
2343 .IX Header "LIMITATIONS"
2344 .IP "Parsing Limitations" 4
2345 .IX Item "Parsing Limitations"
2346 Perltidy should work properly on most perl scripts.  It does a lot of
2347 self\-checking, but still, it is possible that an error could be
2348 introduced and go undetected.  Therefore, it is essential to make
2349 careful backups and to test reformatted scripts.
2350 .Sp
2351 The main current limitation is that perltidy does not scan modules
2352 included with 'use' statements.  This makes it necessary to guess the
2353 context of any bare words introduced by such modules.  Perltidy has good
2354 guessing algorithms, but they are not infallible.  When it must guess,
2355 it leaves a message in the log file.
2356 .Sp
2357 If you encounter a bug, please report it.
2358 .IP "What perltidy does not parse and format" 4
2359 .IX Item "What perltidy does not parse and format"
2360 Perltidy indents but does not reformat comments and \f(CW\*(C`qw\*(C'\fR quotes. 
2361 Perltidy does not in any way modify the contents of here documents or
2362 quoted text, even if they contain source code.  (You could, however,
2363 reformat them separately).  Perltidy does not format 'format' sections
2364 in any way.  And, of course, it does not modify pod documents.
2365 .SH "FILES"
2366 .IX Header "FILES"
2367 .IP "Temporary files" 4
2368 .IX Item "Temporary files"
2369 Under the \-html option with the default \-\-pod2html flag, a temporary file is
2370 required to pass text to Pod::Html.  Unix systems will try to use the \s-1POSIX\s0
2371 \&\fItmpnam()\fR function.  Otherwise the file \fIperltidy.TMP\fR will be temporarily
2372 created in the current working directory.
2373 .IP "Special files when standard input is used" 4
2374 .IX Item "Special files when standard input is used"
2375 When standard input is used, the log file, if saved, is \fIperltidy.LOG\fR,
2376 and any errors are written to \fIperltidy.ERR\fR unless the \fB\-se\fR flag is
2377 set.  These are saved in the current working directory.  
2378 .IP "Files overwritten" 4
2379 .IX Item "Files overwritten"
2380 The following file extensions are used by perltidy, and files with these
2381 extensions may be overwritten or deleted: \fI.ERR\fR, \fI.LOG\fR, \fI.TEE\fR,
2382 and/or \fI.tdy\fR, \fI.html\fR, and \fI.bak\fR, depending on the run type and
2383 settings.
2384 .IP "Files extensions limitations" 4
2385 .IX Item "Files extensions limitations"
2386 Perltidy does not operate on files for which the run could produce a file with
2387 a duplicated file extension.  These extensions include \fI.LOG\fR, \fI.ERR\fR,
2388 \&\fI.TEE\fR, and perhaps \fI.tdy\fR and \fI.bak\fR, depending on the run type.  The
2389 purpose of this rule is to prevent generating confusing filenames such as
2390 \&\fIsomefile.tdy.tdy.tdy\fR.
2391 .SH "SEE ALSO"
2392 .IX Header "SEE ALSO"
2393 \&\fIperlstyle\fR\|(1), \fIPerl::Tidy\fR\|(3)
2394 .SH "VERSION"
2395 .IX Header "VERSION"
2396 This man page documents perltidy version 20031021.
2397 .SH "CREDITS"
2398 .IX Header "CREDITS"
2399 Michael Cartmell supplied code for adaptation to \s-1VMS\s0 and helped with
2400 v\-strings.
2401 .PP
2402 Yves Orton supplied code for adaptation to the various versions
2403 of Windows. 
2404 .PP
2405 Axel Rose supplied a patch for MacPerl.
2406 .PP
2407 Hugh S. Myers designed and implemented the initial Perl::Tidy module interface. 
2408 .PP
2409 Many others have supplied key ideas, suggestions, and bug reports;
2410 see the \s-1CHANGES\s0 file.
2411 .SH "AUTHOR"
2412 .IX Header "AUTHOR"
2413 .Vb 3
2414 \&  Steve Hancock
2415 \&  email: perltidy at users.sourceforge.net
2416 \&  http://perltidy.sourceforge.net
2417 .Ve
2418 .SH "COPYRIGHT"
2419 .IX Header "COPYRIGHT"
2420 Copyright (c) 2000\-2003 by Steve Hancock
2421 .SH "LICENSE"
2422 .IX Header "LICENSE"
2423 This package is free software; you can redistribute it and/or modify it
2424 under the terms of the \*(L"\s-1GNU\s0 General Public License\*(R".
2425 .PP
2426 Please refer to the file \*(L"\s-1COPYING\s0\*(R" for details.
2427 .SH "DISCLAIMER"
2428 .IX Header "DISCLAIMER"
2429 This package is distributed in the hope that it will be useful,
2430 but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of
2431 \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0.
2432 .PP
2433 See the \*(L"\s-1GNU\s0 General Public License\*(R" for more details.