]> git.donarmstrong.com Git - perltidy.git/blob - docs/perltidy.1
New upstream version 20170521
[perltidy.git] / docs / perltidy.1
1 .\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 'br\}
42 .\"
43 .\" Escape single quotes in literal strings from groff's Unicode transform.
44 .ie \n(.g .ds Aq \(aq
45 .el       .ds Aq '
46 .\"
47 .\" If the F register is turned on, we'll generate index entries on stderr for
48 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49 .\" entries marked with X<> in POD.  Of course, you'll have to process the
50 .\" output yourself in some meaningful fashion.
51 .ie \nF \{\
52 .    de IX
53 .    tm Index:\\$1\t\\n%\t"\\$2"
54 ..
55 .    nr % 0
56 .    rr F
57 .\}
58 .el \{\
59 .    de IX
60 ..
61 .\}
62 .\"
63 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65 .    \" fudge factors for nroff and troff
66 .if n \{\
67 .    ds #H 0
68 .    ds #V .8m
69 .    ds #F .3m
70 .    ds #[ \f1
71 .    ds #] \fP
72 .\}
73 .if t \{\
74 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75 .    ds #V .6m
76 .    ds #F 0
77 .    ds #[ \&
78 .    ds #] \&
79 .\}
80 .    \" simple accents for nroff and troff
81 .if n \{\
82 .    ds ' \&
83 .    ds ` \&
84 .    ds ^ \&
85 .    ds , \&
86 .    ds ~ ~
87 .    ds /
88 .\}
89 .if t \{\
90 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96 .\}
97 .    \" troff and (daisy-wheel) nroff accents
98 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105 .ds ae a\h'-(\w'a'u*4/10)'e
106 .ds Ae A\h'-(\w'A'u*4/10)'E
107 .    \" corrections for vroff
108 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110 .    \" for low resolution devices (crt and lpr)
111 .if \n(.H>23 .if \n(.V>19 \
112 \{\
113 .    ds : e
114 .    ds 8 ss
115 .    ds o a
116 .    ds d- d\h'-1'\(ga
117 .    ds D- D\h'-1'\(hy
118 .    ds th \o'bp'
119 .    ds Th \o'LP'
120 .    ds ae ae
121 .    ds Ae AE
122 .\}
123 .rm #[ #] #H #V #F C
124 .\" ========================================================================
125 .\"
126 .IX Title "PERLTIDY 1"
127 .TH PERLTIDY 1 "2017-05-21" "perl v5.14.2" "User Contributed Perl Documentation"
128 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129 .\" way too many mistakes in technical documents.
130 .if n .ad l
131 .nh
132 .SH "NAME"
133 perltidy \- a perl script indenter and reformatter
134 .SH "SYNOPSIS"
135 .IX Header "SYNOPSIS"
136 .Vb 5
137 \&    perltidy [ options ] file1 file2 file3 ...
138 \&            (output goes to file1.tdy, file2.tdy, file3.tdy, ...)
139 \&    perltidy [ options ] file1 \-o outfile
140 \&    perltidy [ options ] file1 \-st >outfile
141 \&    perltidy [ options ] <infile >outfile
142 .Ve
143 .SH "DESCRIPTION"
144 .IX Header "DESCRIPTION"
145 Perltidy reads a perl script and writes an indented, reformatted script.
146 .PP
147 Many users will find enough information in \*(L"\s-1EXAMPLES\s0\*(R" to get 
148 started.  New users may benefit from the short tutorial 
149 which can be found at
150 http://perltidy.sourceforge.net/tutorial.html
151 .PP
152 A convenient aid to systematically defining a set of style parameters
153 can be found at
154 http://perltidy.sourceforge.net/stylekey.html
155 .PP
156 Perltidy can produce output on either of two modes, depending on the
157 existence of an \fB\-html\fR flag.  Without this flag, the output is passed
158 through a formatter.  The default formatting tries to follow the
159 recommendations in \fIperlstyle\fR\|(1), but it can be controlled in detail with
160 numerous input parameters, which are described in \*(L"\s-1FORMATTING\s0
161 \&\s-1OPTIONS\s0\*(R".
162 .PP
163 When the \fB\-html\fR flag is given, the output is passed through an \s-1HTML\s0
164 formatter which is described in \*(L"\s-1HTML\s0 \s-1OPTIONS\s0\*(R".
165 .SH "EXAMPLES"
166 .IX Header "EXAMPLES"
167 .Vb 1
168 \&  perltidy somefile.pl
169 .Ve
170 .PP
171 This will produce a file \fIsomefile.pl.tdy\fR containing the script reformatted
172 using the default options, which approximate the style suggested in 
173 \&\fIperlstyle\fR\|(1).  The source file \fIsomefile.pl\fR is unchanged.
174 .PP
175 .Vb 1
176 \&  perltidy *.pl
177 .Ve
178 .PP
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 .PP
188 Modify \fIfile1.pl\fR and \fIfile2.pl\fR in place, and backup the originals to
189 \&\fIfile1.pl.bak\fR and \fIfile2.pl.bak\fR.  If \fIfile1.pl.bak\fR and/or \fIfile2.pl.bak\fR
190 already exist, they will be overwritten.
191 .PP
192 .Vb 1
193 \&  perltidy \-b \-bext=\*(Aq/\*(Aq file1.pl file2.pl
194 .Ve
195 .PP
196 Same as the previous example except that the backup files \fIfile1.pl.bak\fR and \fIfile2.pl.bak\fR will be deleted if there are no errors.
197 .PP
198 .Vb 1
199 \&  perltidy \-gnu somefile.pl
200 .Ve
201 .PP
202 Execute perltidy on file \fIsomefile.pl\fR with a style which approximates the
203 \&\s-1GNU\s0 Coding Standards for C programs.  The output will be \fIsomefile.pl.tdy\fR.
204 .PP
205 .Vb 1
206 \&  perltidy \-i=3 somefile.pl
207 .Ve
208 .PP
209 Execute perltidy on file \fIsomefile.pl\fR, with 3 columns for each level of
210 indentation (\fB\-i=3\fR) instead of the default 4 columns.  There will not be any
211 tabs in the reformatted script, except for any which already exist in comments,
212 pod documents, quotes, and here documents.  Output will be \fIsomefile.pl.tdy\fR.
213 .PP
214 .Vb 1
215 \&  perltidy \-i=3 \-et=8 somefile.pl
216 .Ve
217 .PP
218 Same as the previous example, except that leading whitespace will
219 be entabbed with one tab character per 8 spaces.
220 .PP
221 .Vb 1
222 \&  perltidy \-ce \-l=72 somefile.pl
223 .Ve
224 .PP
225 Execute perltidy on file \fIsomefile.pl\fR with all defaults except use \*(L"cuddled
226 elses\*(R" (\fB\-ce\fR) and a maximum line length of 72 columns (\fB\-l=72\fR) instead of
227 the default 80 columns.
228 .PP
229 .Vb 1
230 \&  perltidy \-g somefile.pl
231 .Ve
232 .PP
233 Execute perltidy on file \fIsomefile.pl\fR and save a log file \fIsomefile.pl.LOG\fR
234 which shows the nesting of braces, parentheses, and square brackets at
235 the start of every line.
236 .PP
237 .Vb 1
238 \&  perltidy \-html somefile.pl
239 .Ve
240 .PP
241 This will produce a file \fIsomefile.pl.html\fR containing the script with
242 html markup.  The output file will contain an embedded style sheet in
243 the <\s-1HEAD\s0> section which may be edited to change the appearance.
244 .PP
245 .Vb 1
246 \&  perltidy \-html \-css=mystyle.css somefile.pl
247 .Ve
248 .PP
249 This will produce a file \fIsomefile.pl.html\fR containing the script with
250 html markup.  This output file will contain a link to a separate style
251 sheet file \fImystyle.css\fR.  If the file \fImystyle.css\fR does not exist,
252 it will be created.  If it exists, it will not be overwritten.
253 .PP
254 .Vb 1
255 \&  perltidy \-html \-pre somefile.pl
256 .Ve
257 .PP
258 Write an html snippet with only the \s-1PRE\s0 section to \fIsomefile.pl.html\fR.
259 This is useful when code snippets are being formatted for inclusion in a
260 larger web page.  No style sheet will be written in this case.
261 .PP
262 .Vb 1
263 \&  perltidy \-html \-ss >mystyle.css
264 .Ve
265 .PP
266 Write a style sheet to \fImystyle.css\fR and exit.
267 .PP
268 .Vb 1
269 \&  perltidy \-html \-frm mymodule.pm
270 .Ve
271 .PP
272 Write html with a frame holding a table of contents and the source code.  The
273 output files will be \fImymodule.pm.html\fR (the frame), \fImymodule.pm.toc.html\fR
274 (the table of contents), and \fImymodule.pm.src.html\fR (the source code).
275 .SH "OPTIONS \- OVERVIEW"
276 .IX Header "OPTIONS - OVERVIEW"
277 The entire command line is scanned for options, and they are processed
278 before any files are processed.  As a result, it does not matter
279 whether flags are before or after any filenames.  However, the relative
280 order of parameters is important, with later parameters overriding the
281 values of earlier parameters.
282 .PP
283 For each parameter, there is a long name and a short name.  The short
284 names are convenient for keyboard input, while the long names are
285 self-documenting and therefore useful in scripts.  It is customary to
286 use two leading dashes for long names, but one may be used.
287 .PP
288 Most parameters which serve as on/off flags can be negated with a
289 leading \*(L"n\*(R" (for the short name) or a leading \*(L"no\*(R" or \*(L"no\-\*(R" (for the
290 long name).  For example, the flag to outdent long quotes is \fB\-olq\fR
291 or \fB\-\-outdent\-long\-quotes\fR.  The flag to skip this is \fB\-nolq\fR
292 or \fB\-\-nooutdent\-long\-quotes\fR or \fB\-\-no\-outdent\-long\-quotes\fR.
293 .PP
294 Options may not be bundled together.  In other words, options \fB\-q\fR and
295 \&\fB\-g\fR may \s-1NOT\s0 be entered as \fB\-qg\fR.
296 .PP
297 Option names may be terminated early as long as they are uniquely identified.
298 For example, instead of \fB\-\-dump\-token\-types\fR, it would be sufficient to enter
299 \&\fB\-\-dump\-tok\fR, or even \fB\-\-dump\-t\fR, to uniquely identify this command.
300 .SS "I/O control"
301 .IX Subsection "I/O control"
302 The following parameters concern the files which are read and written.
303 .IP "\fB\-h\fR,    \fB\-\-help\fR" 4
304 .IX Item "-h,    --help"
305 Show summary of usage and exit.
306 .IP "\fB\-o\fR=filename,    \fB\-\-outfile\fR=filename" 4
307 .IX Item "-o=filename,    --outfile=filename"
308 Name of the output file (only if a single input file is being
309 processed).  If no output file is specified, and output is not
310 redirected to the standard output, the output will go to \fIfilename.tdy\fR.
311 .IP "\fB\-st\fR,    \fB\-\-standard\-output\fR" 4
312 .IX Item "-st,    --standard-output"
313 Perltidy must be able to operate on an arbitrarily large number of files
314 in a single run, with each output being directed to a different output
315 file.  Obviously this would conflict with outputting to the single
316 standard output device, so a special flag, \fB\-st\fR, is required to
317 request outputting to the standard output.  For example,
318 .Sp
319 .Vb 1
320 \&  perltidy somefile.pl \-st >somefile.new.pl
321 .Ve
322 .Sp
323 This option may only be used if there is just a single input file.  
324 The default is \fB\-nst\fR or \fB\-\-nostandard\-output\fR.
325 .IP "\fB\-se\fR,    \fB\-\-standard\-error\-output\fR" 4
326 .IX Item "-se,    --standard-error-output"
327 If perltidy detects an error when processing file \fIsomefile.pl\fR, its
328 default behavior is to write error messages to file \fIsomefile.pl.ERR\fR.
329 Use \fB\-se\fR to cause all error messages to be sent to the standard error
330 output stream instead.  This directive may be negated with \fB\-nse\fR.
331 Thus, you may place \fB\-se\fR in a \fI.perltidyrc\fR and override it when
332 desired with \fB\-nse\fR on the command line.
333 .IP "\fB\-oext\fR=ext,    \fB\-\-output\-file\-extension\fR=ext" 4
334 .IX Item "-oext=ext,    --output-file-extension=ext"
335 Change the extension of the output file to be \fIext\fR instead of the
336 default \fItdy\fR (or \fIhtml\fR in case the \-\fB\-html\fR option is used).
337 See \*(L"Specifying File Extensions\*(R".
338 .IP "\fB\-opath\fR=path,    \fB\-\-output\-path\fR=path" 4
339 .IX Item "-opath=path,    --output-path=path"
340 When perltidy creates a filename for an output file, by default it merely
341 appends an extension to the path and basename of the input file.  This
342 parameter causes the path to be changed to \fIpath\fR instead.
343 .Sp
344 The path should end in a valid path separator character, but perltidy will try
345 to add one if it is missing.
346 .Sp
347 For example
348 .Sp
349 .Vb 1
350 \& perltidy somefile.pl \-opath=/tmp/
351 .Ve
352 .Sp
353 will produce \fI/tmp/somefile.pl.tdy\fR.  Otherwise, \fIsomefile.pl.tdy\fR will
354 appear in whatever directory contains \fIsomefile.pl\fR.
355 .Sp
356 If the path contains spaces, it should be placed in quotes.
357 .Sp
358 This parameter will be ignored if output is being directed to standard output,
359 or if it is being specified explicitly with the \fB\-o=s\fR parameter.
360 .IP "\fB\-b\fR,    \fB\-\-backup\-and\-modify\-in\-place\fR" 4
361 .IX Item "-b,    --backup-and-modify-in-place"
362 Modify the input file or files in-place and save the original with the
363 extension \fI.bak\fR.  Any existing \fI.bak\fR file will be deleted.  See next
364 item for changing the default backup extension, and for eliminating the
365 backup file altogether.
366 .Sp
367 A \fB\-b\fR flag will be ignored if input is from standard input or goes to
368 standard output, or if the \fB\-html\fR flag is set.
369 .Sp
370 In particular, if you want to use both the \fB\-b\fR flag and the \fB\-pbp\fR
371 (\-\-perl\-best\-practices) flag, then you must put a \fB\-nst\fR flag after the
372 \&\fB\-pbp\fR flag because it contains a \fB\-st\fR flag as one of its components,
373 which means that output will go to the standard output stream.
374 .IP "\fB\-bext\fR=ext,    \fB\-\-backup\-file\-extension\fR=ext" 4
375 .IX Item "-bext=ext,    --backup-file-extension=ext"
376 This parameter serves two purposes: (1) to change the extension of the backup
377 file to be something other than the default \fI.bak\fR, and (2) to indicate
378 that no backup file should be saved.
379 .Sp
380 To change the default extension to something other than \fI.bak\fR see
381 \&\*(L"Specifying File Extensions\*(R".
382 .Sp
383 A backup file of the source is always written, but you can request that it
384 be deleted at the end of processing if there were no errors.  This is risky
385 unless the source code is being maintained with a source code control
386 system.
387 .Sp
388 To indicate that the backup should be deleted include one forward slash,
389 \&\fB/\fR, in the extension.  If any text remains after the slash is removed
390 it will be used to define the backup file extension (which is always
391 created and only deleted if there were no errors).
392 .Sp
393 Here are some examples:
394 .Sp
395 .Vb 5
396 \&  Parameter           Extension          Backup File Treatment
397 \&  <\-bext=bak>         F<.bak>            Keep (same as the default behavior)
398 \&  <\-bext=\*(Aq/\*(Aq>         F<.bak>            Delete if no errors
399 \&  <\-bext=\*(Aq/backup\*(Aq>   F<.backup>         Delete if no errors
400 \&  <\-bext=\*(Aqoriginal/\*(Aq> F<.original>       Delete if no errors
401 .Ve
402 .IP "\fB\-w\fR,    \fB\-\-warning\-output\fR" 4
403 .IX Item "-w,    --warning-output"
404 Setting \fB\-w\fR causes any non-critical warning
405 messages to be reported as errors.  These include messages
406 about possible pod problems, possibly bad starting indentation level,
407 and cautions about indirect object usage.  The default, \fB\-nw\fR or
408 \&\fB\-\-nowarning\-output\fR, is not to include these warnings.
409 .IP "\fB\-q\fR,    \fB\-\-quiet\fR" 4
410 .IX Item "-q,    --quiet"
411 Deactivate error messages and syntax checking (for running under
412 an editor).
413 .Sp
414 For example, if you use a vi-style editor, such as vim, you may execute
415 perltidy as a filter from within the editor using something like
416 .Sp
417 .Vb 1
418 \& :n1,n2!perltidy \-q
419 .Ve
420 .Sp
421 where \f(CW\*(C`n1,n2\*(C'\fR represents the selected text.  Without the \fB\-q\fR flag,
422 any error message may mess up your screen, so be prepared to use your
423 \&\*(L"undo\*(R" key.
424 .IP "\fB\-log\fR,    \fB\-\-logfile\fR" 4
425 .IX Item "-log,    --logfile"
426 Save the \fI.LOG\fR file, which has many useful diagnostics.  Perltidy always
427 creates a \fI.LOG\fR file, but by default it is deleted unless a program bug is
428 suspected.  Setting the \fB\-log\fR flag forces the log file to be saved.
429 .IP "\fB\-g=n\fR, \fB\-\-logfile\-gap=n\fR" 4
430 .IX Item "-g=n, --logfile-gap=n"
431 Set maximum interval between input code lines in the logfile.  This purpose of
432 this flag is to assist in debugging nesting errors.  The value of \f(CW\*(C`n\*(C'\fR is
433 optional.  If you set the flag \fB\-g\fR without the value of \f(CW\*(C`n\*(C'\fR, it will be
434 taken to be 1, meaning that every line will be written to the log file.  This
435 can be helpful if you are looking for a brace, paren, or bracket nesting error.
436 .Sp
437 Setting \fB\-g\fR also causes the logfile to be saved, so it is not necessary to
438 also include \fB\-log\fR.
439 .Sp
440 If no \fB\-g\fR flag is given, a value of 50 will be used, meaning that at least
441 every 50th line will be recorded in the logfile.  This helps prevent
442 excessively long log files.
443 .Sp
444 Setting a negative value of \f(CW\*(C`n\*(C'\fR is the same as not setting \fB\-g\fR at all.
445 .IP "\fB\-npro\fR  \fB\-\-noprofile\fR" 4
446 .IX Item "-npro  --noprofile"
447 Ignore any \fI.perltidyrc\fR command file.  Normally, perltidy looks first in
448 your current directory for a \fI.perltidyrc\fR file of parameters.  (The format
449 is described below).  If it finds one, it applies those options to the
450 initial default values, and then it applies any that have been defined
451 on the command line.  If no \fI.perltidyrc\fR file is found, it looks for one
452 in your home directory.
453 .Sp
454 If you set the \fB\-npro\fR flag, perltidy will not look for this file.
455 .IP "\fB\-pro=filename\fR or  \fB\-\-profile=filename\fR" 4
456 .IX Item "-pro=filename or  --profile=filename"
457 To simplify testing and switching .perltidyrc files, this command may be
458 used to specify a configuration file which will override the default
459 name of .perltidyrc.  There must not be a space on either side of the
460 \&'=' sign.  For example, the line
461 .Sp
462 .Vb 1
463 \&   perltidy \-pro=testcfg
464 .Ve
465 .Sp
466 would cause file \fItestcfg\fR to be used instead of the 
467 default \fI.perltidyrc\fR.
468 .Sp
469 A pathname begins with three dots, e.g. \*(L".../.perltidyrc\*(R", indicates that
470 the file should be searched for starting in the current directory and
471 working upwards. This makes it easier to have multiple projects each with
472 their own .perltidyrc in their root directories.
473 .IP "\fB\-opt\fR,   \fB\-\-show\-options\fR" 4
474 .IX Item "-opt,   --show-options"
475 Write a list of all options used to the \fI.LOG\fR file.  
476 Please see \fB\-\-dump\-options\fR for a simpler way to do this.
477 .IP "\fB\-f\fR,   \fB\-\-force\-read\-binary\fR" 4
478 .IX Item "-f,   --force-read-binary"
479 Force perltidy to process binary files.  To avoid producing excessive
480 error messages, perltidy skips files identified by the system as non-text.
481 However, valid perl scripts containing binary data may sometimes be identified
482 as non-text, and this flag forces perltidy to process them.
483 .SH "FORMATTING OPTIONS"
484 .IX Header "FORMATTING OPTIONS"
485 .SS "Basic Options"
486 .IX Subsection "Basic Options"
487 .IP "\fB\-\-notidy\fR" 4
488 .IX Item "--notidy"
489 This flag disables all formatting and causes the input to be copied unchanged
490 to the output except for possible changes in line ending characters and any
491 pre\- and post-filters.  This can be useful in conjunction with a hierarchical
492 set of \fI.perltidyrc\fR files to avoid unwanted code tidying.  See also
493 \&\*(L"Skipping Selected Sections of Code\*(R" for a way to avoid tidying specific
494 sections of code.
495 .IP "\fB\-i=n\fR,  \fB\-\-indent\-columns=n\fR" 4
496 .IX Item "-i=n,  --indent-columns=n"
497 Use n columns per indentation level (default n=4).
498 .IP "\fB\-l=n\fR, \fB\-\-maximum\-line\-length=n\fR" 4
499 .IX Item "-l=n, --maximum-line-length=n"
500 The default maximum line length is n=80 characters.  Perltidy will try
501 to find line break points to keep lines below this length. However, long
502 quotes and side comments may cause lines to exceed this length. 
503 Setting \fB\-l=0\fR is equivalent to setting \fB\-l=(a large number)\fR.
504 .IP "\fB\-vmll\fR, \fB\-\-variable\-maximum\-line\-length\fR" 4
505 .IX Item "-vmll, --variable-maximum-line-length"
506 A problem arises using a fixed maximum line length with very deeply nested code
507 and data structures because eventually the amount of leading whitespace used
508 for indicating indentation takes up most or all of the available line width,
509 leaving little or no space for the actual code or data.  One solution is to use
510 a vary long line length.  Another solution is to use the \fB\-vmll\fR flag, which
511 basically tells perltidy to ignore leading whitespace when measuring the line
512 length.
513 .Sp
514 To be precise, when the \fB\-vmll\fR parameter is set, the maximum line length of a
515 line of code will be M+L*I, where
516 .Sp
517 .Vb 3
518 \&      M is the value of \-\-maximum\-line\-length=M (\-l=M), default 80,
519 \&      I is the value of \-\-indent\-columns=I (\-i=I), default 4,
520 \&      L is the indentation level of the line of code
521 .Ve
522 .Sp
523 When this flag is set, the choice of breakpoints for a block of code should be
524 essentially independent of its nesting depth.  However, the absolute line
525 lengths, including leading whitespace, can still be arbitrarily large.  This
526 problem can be avoided by including the next parameter.
527 .Sp
528 The default is not to do this (\fB\-nvmll\fR).
529 .IP "\fB\-wc=n\fR, \fB\-\-whitespace\-cycle=n\fR" 4
530 .IX Item "-wc=n, --whitespace-cycle=n"
531 This flag also addresses problems with very deeply nested code and data
532 structures.  When the nesting depth exceeds the value \fBn\fR the leading
533 whitespace will be reduced and start at a depth of 1 again.  The result is that
534 blocks of code will shift back to the left rather than moving arbitrarily far
535 to the right.  This occurs cyclically to any depth.
536 .Sp
537 For example if one level of indentation equals 4 spaces (\fB\-i=4\fR, the default),
538 and one uses \fB\-wc=15\fR, then if the leading whitespace on a line exceeds about
539 4*15=60 spaces it will be reduced back to 4*1=4 spaces and continue increasing
540 from there.  If the whitespace never exceeds this limit the formatting remains
541 unchanged.
542 .Sp
543 The combination of \fB\-vmll\fR and \fB\-wc=n\fR provides a solution to the problem of
544 displaying arbitrarily deep data structures and code in a finite window,
545 although \fB\-wc=n\fR may of course be used without \fB\-vmll\fR.
546 .Sp
547 The default is not to use this, which can also be indicated using \fB\-wc=0\fR.
548 .IP "tabs" 4
549 .IX Item "tabs"
550 Using tab characters will almost certainly lead to future portability
551 and maintenance problems, so the default and recommendation is not to
552 use them.  For those who prefer tabs, however, there are two different
553 options.
554 .Sp
555 Except for possibly introducing tab indentation characters, as outlined
556 below, perltidy does not introduce any tab characters into your file,
557 and it removes any tabs from the code (unless requested not to do so
558 with \fB\-fws\fR).  If you have any tabs in your comments, quotes, or
559 here-documents, they will remain.
560 .RS 4
561 .IP "\fB\-et=n\fR,   \fB\-\-entab\-leading\-whitespace\fR" 4
562 .IX Item "-et=n,   --entab-leading-whitespace"
563 This flag causes each \fBn\fR initial space characters to be replaced by
564 one tab character.  Note that the integer \fBn\fR is completely independent
565 of the integer specified for indentation parameter, \fB\-i=n\fR.
566 .IP "\fB\-t\fR,   \fB\-\-tabs\fR" 4
567 .IX Item "-t,   --tabs"
568 This flag causes one leading tab character to be inserted for each level
569 of indentation.  Certain other features are incompatible with this
570 option, and if these options are also given, then a warning message will
571 be issued and this flag will be unset.  One example is the \fB\-lp\fR
572 option.
573 .IP "\fB\-dt=n\fR,   \fB\-\-default\-tabsize=n\fR" 4
574 .IX Item "-dt=n,   --default-tabsize=n"
575 If the first line of code passed to perltidy contains leading tabs but no
576 tab scheme is specified for the output stream then perltidy must guess how many
577 spaces correspond to each leading tab.  This number of spaces \fBn\fR
578 corresponding to each leading tab of the input stream may be specified with
579 \&\fB\-dt=n\fR.  The default is \fBn=8\fR.
580 .Sp
581 This flag has no effect if a tab scheme is specified for the output stream,
582 because then the input stream is assumed to use the same tab scheme and
583 indentation spaces as for the output stream (any other assumption would lead to
584 unstable editing).
585 .RE
586 .RS 4
587 .RE
588 .IP "\fB\-syn\fR,   \fB\-\-check\-syntax\fR" 4
589 .IX Item "-syn,   --check-syntax"
590 This flag causes perltidy to run \f(CW\*(C`perl \-c \-T\*(C'\fR to check syntax of input
591 and output.  (To change the flags passed to perl, see the next
592 item, \fB\-pscf\fR).  The results are written to the \fI.LOG\fR file, which
593 will be saved if an error is detected in the output script.  The output
594 script is not checked if the input script has a syntax error.  Perltidy
595 does its own checking, but this option employs perl to get a \*(L"second
596 opinion\*(R".
597 .Sp
598 If perl reports errors in the input file, they will not be reported in
599 the error output unless the \fB\-\-warning\-output\fR flag is given.
600 .Sp
601 The default is \fB\s-1NOT\s0\fR to do this type of syntax checking (although
602 perltidy will still do as much self-checking as possible).  The reason
603 is that it causes all code in \s-1BEGIN\s0 blocks to be executed, for all
604 modules being used, and this opens the door to security issues and
605 infinite loops when running perltidy.
606 .IP "\fB\-pscf=s\fR, \fB\-perl\-syntax\-check\-flags=s\fR" 4
607 .IX Item "-pscf=s, -perl-syntax-check-flags=s"
608 When perl is invoked to check syntax, the normal flags are \f(CW\*(C`\-c \-T\*(C'\fR.  In
609 addition, if the \fB\-x\fR flag is given to perltidy, then perl will also be
610 passed a \fB\-x\fR flag.  It should not normally be necessary to change
611 these flags, but it can be done with the \fB\-pscf=s\fR flag.  For example,
612 if the taint flag, \f(CW\*(C`\-T\*(C'\fR, is not wanted, the flag could be set to be just
613 \&\fB\-pscf=\-c\fR.
614 .Sp
615 Perltidy will pass your string to perl with the exception that it will
616 add a \fB\-c\fR and \fB\-x\fR if appropriate.  The \fI.LOG\fR file will show
617 exactly what flags were passed to perl.
618 .IP "\fB\-xs\fR,   \fB\-\-extended\-syntax\fR" 4
619 .IX Item "-xs,   --extended-syntax"
620 A problem with formatting Perl code is that some modules can introduce new
621 syntax.  This flag allows perltidy to handle certain common extensions
622 to the standard syntax without complaint.
623 .Sp
624 For example, without this flag a structure such as the following would generate
625 a syntax error and the braces would not be balanced:
626 .Sp
627 .Vb 3
628 \&    method deposit( Num $amount) {
629 \&        $self\->balance( $self\->balance + $amount );
630 \&    }
631 .Ve
632 .Sp
633 This flag is enabled by default but it can be deactivated with \fB\-nxs\fR.
634 Probably the only reason to deactivate this flag is to generate more diagnostic
635 messages when debugging a script.
636 .IP "\fB\-io\fR,   \fB\-\-indent\-only\fR" 4
637 .IX Item "-io,   --indent-only"
638 This flag is used to deactivate all whitespace and line break changes
639 within non-blank lines of code.
640 When it is in effect, the only change to the script will be
641 to the indentation and to the number of blank lines.
642 And any flags controlling whitespace and newlines will be ignored.  You
643 might want to use this if you are perfectly happy with your whitespace
644 and line breaks, and merely want perltidy to handle the indentation.
645 (This also speeds up perltidy by well over a factor of two, so it might be
646 useful when perltidy is merely being used to help find a brace error in
647 a large script).
648 .Sp
649 Setting this flag is equivalent to setting \fB\-\-freeze\-newlines\fR and
650 \&\fB\-\-freeze\-whitespace\fR.
651 .Sp
652 If you also want to keep your existing blank lines exactly
653 as they are, you can add \fB\-\-freeze\-blank\-lines\fR.
654 .Sp
655 With this option perltidy is still free to modify the indenting (and
656 outdenting) of code and comments as it normally would.  If you also want to
657 prevent long comment lines from being outdented, you can add either \fB\-noll\fR or
658 \&\fB\-l=0\fR.
659 .Sp
660 Setting this flag will prevent perltidy from doing any special operations on
661 closing side comments.  You may still delete all side comments however when
662 this flag is in effect.
663 .IP "\fB\-enc=s\fR,  \fB\-\-character\-encoding=s\fR" 4
664 .IX Item "-enc=s,  --character-encoding=s"
665 where \fBs\fR=\fBnone\fR or \fButf8\fR.  This flag tells perltidy the character encoding
666 of both the input and output character streams.  The value \fButf8\fR causes the
667 stream to be read and written as \s-1UTF\-8\s0.  The value \fBnone\fR causes the stream to
668 be processed without special encoding assumptions.  At present there is no
669 automatic detection of character encoding (even if there is a \f(CW\*(Aquse utf8\*(Aq\fR
670 statement in your code) so this flag must be set for streams encoded in \s-1UTF\-8\s0.
671 Incorrectly setting this parameter can cause data corruption, so please
672 carefully check the output.
673 .Sp
674 The default is \fBnone\fR.
675 .Sp
676 The abbreviations \fB\-utf8\fR or \fB\-UTF8\fR are equivalent to \fB\-enc=utf8\fR.
677 So to process a file named \fBfile.pl\fR which is encoded in \s-1UTF\-8\s0 you can use:
678 .Sp
679 .Vb 1
680 \&   perltidy \-utf8 file.pl
681 .Ve
682 .IP "\fB\-ole=s\fR,  \fB\-\-output\-line\-ending=s\fR" 4
683 .IX Item "-ole=s,  --output-line-ending=s"
684 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
685 to output line endings for a specific system.  Normally,
686 perltidy writes files with the line separator character of the host
687 system.  The \f(CW\*(C`win\*(C'\fR and \f(CW\*(C`dos\*(C'\fR flags have an identical result.
688 .IP "\fB\-ple\fR,  \fB\-\-preserve\-line\-endings\fR" 4
689 .IX Item "-ple,  --preserve-line-endings"
690 This flag tells perltidy to write its output files with the same line
691 endings as the input file, if possible.  It should work for
692 \&\fBdos\fR, \fBunix\fR, and \fBmac\fR line endings.  It will only work if perltidy
693 input comes from a filename (rather than stdin, for example).  If
694 perltidy has trouble determining the input file line ending, it will
695 revert to the default behavior of using the line ending of the host system.
696 .IP "\fB\-it=n\fR,   \fB\-\-iterations=n\fR" 4
697 .IX Item "-it=n,   --iterations=n"
698 This flag causes perltidy to do \fBn\fR complete iterations.  The reason for this
699 flag is that code beautification is an iterative process and in some
700 cases the output from perltidy can be different if it is applied a second time.
701 For most purposes the default of \fBn=1\fR should be satisfactory.  However \fBn=2\fR
702 can be useful when a major style change is being made, or when code is being
703 beautified on check-in to a source code control system.  It has been found to
704 be extremely rare for the output to change after 2 iterations.  If a value
705 \&\fBn\fR is greater than 2 is input then a convergence test will be used to stop
706 the iterations as soon as possible, almost always after 2 iterations.  See
707 the next item for a simplified iteration control.
708 .Sp
709 This flag has no effect when perltidy is used to generate html.
710 .IP "\fB\-conv\fR,   \fB\-\-converge\fR" 4
711 .IX Item "-conv,   --converge"
712 This flag is equivalent to \fB\-it=4\fR and is included to simplify iteration
713 control.  For all practical purposes one either does or does not want to be
714 sure that the output is converged, and there is no penalty to using a large
715 iteration limit since perltidy will check for convergence and stop iterating as
716 soon as possible.  The default is \fB\-nconv\fR (no convergence check).  Using
717 \&\fB\-conv\fR will approximately double run time since normally one extra iteration
718 is required to verify convergence.
719 .SS "Code Indentation Control"
720 .IX Subsection "Code Indentation Control"
721 .IP "\fB\-ci=n\fR, \fB\-\-continuation\-indentation=n\fR" 4
722 .IX Item "-ci=n, --continuation-indentation=n"
723 Continuation indentation is extra indentation spaces applied when
724 a long line is broken.  The default is n=2, illustrated here:
725 .Sp
726 .Vb 2
727 \& my $level =   # \-ci=2      
728 \&   ( $max_index_to_go >= 0 ) ? $levels_to_go[0] : $last_output_level;
729 .Ve
730 .Sp
731 The same example, with n=0, is a little harder to read:
732 .Sp
733 .Vb 2
734 \& my $level =   # \-ci=0    
735 \& ( $max_index_to_go >= 0 ) ? $levels_to_go[0] : $last_output_level;
736 .Ve
737 .Sp
738 The value given to \fB\-ci\fR is also used by some commands when a small
739 space is required.  Examples are commands for outdenting labels,
740 \&\fB\-ola\fR, and control keywords, \fB\-okw\fR.
741 .Sp
742 When default values are not used, it is suggested that the value \fBn\fR
743 given with \fB\-ci=n\fR be no more than about one-half of the number of
744 spaces assigned to a full indentation level on the \fB\-i=n\fR command.
745 .IP "\fB\-sil=n\fR \fB\-\-starting\-indentation\-level=n\fR" 4
746 .IX Item "-sil=n --starting-indentation-level=n"
747 By default, perltidy examines the input file and tries to determine the
748 starting indentation level.  While it is often zero, it may not be
749 zero for a code snippet being sent from an editing session.
750 .Sp
751 To guess the starting indentation level perltidy simply assumes that
752 indentation scheme used to create the code snippet is the same as is being used
753 for the current perltidy process.  This is the only sensible guess that can be
754 made.  It should be correct if this is true, but otherwise it probably won't.
755 For example, if the input script was written with \-i=2 and the current peltidy
756 flags have \-i=4, the wrong initial indentation will be guessed for a code
757 snippet which has non-zero initial indentation. Likewise, if an entabbing
758 scheme is used in the input script and not in the current process then the
759 guessed indentation will be wrong.
760 .Sp
761 If the default method does not work correctly, or you want to change the
762 starting level, use \fB\-sil=n\fR, to force the starting level to be n.
763 .IP "List indentation using \fB\-lp\fR, \fB\-\-line\-up\-parentheses\fR" 4
764 .IX Item "List indentation using -lp, --line-up-parentheses"
765 By default, perltidy indents lists with 4 spaces, or whatever value
766 is specified with \fB\-i=n\fR.  Here is a small list formatted in this way:
767 .Sp
768 .Vb 5
769 \&    # perltidy (default)
770 \&    @month_of_year = (
771 \&        \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq,
772 \&        \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq, \*(AqNov\*(Aq, \*(AqDec\*(Aq
773 \&    );
774 .Ve
775 .Sp
776 Use the \fB\-lp\fR flag to add extra indentation to cause the data to begin
777 past the opening parentheses of a sub call or list, or opening square
778 bracket of an anonymous array, or opening curly brace of an anonymous
779 hash.  With this option, the above list would become:
780 .Sp
781 .Vb 5
782 \&    # perltidy \-lp
783 \&    @month_of_year = (
784 \&                       \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq,
785 \&                       \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq, \*(AqNov\*(Aq, \*(AqDec\*(Aq
786 \&    );
787 .Ve
788 .Sp
789 If the available line length (see \fB\-l=n\fR ) does not permit this much 
790 space, perltidy will use less.   For alternate placement of the
791 closing paren, see the next section.
792 .Sp
793 This option has no effect on code \s-1BLOCKS\s0, such as if/then/else blocks,
794 which always use whatever is specified with \fB\-i=n\fR.  Also, the
795 existence of line breaks and/or block comments between the opening and
796 closing parens may cause perltidy to temporarily revert to its default
797 method.
798 .Sp
799 Note: The \fB\-lp\fR option may not be used together with the \fB\-t\fR tabs option.
800 It may, however, be used with the \fB\-et=n\fR tab method.
801 .Sp
802 In addition, any parameter which significantly restricts the ability of
803 perltidy to choose newlines will conflict with \fB\-lp\fR and will cause
804 \&\fB\-lp\fR to be deactivated.  These include \fB\-io\fR, \fB\-fnl\fR, \fB\-nanl\fR, and
805 \&\fB\-ndnl\fR.  The reason is that the \fB\-lp\fR indentation style can require
806 the careful coordination of an arbitrary number of break points in
807 hierarchical lists, and these flags may prevent that.
808 .IP "\fB\-cti=n\fR, \fB\-\-closing\-token\-indentation\fR" 4
809 .IX Item "-cti=n, --closing-token-indentation"
810 The \fB\-cti=n\fR flag controls the indentation of a line beginning with 
811 a \f(CW\*(C`)\*(C'\fR, \f(CW\*(C`]\*(C'\fR, or a non-block \f(CW\*(C`}\*(C'\fR.  Such a line receives:
812 .Sp
813 .Vb 6
814 \& \-cti = 0 no extra indentation (default)
815 \& \-cti = 1 extra indentation such that the closing token
816 \&        aligns with its opening token.
817 \& \-cti = 2 one extra indentation level if the line looks like:
818 \&        );  or  ];  or  };
819 \& \-cti = 3 one extra indentation level always
820 .Ve
821 .Sp
822 The flags \fB\-cti=1\fR and \fB\-cti=2\fR work well with the \fB\-lp\fR flag (previous
823 section).
824 .Sp
825 .Vb 5
826 \&    # perltidy \-lp \-cti=1
827 \&    @month_of_year = (
828 \&                       \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq,
829 \&                       \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq, \*(AqNov\*(Aq, \*(AqDec\*(Aq
830 \&                     );
831 \&
832 \&    # perltidy \-lp \-cti=2
833 \&    @month_of_year = (
834 \&                       \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq,
835 \&                       \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq, \*(AqNov\*(Aq, \*(AqDec\*(Aq
836 \&                       );
837 .Ve
838 .Sp
839 These flags are merely hints to the formatter and they may not always be
840 followed.  In particular, if \-lp is not being used, the indentation for
841 \&\fBcti=1\fR is constrained to be no more than one indentation level.
842 .Sp
843 If desired, this control can be applied independently to each of the
844 closing container token types.  In fact, \fB\-cti=n\fR is merely an
845 abbreviation for \fB\-cpi=n \-csbi=n \-cbi=n\fR, where:  
846 \&\fB\-cpi\fR or \fB\-\-closing\-paren\-indentation\fR controls \fB)\fR's,
847 \&\fB\-csbi\fR or \fB\-\-closing\-square\-bracket\-indentation\fR controls \fB]\fR's, 
848 \&\fB\-cbi\fR or \fB\-\-closing\-brace\-indentation\fR controls non-block \fB}\fR's.
849 .IP "\fB\-icp\fR, \fB\-\-indent\-closing\-paren\fR" 4
850 .IX Item "-icp, --indent-closing-paren"
851 The \fB\-icp\fR flag is equivalent to
852 \&\fB\-cti=2\fR, described in the previous section.  The \fB\-nicp\fR flag is
853 equivalent \fB\-cti=0\fR.  They are included for backwards compatibility.
854 .IP "\fB\-icb\fR, \fB\-\-indent\-closing\-brace\fR" 4
855 .IX Item "-icb, --indent-closing-brace"
856 The \fB\-icb\fR option gives one extra level of indentation to a brace which
857 terminates a code block .  For example,
858 .Sp
859 .Vb 6
860 \&        if ($task) {
861 \&            yyy();
862 \&            }    # \-icb
863 \&        else {
864 \&            zzz();
865 \&            }
866 .Ve
867 .Sp
868 The default is not to do this, indicated by \fB\-nicb\fR.
869 .IP "\fB\-olq\fR, \fB\-\-outdent\-long\-quotes\fR" 4
870 .IX Item "-olq, --outdent-long-quotes"
871 When \fB\-olq\fR is set, lines which is a quoted string longer than the
872 value \fBmaximum-line-length\fR will have their indentation removed to make
873 them more readable.  This is the default.  To prevent such out-denting,
874 use \fB\-nolq\fR or \fB\-\-nooutdent\-long\-lines\fR.
875 .IP "\fB\-oll\fR, \fB\-\-outdent\-long\-lines\fR" 4
876 .IX Item "-oll, --outdent-long-lines"
877 This command is equivalent to \fB\-\-outdent\-long\-quotes\fR and
878 \&\fB\-\-outdent\-long\-comments\fR, and it is included for compatibility with previous
879 versions of perltidy.  The negation of this also works, \fB\-noll\fR or
880 \&\fB\-\-nooutdent\-long\-lines\fR, and is equivalent to setting \fB\-nolq\fR and \fB\-nolc\fR.
881 .IP "Outdenting Labels: \fB\-ola\fR,  \fB\-\-outdent\-labels\fR" 4
882 .IX Item "Outdenting Labels: -ola,  --outdent-labels"
883 This command will cause labels to be outdented by 2 spaces (or whatever \fB\-ci\fR
884 has been set to), if possible.  This is the default.  For example:
885 .Sp
886 .Vb 6
887 \&        my $i;
888 \&      LOOP: while ( $i = <FOTOS> ) {
889 \&            chomp($i);
890 \&            next unless $i;
891 \&            fixit($i);
892 \&        }
893 .Ve
894 .Sp
895 Use \fB\-nola\fR to not outdent labels.
896 .IP "Outdenting Keywords" 4
897 .IX Item "Outdenting Keywords"
898 .RS 4
899 .PD 0
900 .IP "\fB\-okw\fR,  \fB\-\-outdent\-keywords\fR" 4
901 .IX Item "-okw,  --outdent-keywords"
902 .PD
903 The command \fB\-okw\fR will cause certain leading control keywords to
904 be outdented by 2 spaces (or whatever \fB\-ci\fR has been set to), if
905 possible.  By default, these keywords are \f(CW\*(C`redo\*(C'\fR, \f(CW\*(C`next\*(C'\fR, \f(CW\*(C`last\*(C'\fR,
906 \&\f(CW\*(C`goto\*(C'\fR, and \f(CW\*(C`return\*(C'\fR.  The intention is to make these control keywords
907 easier to see.  To change this list of keywords being outdented, see
908 the next section.
909 .Sp
910 For example, using \f(CW\*(C`perltidy \-okw\*(C'\fR on the previous example gives:
911 .Sp
912 .Vb 6
913 \&        my $i;
914 \&      LOOP: while ( $i = <FOTOS> ) {
915 \&            chomp($i);
916 \&          next unless $i;
917 \&            fixit($i);
918 \&        }
919 .Ve
920 .Sp
921 The default is not to do this.
922 .IP "Specifying Outdented Keywords: \fB\-okwl=string\fR,  \fB\-\-outdent\-keyword\-list=string\fR" 4
923 .IX Item "Specifying Outdented Keywords: -okwl=string,  --outdent-keyword-list=string"
924 This command can be used to change the keywords which are outdented with
925 the \fB\-okw\fR command.  The parameter \fBstring\fR is a required list of perl
926 keywords, which should be placed in quotes if there are more than one.
927 By itself, it does not cause any outdenting to occur, so the \fB\-okw\fR
928 command is still required.
929 .Sp
930 For example, the commands \f(CW\*(C`\-okwl="next last redo goto" \-okw\*(C'\fR will cause
931 those four keywords to be outdented.  It is probably simplest to place
932 any \fB\-okwl\fR command in a \fI.perltidyrc\fR file.
933 .RE
934 .RS 4
935 .RE
936 .SS "Whitespace Control"
937 .IX Subsection "Whitespace Control"
938 Whitespace refers to the blank space between variables, operators,
939 and other code tokens.
940 .IP "\fB\-fws\fR,  \fB\-\-freeze\-whitespace\fR" 4
941 .IX Item "-fws,  --freeze-whitespace"
942 This flag causes your original whitespace to remain unchanged, and
943 causes the rest of the whitespace commands in this section, the
944 Code Indentation section, and
945 the Comment Control section to be ignored.
946 .IP "Tightness of curly braces, parentheses, and square brackets." 4
947 .IX Item "Tightness of curly braces, parentheses, and square brackets."
948 Here the term \*(L"tightness\*(R" will mean the closeness with which
949 pairs of enclosing tokens, such as parentheses, contain the quantities
950 within.  A numerical value of 0, 1, or 2 defines the tightness, with
951 0 being least tight and 2 being most tight.  Spaces within containers
952 are always symmetric, so if there is a space after a \f(CW\*(C`(\*(C'\fR then there
953 will be a space before the corresponding \f(CW\*(C`)\*(C'\fR.
954 .Sp
955 The \fB\-pt=n\fR or \fB\-\-paren\-tightness=n\fR parameter controls the space within
956 parens.  The example below shows the effect of the three possible
957 values, 0, 1, and 2:
958 .Sp
959 .Vb 3
960 \& if ( ( my $len_tab = length( $tabstr ) ) > 0 ) {  # \-pt=0
961 \& if ( ( my $len_tab = length($tabstr) ) > 0 ) {    # \-pt=1 (default)
962 \& if ((my $len_tab = length($tabstr)) > 0) {        # \-pt=2
963 .Ve
964 .Sp
965 When n is 0, there is always a space to the right of a '(' and to the left
966 of a ')'.  For n=2 there is never a space.  For n=1, the default, there
967 is a space unless the quantity within the parens is a single token, such
968 as an identifier or quoted string.
969 .Sp
970 Likewise, the parameter \fB\-sbt=n\fR or \fB\-\-square\-bracket\-tightness=n\fR
971 controls the space within square brackets, as illustrated below.
972 .Sp
973 .Vb 3
974 \& $width = $col[ $j + $k ] \- $col[ $j ];  # \-sbt=0
975 \& $width = $col[ $j + $k ] \- $col[$j];    # \-sbt=1 (default)
976 \& $width = $col[$j + $k] \- $col[$j];      # \-sbt=2
977 .Ve
978 .Sp
979 Curly braces which do not contain code blocks are controlled by
980 the parameter \fB\-bt=n\fR or \fB\-\-brace\-tightness=n\fR.
981 .Sp
982 .Vb 3
983 \& $obj\->{ $parsed_sql\->{ \*(Aqtable\*(Aq }[0] };    # \-bt=0
984 \& $obj\->{ $parsed_sql\->{\*(Aqtable\*(Aq}[0] };      # \-bt=1 (default)
985 \& $obj\->{$parsed_sql\->{\*(Aqtable\*(Aq}[0]};        # \-bt=2
986 .Ve
987 .Sp
988 And finally, curly braces which contain blocks of code are controlled by the
989 parameter \fB\-bbt=n\fR or \fB\-\-block\-brace\-tightness=n\fR as illustrated in the
990 example below.
991 .Sp
992 .Vb 3
993 \& %bf = map { $_ => \-M $_ } grep { /\e.deb$/ } dirents \*(Aq.\*(Aq; # \-bbt=0 (default)
994 \& %bf = map { $_ => \-M $_ } grep {/\e.deb$/} dirents \*(Aq.\*(Aq;   # \-bbt=1
995 \& %bf = map {$_ => \-M $_} grep {/\e.deb$/} dirents \*(Aq.\*(Aq;     # \-bbt=2
996 .Ve
997 .Sp
998 To simplify input in the case that all of the tightness flags have the same
999 value <n>, the parameter <\-act=n> or \fB\-\-all\-containers\-tightness=n\fR is an
1000 abbreviation for the combination <\-pt=n \-sbt=n \-bt=n \-bbt=n>.
1001 .IP "\fB\-tso\fR,   \fB\-\-tight\-secret\-operators\fR" 4
1002 .IX Item "-tso,   --tight-secret-operators"
1003 The flag \fB\-tso\fR causes certain perl token sequences (secret operators)
1004 which might be considered to be a single operator to be formatted \*(L"tightly\*(R"
1005 (without spaces).  The operators currently modified by this flag are:
1006 .Sp
1007 .Vb 1
1008 \&     0+  +0  ()x!! ~~<>  ,=>   =( )=
1009 .Ve
1010 .Sp
1011 For example the sequence \fB0 +\fR,  which converts a string to a number,
1012 would be formatted without a space: \fB0+\fR when the \fB\-tso\fR flag is set.  This
1013 flag is off by default.
1014 .IP "\fB\-sts\fR,   \fB\-\-space\-terminal\-semicolon\fR" 4
1015 .IX Item "-sts,   --space-terminal-semicolon"
1016 Some programmers prefer a space before all terminal semicolons.  The
1017 default is for no such space, and is indicated with \fB\-nsts\fR or
1018 \&\fB\-\-nospace\-terminal\-semicolon\fR.
1019 .Sp
1020 .Vb 2
1021 \&        $i = 1 ;     #  \-sts
1022 \&        $i = 1;      #  \-nsts   (default)
1023 .Ve
1024 .IP "\fB\-sfs\fR,   \fB\-\-space\-for\-semicolon\fR" 4
1025 .IX Item "-sfs,   --space-for-semicolon"
1026 Semicolons within \fBfor\fR loops may sometimes be hard to see,
1027 particularly when commas are also present.  This option places spaces on
1028 both sides of these special semicolons, and is the default.  Use
1029 \&\fB\-nsfs\fR or \fB\-\-nospace\-for\-semicolon\fR to deactivate it.
1030 .Sp
1031 .Vb 2
1032 \& for ( @a = @$ap, $u = shift @a ; @a ; $u = $v ) {  # \-sfs (default)
1033 \& for ( @a = @$ap, $u = shift @a; @a; $u = $v ) {    # \-nsfs
1034 .Ve
1035 .IP "\fB\-asc\fR,  \fB\-\-add\-semicolons\fR" 4
1036 .IX Item "-asc,  --add-semicolons"
1037 Setting \fB\-asc\fR allows perltidy to add any missing optional semicolon at the end 
1038 of a line which is followed by a closing curly brace on the next line.  This
1039 is the default, and may be deactivated with \fB\-nasc\fR or \fB\-\-noadd\-semicolons\fR.
1040 .IP "\fB\-dsm\fR,  \fB\-\-delete\-semicolons\fR" 4
1041 .IX Item "-dsm,  --delete-semicolons"
1042 Setting \fB\-dsm\fR allows perltidy to delete extra semicolons which are
1043 simply empty statements.  This is the default, and may be deactivated
1044 with \fB\-ndsm\fR or \fB\-\-nodelete\-semicolons\fR.  (Such semicolons are not
1045 deleted, however, if they would promote a side comment to a block
1046 comment).
1047 .IP "\fB\-aws\fR,  \fB\-\-add\-whitespace\fR" 4
1048 .IX Item "-aws,  --add-whitespace"
1049 Setting this option allows perltidy to add certain whitespace improve
1050 code readability.  This is the default. If you do not want any
1051 whitespace added, but are willing to have some whitespace deleted, use
1052 \&\fB\-naws\fR.  (Use \fB\-fws\fR to leave whitespace completely unchanged).
1053 .IP "\fB\-dws\fR,  \fB\-\-delete\-old\-whitespace\fR" 4
1054 .IX Item "-dws,  --delete-old-whitespace"
1055 Setting this option allows perltidy to remove some old whitespace
1056 between characters, if necessary.  This is the default.  If you
1057 do not want any old whitespace removed, use \fB\-ndws\fR or
1058 \&\fB\-\-nodelete\-old\-whitespace\fR.
1059 .IP "Detailed whitespace controls around tokens" 4
1060 .IX Item "Detailed whitespace controls around tokens"
1061 For those who want more detailed control over the whitespace around
1062 tokens, there are four parameters which can directly modify the default
1063 whitespace rules built into perltidy for any token.  They are:
1064 .Sp
1065 \&\fB\-wls=s\fR or \fB\-\-want\-left\-space=s\fR,
1066 .Sp
1067 \&\fB\-nwls=s\fR or \fB\-\-nowant\-left\-space=s\fR,
1068 .Sp
1069 \&\fB\-wrs=s\fR or \fB\-\-want\-right\-space=s\fR,
1070 .Sp
1071 \&\fB\-nwrs=s\fR or \fB\-\-nowant\-right\-space=s\fR.
1072 .Sp
1073 These parameters are each followed by a quoted string, \fBs\fR, containing a
1074 list of token types.  No more than one of each of these parameters
1075 should be specified, because repeating a command-line parameter
1076 always overwrites the previous one before perltidy ever sees it.
1077 .Sp
1078 To illustrate how these are used, suppose it is desired that there be no
1079 space on either side of the token types \fB= + \- / *\fR.  The following two
1080 parameters would specify this desire:
1081 .Sp
1082 .Vb 1
1083 \&  \-nwls="= + \- / *"    \-nwrs="= + \- / *"
1084 .Ve
1085 .Sp
1086 (Note that the token types are in quotes, and that they are separated by
1087 spaces).  With these modified whitespace rules, the following line of math:
1088 .Sp
1089 .Vb 1
1090 \&  $root = \-$b + sqrt( $b * $b \- 4. * $a * $c ) / ( 2. * $a );
1091 .Ve
1092 .Sp
1093 becomes this:
1094 .Sp
1095 .Vb 1
1096 \&  $root=\-$b+sqrt( $b*$b\-4.*$a*$c )/( 2.*$a );
1097 .Ve
1098 .Sp
1099 These parameters should be considered to be hints to perltidy rather
1100 than fixed rules, because perltidy must try to resolve conflicts that
1101 arise between them and all of the other rules that it uses.  One
1102 conflict that can arise is if, between two tokens, the left token wants
1103 a space and the right one doesn't.  In this case, the token not wanting
1104 a space takes priority.
1105 .Sp
1106 It is necessary to have a list of all token types in order to create
1107 this type of input.  Such a list can be obtained by the command
1108 \&\fB\-\-dump\-token\-types\fR.  Also try the \fB\-D\fR flag on a short snippet of code
1109 and look at the .DEBUG file to see the tokenization.
1110 .Sp
1111 \&\fB\s-1WARNING\s0\fR Be sure to put these tokens in quotes to avoid having them
1112 misinterpreted by your command shell.
1113 .IP "Space between specific keywords and opening paren" 4
1114 .IX Item "Space between specific keywords and opening paren"
1115 When an opening paren follows a Perl keyword, no space is introduced after the
1116 keyword, unless it is (by default) one of these:
1117 .Sp
1118 .Vb 2
1119 \&   my local our and or eq ne if else elsif until unless 
1120 \&   while for foreach return switch case given when
1121 .Ve
1122 .Sp
1123 These defaults can be modified with two commands:
1124 .Sp
1125 \&\fB\-sak=s\fR  or \fB\-\-space\-after\-keyword=s\fR  adds keywords.
1126 .Sp
1127 \&\fB\-nsak=s\fR  or \fB\-\-nospace\-after\-keyword=s\fR  removes keywords.
1128 .Sp
1129 where \fBs\fR is a list of keywords (in quotes if necessary).  For example,
1130 .Sp
1131 .Vb 2
1132 \&  my ( $a, $b, $c ) = @_;    # default
1133 \&  my( $a, $b, $c ) = @_;     # \-nsak="my local our"
1134 .Ve
1135 .Sp
1136 The abbreviation \fB\-nsak='*'\fR is equivalent to including all of the
1137 keywords in the above list.
1138 .Sp
1139 When both \fB\-nsak=s\fR and \fB\-sak=s\fR commands are included, the \fB\-nsak=s\fR
1140 command is executed first.  For example, to have space after only the
1141 keywords (my, local, our) you could use \fB\-nsak=\*(L"*\*(R" \-sak=\*(L"my local our\*(R"\fR.
1142 .Sp
1143 To put a space after all keywords, see the next item.
1144 .IP "Space between all keywords and opening parens" 4
1145 .IX Item "Space between all keywords and opening parens"
1146 When an opening paren follows a function or keyword, no space is introduced
1147 after the keyword except for the keywords noted in the previous item.  To
1148 always put a space between a function or keyword and its opening paren,
1149 use the command:
1150 .Sp
1151 \&\fB\-skp\fR  or \fB\-\-space\-keyword\-paren\fR
1152 .Sp
1153 You will probably also want to use the flag \fB\-sfp\fR (next item) too.
1154 .IP "Space between all function names and opening parens" 4
1155 .IX Item "Space between all function names and opening parens"
1156 When an opening paren follows a function the default is not to introduce
1157 a space.  To cause a space to be introduced use:
1158 .Sp
1159 \&\fB\-sfp\fR  or \fB\-\-space\-function\-paren\fR
1160 .Sp
1161 .Vb 2
1162 \&  myfunc( $a, $b, $c );    # default 
1163 \&  myfunc ( $a, $b, $c );   # \-sfp
1164 .Ve
1165 .Sp
1166 You will probably also want to use the flag \fB\-skp\fR (previous item) too.
1167 .ie n .IP "Trimming whitespace around ""qw"" quotes" 4
1168 .el .IP "Trimming whitespace around \f(CWqw\fR quotes" 4
1169 .IX Item "Trimming whitespace around qw quotes"
1170 \&\fB\-tqw\fR or \fB\-\-trim\-qw\fR provide the default behavior of trimming
1171 spaces around multi-line \f(CW\*(C`qw\*(C'\fR quotes and indenting them appropriately.
1172 .Sp
1173 \&\fB\-ntqw\fR or \fB\-\-notrim\-qw\fR cause leading and trailing whitespace around
1174 multi-line \f(CW\*(C`qw\*(C'\fR quotes to be left unchanged.  This option will not
1175 normally be necessary, but was added for testing purposes, because in
1176 some versions of perl, trimming \f(CW\*(C`qw\*(C'\fR quotes changes the syntax tree.
1177 .IP "Trimming trailing whitespace from lines of \s-1POD\s0" 4
1178 .IX Item "Trimming trailing whitespace from lines of POD"
1179 \&\fB\-trp\fR or \fB\-\-trim\-pod\fR will remove trailing whitespace from lines of \s-1POD\s0.
1180 The default is not to do this.
1181 .SS "Comment Controls"
1182 .IX Subsection "Comment Controls"
1183 Perltidy has a number of ways to control the appearance of both block comments
1184 and side comments.  The term \fBblock comment\fR here refers to a full-line
1185 comment, whereas \fBside comment\fR will refer to a comment which appears on a
1186 line to the right of some code.
1187 .IP "\fB\-ibc\fR,  \fB\-\-indent\-block\-comments\fR" 4
1188 .IX Item "-ibc,  --indent-block-comments"
1189 Block comments normally look best when they are indented to the same
1190 level as the code which follows them.  This is the default behavior, but
1191 you may use \fB\-nibc\fR to keep block comments left-justified.  Here is an
1192 example:
1193 .Sp
1194 .Vb 2
1195 \&             # this comment is indented      (\-ibc, default)
1196 \&             if ($task) { yyy(); }
1197 .Ve
1198 .Sp
1199 The alternative is \fB\-nibc\fR:
1200 .Sp
1201 .Vb 2
1202 \& # this comment is not indented              (\-nibc)
1203 \&             if ($task) { yyy(); }
1204 .Ve
1205 .Sp
1206 See also the next item, \fB\-isbc\fR, as well as \fB\-sbc\fR, for other ways to
1207 have some indented and some outdented block comments.
1208 .IP "\fB\-isbc\fR,  \fB\-\-indent\-spaced\-block\-comments\fR" 4
1209 .IX Item "-isbc,  --indent-spaced-block-comments"
1210 If there is no leading space on the line, then the comment will not be
1211 indented, and otherwise it may be.
1212 .Sp
1213 If both \fB\-ibc\fR and \fB\-isbc\fR are set, then \fB\-isbc\fR takes priority.
1214 .IP "\fB\-olc\fR, \fB\-\-outdent\-long\-comments\fR" 4
1215 .IX Item "-olc, --outdent-long-comments"
1216 When \fB\-olc\fR is set, lines which are full-line (block) comments longer
1217 than the value \fBmaximum-line-length\fR will have their indentation
1218 removed.  This is the default; use \fB\-nolc\fR to prevent outdenting.
1219 .IP "\fB\-msc=n\fR,  \fB\-\-minimum\-space\-to\-comment=n\fR" 4
1220 .IX Item "-msc=n,  --minimum-space-to-comment=n"
1221 Side comments look best when lined up several spaces to the right of
1222 code.  Perltidy will try to keep comments at least n spaces to the
1223 right.  The default is n=4 spaces.
1224 .IP "\fB\-fpsc=n\fR,  \fB\-\-fixed\-position\-side\-comment=n\fR" 4
1225 .IX Item "-fpsc=n,  --fixed-position-side-comment=n"
1226 This parameter tells perltidy to line up side comments in column number \fBn\fR
1227 whenever possible.  The default, n=0, will not do this.
1228 .IP "\fB\-iscl\fR,  \fB\-\-ignore\-side\-comment\-lengths\fR" 4
1229 .IX Item "-iscl,  --ignore-side-comment-lengths"
1230 This parameter causes perltidy to ignore the length of side comments when
1231 setting line breaks.  The default, \fB\-niscl\fR, is to include the length of 
1232 side comments when breaking lines to stay within the length prescribed
1233 by the \fB\-l=n\fR maximum line length parameter.  For example, the following
1234 long single line would remain intact with \-l=80 and \-iscl:
1235 .Sp
1236 .Vb 2
1237 \&     perltidy \-l=80 \-iscl
1238 \&        $vmsfile =~ s/;[\ed\e\-]*$//; # Clip off version number; we can use a newer version as well
1239 .Ve
1240 .Sp
1241 whereas without the \-iscl flag the line will be broken:
1242 .Sp
1243 .Vb 3
1244 \&     perltidy \-l=80
1245 \&        $vmsfile =~ s/;[\ed\e\-]*$//
1246 \&          ;    # Clip off version number; we can use a newer version as well
1247 .Ve
1248 .IP "\fB\-hsc\fR, \fB\-\-hanging\-side\-comments\fR" 4
1249 .IX Item "-hsc, --hanging-side-comments"
1250 By default, perltidy tries to identify and align \*(L"hanging side
1251 comments\*(R", which are something like this:
1252 .Sp
1253 .Vb 3
1254 \&        my $IGNORE = 0;    # This is a side comment
1255 \&                           # This is a hanging side comment
1256 \&                           # And so is this
1257 .Ve
1258 .Sp
1259 A comment is considered to be a hanging side comment if (1) it immediately
1260 follows a line with a side comment, or another hanging side comment, and
1261 (2) there is some leading whitespace on the line.
1262 To deactivate this feature, use \fB\-nhsc\fR or \fB\-\-nohanging\-side\-comments\fR.  
1263 If block comments are preceded by a blank line, or have no leading
1264 whitespace, they will not be mistaken as hanging side comments.
1265 .IP "Closing Side Comments" 4
1266 .IX Item "Closing Side Comments"
1267 A closing side comment is a special comment which perltidy can
1268 automatically create and place after the closing brace of a code block.
1269 They can be useful for code maintenance and debugging.  The command
1270 \&\fB\-csc\fR (or \fB\-\-closing\-side\-comments\fR) adds or updates closing side
1271 comments.  For example, here is a small code snippet
1272 .Sp
1273 .Vb 8
1274 \&        sub message {
1275 \&            if ( !defined( $_[0] ) ) {
1276 \&                print("Hello, World\en");
1277 \&            }
1278 \&            else {
1279 \&                print( $_[0], "\en" );
1280 \&            }
1281 \&        }
1282 .Ve
1283 .Sp
1284 And here is the result of processing with \f(CW\*(C`perltidy \-csc\*(C'\fR:
1285 .Sp
1286 .Vb 8
1287 \&        sub message {
1288 \&            if ( !defined( $_[0] ) ) {
1289 \&                print("Hello, World\en");
1290 \&            }
1291 \&            else {
1292 \&                print( $_[0], "\en" );
1293 \&            }
1294 \&        } ## end sub message
1295 .Ve
1296 .Sp
1297 A closing side comment was added for \f(CW\*(C`sub message\*(C'\fR in this case, but not
1298 for the \f(CW\*(C`if\*(C'\fR and \f(CW\*(C`else\*(C'\fR blocks, because they were below the 6 line
1299 cutoff limit for adding closing side comments.  This limit may be
1300 changed with the \fB\-csci\fR command, described below.
1301 .Sp
1302 The command \fB\-dcsc\fR (or \fB\-\-delete\-closing\-side\-comments\fR) reverses this 
1303 process and removes these comments.
1304 .Sp
1305 Several commands are available to modify the behavior of these two basic
1306 commands, \fB\-csc\fR and \fB\-dcsc\fR:
1307 .RS 4
1308 .IP "\fB\-csci=n\fR, or \fB\-\-closing\-side\-comment\-interval=n\fR" 4
1309 .IX Item "-csci=n, or --closing-side-comment-interval=n"
1310 where \f(CW\*(C`n\*(C'\fR is the minimum number of lines that a block must have in
1311 order for a closing side comment to be added.  The default value is
1312 \&\f(CW\*(C`n=6\*(C'\fR.  To illustrate:
1313 .Sp
1314 .Vb 9
1315 \&        # perltidy \-csci=2 \-csc
1316 \&        sub message {
1317 \&            if ( !defined( $_[0] ) ) {
1318 \&                print("Hello, World\en");
1319 \&            } ## end if ( !defined( $_[0] ))
1320 \&            else {
1321 \&                print( $_[0], "\en" );
1322 \&            } ## end else [ if ( !defined( $_[0] ))
1323 \&        } ## end sub message
1324 .Ve
1325 .Sp
1326 Now the \f(CW\*(C`if\*(C'\fR and \f(CW\*(C`else\*(C'\fR blocks are commented.  However, now this has
1327 become very cluttered.
1328 .IP "\fB\-cscp=string\fR, or \fB\-\-closing\-side\-comment\-prefix=string\fR" 4
1329 .IX Item "-cscp=string, or --closing-side-comment-prefix=string"
1330 where string is the prefix used before the name of the block type.  The
1331 default prefix, shown above, is \f(CW\*(C`## end\*(C'\fR.  This string will be added to
1332 closing side comments, and it will also be used to recognize them in
1333 order to update, delete, and format them.  Any comment identified as a
1334 closing side comment will be placed just a single space to the right of
1335 its closing brace.
1336 .IP "\fB\-cscl=string\fR, or \fB\-\-closing\-side\-comment\-list\-string\fR" 4
1337 .IX Item "-cscl=string, or --closing-side-comment-list-string"
1338 where \f(CW\*(C`string\*(C'\fR is a list of block types to be tagged with closing side
1339 comments.  By default, all code block types preceded by a keyword or
1340 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
1341 command changes the default list to be any selected block types; see
1342 \&\*(L"Specifying Block Types\*(R".
1343 For example, the following command
1344 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
1345 affected by any \fB\-csc\fR or \fB\-dcsc\fR operation:
1346 .Sp
1347 .Vb 1
1348 \&   \-cscl="sub : BEGIN END"
1349 .Ve
1350 .IP "\fB\-csct=n\fR, or \fB\-\-closing\-side\-comment\-maximum\-text=n\fR" 4
1351 .IX Item "-csct=n, or --closing-side-comment-maximum-text=n"
1352 The text appended to certain block types, such as an \f(CW\*(C`if\*(C'\fR block, is
1353 whatever lies between the keyword introducing the block, such as \f(CW\*(C`if\*(C'\fR,
1354 and the opening brace.  Since this might be too much text for a side
1355 comment, there needs to be a limit, and that is the purpose of this
1356 parameter.  The default value is \f(CW\*(C`n=20\*(C'\fR, meaning that no additional
1357 tokens will be appended to this text after its length reaches 20
1358 characters.  Omitted text is indicated with \f(CW\*(C`...\*(C'\fR.  (Tokens, including
1359 sub names, are never truncated, however, so actual lengths may exceed
1360 this).  To illustrate, in the above example, the appended text of the
1361 first block is \f(CW\*(C` ( !defined( $_[0] )...\*(C'\fR.  The existing limit of
1362 \&\f(CW\*(C`n=20\*(C'\fR caused this text to be truncated, as indicated by the \f(CW\*(C`...\*(C'\fR.  See
1363 the next flag for additional control of the abbreviated text.
1364 .IP "\fB\-cscb\fR, or \fB\-\-closing\-side\-comments\-balanced\fR" 4
1365 .IX Item "-cscb, or --closing-side-comments-balanced"
1366 As discussed in the previous item, when the
1367 closing-side-comment-maximum-text limit is exceeded the comment text must
1368 be truncated.  Older versions of perltidy terminated with three dots, and this
1369 can still be achieved with \-ncscb:
1370 .Sp
1371 .Vb 2
1372 \&  perltidy \-csc \-ncscb
1373 \&  } ## end foreach my $foo (sort { $b cmp $a ...
1374 .Ve
1375 .Sp
1376 However this causes a problem with editors which cannot recognize
1377 comments or are not configured to do so because they cannot \*(L"bounce\*(R" around in
1378 the text correctly.  The \fB\-cscb\fR flag has been added to
1379 help them by appending appropriate balancing structure:
1380 .Sp
1381 .Vb 2
1382 \&  perltidy \-csc \-cscb
1383 \&  } ## end foreach my $foo (sort { $b cmp $a ... })
1384 .Ve
1385 .Sp
1386 The default is \fB\-cscb\fR.
1387 .IP "\fB\-csce=n\fR, or \fB\-\-closing\-side\-comment\-else\-flag=n\fR" 4
1388 .IX Item "-csce=n, or --closing-side-comment-else-flag=n"
1389 The default, \fBn=0\fR, places the text of the opening \f(CW\*(C`if\*(C'\fR statement after any
1390 terminal \f(CW\*(C`else\*(C'\fR.
1391 .Sp
1392 If \fBn=2\fR is used, then each \f(CW\*(C`elsif\*(C'\fR is also given the text of the opening
1393 \&\f(CW\*(C`if\*(C'\fR statement.  Also, an \f(CW\*(C`else\*(C'\fR will include the text of a preceding
1394 \&\f(CW\*(C`elsif\*(C'\fR statement.  Note that this may result some long closing
1395 side comments.
1396 .Sp
1397 If \fBn=1\fR is used, the results will be the same as \fBn=2\fR whenever the
1398 resulting line length is less than the maximum allowed.
1399 =item \fB\-cscb\fR, or \fB\-\-closing\-side\-comments\-balanced\fR
1400 .Sp
1401 When using closing-side-comments, and the closing-side-comment-maximum-text
1402 limit is exceeded, then the comment text must be abbreviated.  
1403 It is terminated with three dots if the \fB\-cscb\fR flag is negated:
1404 .Sp
1405 .Vb 2
1406 \&  perltidy \-csc \-ncscb
1407 \&  } ## end foreach my $foo (sort { $b cmp $a ...
1408 .Ve
1409 .Sp
1410 This causes a problem with older editors which do not recognize comments
1411 because they cannot \*(L"bounce\*(R" around in the text correctly.  The \fB\-cscb\fR
1412 flag tries to help them by appending appropriate terminal balancing structures:
1413 .Sp
1414 .Vb 2
1415 \&  perltidy \-csc \-cscb
1416 \&  } ## end foreach my $foo (sort { $b cmp $a ... })
1417 .Ve
1418 .Sp
1419 The default is \fB\-cscb\fR.
1420 .IP "\fB\-cscw\fR, or \fB\-\-closing\-side\-comment\-warnings\fR" 4
1421 .IX Item "-cscw, or --closing-side-comment-warnings"
1422 This parameter is intended to help make the initial transition to the use of
1423 closing side comments.  
1424 It causes two
1425 things to happen if a closing side comment replaces an existing, different
1426 closing side comment:  first, an error message will be issued, and second, the
1427 original side comment will be placed alone on a new specially marked comment
1428 line for later attention.
1429 .Sp
1430 The intent is to avoid clobbering existing hand-written side comments
1431 which happen to match the pattern of closing side comments. This flag
1432 should only be needed on the first run with \fB\-csc\fR.
1433 .RE
1434 .RS 4
1435 .Sp
1436 \&\fBImportant Notes on Closing Side Comments:\fR
1437 .IP "\(bu" 4
1438 Closing side comments are only placed on lines terminated with a closing
1439 brace.  Certain closing styles, such as the use of cuddled elses
1440 (\fB\-ce\fR), preclude the generation of some closing side comments.
1441 .IP "\(bu" 4
1442 Please note that adding or deleting of closing side comments takes
1443 place only through the commands \fB\-csc\fR or \fB\-dcsc\fR.  The other commands,
1444 if used, merely modify the behavior of these two commands.
1445 .IP "\(bu" 4
1446 It is recommended that the \fB\-cscw\fR flag be used along with \fB\-csc\fR on
1447 the first use of perltidy on a given file.  This will prevent loss of
1448 any existing side comment data which happens to have the csc prefix.
1449 .IP "\(bu" 4
1450 Once you use \fB\-csc\fR, you should continue to use it so that any
1451 closing side comments remain correct as code changes.  Otherwise, these
1452 comments will become incorrect as the code is updated.
1453 .IP "\(bu" 4
1454 If you edit the closing side comments generated by perltidy, you must also
1455 change the prefix to be different from the closing side comment prefix.
1456 Otherwise, your edits will be lost when you rerun perltidy with \fB\-csc\fR.   For
1457 example, you could simply change \f(CW\*(C`## end\*(C'\fR to be \f(CW\*(C`## End\*(C'\fR, since the test is
1458 case sensitive.  You may also want to use the \fB\-ssc\fR flag to keep these
1459 modified closing side comments spaced the same as actual closing side comments.
1460 .IP "\(bu" 4
1461 Temporarily generating closing side comments is a useful technique for
1462 exploring and/or debugging a perl script, especially one written by someone
1463 else.  You can always remove them with \fB\-dcsc\fR.
1464 .RE
1465 .RS 4
1466 .RE
1467 .IP "Static Block Comments" 4
1468 .IX Item "Static Block Comments"
1469 Static block comments are block comments with a special leading pattern,
1470 \&\f(CW\*(C`##\*(C'\fR by default, which will be treated slightly differently from other
1471 block comments.  They effectively behave as if they had glue along their
1472 left and top edges, because they stick to the left edge and previous line
1473 when there is no blank spaces in those places.  This option is
1474 particularly useful for controlling how commented code is displayed.
1475 .RS 4
1476 .IP "\fB\-sbc\fR, \fB\-\-static\-block\-comments\fR" 4
1477 .IX Item "-sbc, --static-block-comments"
1478 When \fB\-sbc\fR is used, a block comment with a special leading pattern, \f(CW\*(C`##\*(C'\fR by
1479 default, will be treated specially.
1480 .Sp
1481 Comments so identified  are treated as follows:
1482 .RS 4
1483 .IP "\(bu" 4
1484 If there is no leading space on the line, then the comment will not
1485 be indented, and otherwise it may be,
1486 .IP "\(bu" 4
1487 no new blank line will be
1488 inserted before such a comment, and
1489 .IP "\(bu" 4
1490 such a comment will never become
1491 a hanging side comment.
1492 .RE
1493 .RS 4
1494 .Sp
1495 For example, assuming \f(CW@month_of_year\fR is
1496 left-adjusted:
1497 .Sp
1498 .Vb 4
1499 \&    @month_of_year = (    # \-sbc (default)
1500 \&        \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq, \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq,
1501 \&    ##  \*(AqDec\*(Aq, \*(AqNov\*(Aq
1502 \&        \*(AqNov\*(Aq, \*(AqDec\*(Aq);
1503 .Ve
1504 .Sp
1505 Without this convention, the above code would become
1506 .Sp
1507 .Vb 2
1508 \&    @month_of_year = (   # \-nsbc
1509 \&        \*(AqJan\*(Aq, \*(AqFeb\*(Aq, \*(AqMar\*(Aq, \*(AqApr\*(Aq, \*(AqMay\*(Aq, \*(AqJun\*(Aq, \*(AqJul\*(Aq, \*(AqAug\*(Aq, \*(AqSep\*(Aq, \*(AqOct\*(Aq,
1510 \&  
1511 \&        ##  \*(AqDec\*(Aq, \*(AqNov\*(Aq
1512 \&        \*(AqNov\*(Aq, \*(AqDec\*(Aq
1513 \&    );
1514 .Ve
1515 .Sp
1516 which is not as clear.
1517 The default is to use \fB\-sbc\fR.  This may be deactivated with \fB\-nsbc\fR.
1518 .RE
1519 .IP "\fB\-sbcp=string\fR, \fB\-\-static\-block\-comment\-prefix=string\fR" 4
1520 .IX Item "-sbcp=string, --static-block-comment-prefix=string"
1521 This parameter defines the prefix used to identify static block comments
1522 when the \fB\-sbc\fR parameter is set.  The default prefix is \f(CW\*(C`##\*(C'\fR,
1523 corresponding to \f(CW\*(C`\-sbcp=##\*(C'\fR.  The prefix is actually part of a perl 
1524 pattern used to match lines and it must either begin with \f(CW\*(C`#\*(C'\fR or \f(CW\*(C`^#\*(C'\fR.  
1525 In the first case a prefix ^\es* will be added to match any leading
1526 whitespace, while in the second case the pattern will match only
1527 comments with no leading whitespace.  For example, to
1528 identify all comments as static block comments, one would use \f(CW\*(C`\-sbcp=#\*(C'\fR.
1529 To identify all left-adjusted comments as static block comments, use \f(CW\*(C`\-sbcp=\*(Aq^#\*(Aq\*(C'\fR.
1530 .Sp
1531 Please note that \fB\-sbcp\fR merely defines the pattern used to identify static
1532 block comments; it will not be used unless the switch \fB\-sbc\fR is set.  Also,
1533 please be aware that since this string is used in a perl regular expression
1534 which identifies these comments, it must enable a valid regular expression to
1535 be formed.
1536 .Sp
1537 A pattern which can be useful is:
1538 .Sp
1539 .Vb 1
1540 \&    \-sbcp=^#{2,}[^\es#]
1541 .Ve
1542 .Sp
1543 This pattern requires a static block comment to have at least one character
1544 which is neither a # nor a space.  It allows a line containing only '#'
1545 characters to be rejected as a static block comment.  Such lines are often used
1546 at the start and end of header information in subroutines and should not be
1547 separated from the intervening comments, which typically begin with just a
1548 single '#'.
1549 .IP "\fB\-osbc\fR, \fB\-\-outdent\-static\-block\-comments\fR" 4
1550 .IX Item "-osbc, --outdent-static-block-comments"
1551 The command \fB\-osbc\fR will cause static block comments to be outdented by 2
1552 spaces (or whatever \fB\-ci=n\fR has been set to), if possible.
1553 .RE
1554 .RS 4
1555 .RE
1556 .IP "Static Side Comments" 4
1557 .IX Item "Static Side Comments"
1558 Static side comments are side comments with a special leading pattern.
1559 This option can be useful for controlling how commented code is displayed
1560 when it is a side comment.
1561 .RS 4
1562 .IP "\fB\-ssc\fR, \fB\-\-static\-side\-comments\fR" 4
1563 .IX Item "-ssc, --static-side-comments"
1564 When \fB\-ssc\fR is used, a side comment with a static leading pattern, which is
1565 \&\f(CW\*(C`##\*(C'\fR by default, will be spaced only a single space from previous
1566 character, and it will not be vertically aligned with other side comments.
1567 .Sp
1568 The default is \fB\-nssc\fR.
1569 .IP "\fB\-sscp=string\fR, \fB\-\-static\-side\-comment\-prefix=string\fR" 4
1570 .IX Item "-sscp=string, --static-side-comment-prefix=string"
1571 This parameter defines the prefix used to identify static side comments
1572 when the \fB\-ssc\fR parameter is set.  The default prefix is \f(CW\*(C`##\*(C'\fR,
1573 corresponding to \f(CW\*(C`\-sscp=##\*(C'\fR.
1574 .Sp
1575 Please note that \fB\-sscp\fR merely defines the pattern used to identify
1576 static side comments; it will not be used unless the switch \fB\-ssc\fR is
1577 set.  Also, note that this string is used in a perl regular expression
1578 which identifies these comments, so it must enable a valid regular
1579 expression to be formed.
1580 .RE
1581 .RS 4
1582 .RE
1583 .SS "Skipping Selected Sections of Code"
1584 .IX Subsection "Skipping Selected Sections of Code"
1585 Selected lines of code may be passed verbatim to the output without any
1586 formatting.  This feature is enabled by default but can be disabled with
1587 the \fB\-\-noformat\-skipping\fR or \fB\-nfs\fR flag.  It should be used sparingly to
1588 avoid littering code with markers, but it might be helpful for working
1589 around occasional problems.  For example it might be useful for keeping
1590 the indentation of old commented code unchanged, keeping indentation of
1591 long blocks of aligned comments unchanged, keeping certain list
1592 formatting unchanged, or working around a glitch in perltidy.
1593 .IP "\fB\-fs\fR,  \fB\-\-format\-skipping\fR" 4
1594 .IX Item "-fs,  --format-skipping"
1595 This flag, which is enabled by default, causes any code between
1596 special beginning and ending comment markers to be passed to the
1597 output without formatting.  The default beginning marker is #<<<
1598 and the default ending marker is #>>> but they
1599 may be changed (see next items below).  Additional text may appear on
1600 these special comment lines provided that it is separated from the
1601 marker by at least one space.  For example
1602 .Sp
1603 .Vb 7
1604 \& #<<<  do not let perltidy touch this
1605 \&    my @list = (1,
1606 \&                1, 1,
1607 \&                1, 2, 1,
1608 \&                1, 3, 3, 1,
1609 \&                1, 4, 6, 4, 1,);
1610 \& #>>>
1611 .Ve
1612 .Sp
1613 The comment markers may be placed at any location that a block comment may
1614 appear.  If they do not appear to be working, use the \-log flag and examine the
1615 \&\fI.LOG\fR file.  Use \fB\-nfs\fR to disable this feature.
1616 .IP "\fB\-fsb=string\fR,  \fB\-\-format\-skipping\-begin=string\fR" 4
1617 .IX Item "-fsb=string,  --format-skipping-begin=string"
1618 The \fB\-fsb=string\fR parameter may be used to change the beginning marker for
1619 format skipping.  The default is equivalent to \-fsb='#<<<'.  The string that
1620 you enter must begin with a # and should be in quotes as necessary to get past
1621 the command shell of your system.  It is actually the leading text of a pattern
1622 that is constructed by appending a '\es', so you must also include backslashes
1623 for characters to be taken literally rather than as patterns.
1624 .Sp
1625 Some examples show how example strings become patterns:
1626 .Sp
1627 .Vb 3
1628 \& \-fsb=\*(Aq#\e{\e{\e{\*(Aq becomes /^#\e{\e{\e{\es/  which matches  #{{{ but not #{{{{
1629 \& \-fsb=\*(Aq#\e*\e*\*(Aq   becomes /^#\e*\e*\es/    which matches  #** but not #***
1630 \& \-fsb=\*(Aq#\e*{2,}\*(Aq becomes /^#\e*{2,}\es/  which matches  #** and #*****
1631 .Ve
1632 .IP "\fB\-fse=string\fR,  \fB\-\-format\-skipping\-end=string\fR" 4
1633 .IX Item "-fse=string,  --format-skipping-end=string"
1634 The \fB\-fsb=string\fR is the corresponding parameter used to change the
1635 ending marker for format skipping.  The default is equivalent to
1636 \&\-fse='#<<<'.
1637 .SS "Line Break Control"
1638 .IX Subsection "Line Break Control"
1639 The parameters in this section control breaks after
1640 non-blank lines of code.  Blank lines are controlled
1641 separately by parameters in the section \*(L"Blank Line
1642 Control\*(R".
1643 .IP "\fB\-fnl\fR,  \fB\-\-freeze\-newlines\fR" 4
1644 .IX Item "-fnl,  --freeze-newlines"
1645 If you do not want any changes to the line breaks within
1646 lines of code in your script, set
1647 \&\fB\-fnl\fR, and they will remain fixed, and the rest of the commands in
1648 this section and sections 
1649 \&\*(L"Controlling List Formatting\*(R",
1650 \&\*(L"Retaining or Ignoring Existing Line Breaks\*(R". 
1651 You may want to use \fB\-noll\fR with this.
1652 .Sp
1653 Note: If you also want to keep your blank lines exactly
1654 as they are, you can use the \fB\-fbl\fR flag which is described
1655 in the section \*(L"Blank Line Control\*(R".
1656 .IP "\fB\-ce\fR,   \fB\-\-cuddled\-else\fR" 4
1657 .IX Item "-ce,   --cuddled-else"
1658 Enable the \*(L"cuddled else\*(R" style, in which \f(CW\*(C`else\*(C'\fR and \f(CW\*(C`elsif\*(C'\fR are
1659 follow immediately after the curly brace closing the previous block.
1660 The default is not to use cuddled elses, and is indicated with the flag
1661 \&\fB\-nce\fR or \fB\-\-nocuddled\-else\fR.  Here is a comparison of the
1662 alternatives:
1663 .Sp
1664 .Vb 5
1665 \&  if ($task) {
1666 \&      yyy();
1667 \&  } else {    # \-ce
1668 \&      zzz();
1669 \&  }
1670 \&
1671 \&  if ($task) {
1672 \&        yyy();
1673 \&  }
1674 \&  else {    # \-nce  (default)
1675 \&        zzz();
1676 \&  }
1677 .Ve
1678 .IP "\fB\-bl\fR,    \fB\-\-opening\-brace\-on\-new\-line\fR" 4
1679 .IX Item "-bl,    --opening-brace-on-new-line"
1680 Use the flag \fB\-bl\fR to place the opening brace on a new line:
1681 .Sp
1682 .Vb 4
1683 \&  if ( $input_file eq \*(Aq\-\*(Aq )    # \-bl 
1684 \&  {                          
1685 \&      important_function();
1686 \&  }
1687 .Ve
1688 .Sp
1689 This flag applies to all structural blocks, including named sub's (unless
1690 the \fB\-sbl\fR flag is set \*(-- see next item).
1691 .Sp
1692 The default style, \fB\-nbl\fR, places an opening brace on the same line as
1693 the keyword introducing it.  For example,
1694 .Sp
1695 .Vb 1
1696 \&  if ( $input_file eq \*(Aq\-\*(Aq ) {   # \-nbl (default)
1697 .Ve
1698 .IP "\fB\-sbl\fR,    \fB\-\-opening\-sub\-brace\-on\-new\-line\fR" 4
1699 .IX Item "-sbl,    --opening-sub-brace-on-new-line"
1700 The flag \fB\-sbl\fR can be used to override the value of \fB\-bl\fR for
1701 the opening braces of named sub's.  For example,
1702 .Sp
1703 .Vb 1
1704 \& perltidy \-sbl
1705 .Ve
1706 .Sp
1707 produces this result:
1708 .Sp
1709 .Vb 9
1710 \& sub message
1711 \& {
1712 \&    if (!defined($_[0])) {
1713 \&        print("Hello, World\en");
1714 \&    }
1715 \&    else {
1716 \&        print($_[0], "\en");
1717 \&    }
1718 \& }
1719 .Ve
1720 .Sp
1721 This flag is negated with \fB\-nsbl\fR.  If \fB\-sbl\fR is not specified,
1722 the value of \fB\-bl\fR is used.
1723 .IP "\fB\-asbl\fR,    \fB\-\-opening\-anonymous\-sub\-brace\-on\-new\-line\fR" 4
1724 .IX Item "-asbl,    --opening-anonymous-sub-brace-on-new-line"
1725 The flag \fB\-asbl\fR is like the \fB\-sbl\fR flag except that it applies
1726 to anonymous sub's instead of named subs. For example
1727 .Sp
1728 .Vb 1
1729 \& perltidy \-asbl
1730 .Ve
1731 .Sp
1732 produces this result:
1733 .Sp
1734 .Vb 9
1735 \& $a = sub
1736 \& {
1737 \&     if ( !defined( $_[0] ) ) {
1738 \&         print("Hello, World\en");
1739 \&     }
1740 \&     else {
1741 \&         print( $_[0], "\en" );
1742 \&     }
1743 \& };
1744 .Ve
1745 .Sp
1746 This flag is negated with \fB\-nasbl\fR, and the default is \fB\-nasbl\fR.
1747 .IP "\fB\-bli\fR,    \fB\-\-brace\-left\-and\-indent\fR" 4
1748 .IX Item "-bli,    --brace-left-and-indent"
1749 The flag \fB\-bli\fR is the same as \fB\-bl\fR but in addition it causes one 
1750 unit of continuation indentation ( see \fB\-ci\fR ) to be placed before 
1751 an opening and closing block braces.
1752 .Sp
1753 For example,
1754 .Sp
1755 .Vb 4
1756 \&        if ( $input_file eq \*(Aq\-\*(Aq )    # \-bli
1757 \&          {
1758 \&            important_function();
1759 \&          }
1760 .Ve
1761 .Sp
1762 By default, this extra indentation occurs for blocks of type:
1763 \&\fBif\fR, \fBelsif\fR, \fBelse\fR, \fBunless\fR, \fBfor\fR, \fBforeach\fR, \fBsub\fR, 
1764 \&\fBwhile\fR, \fBuntil\fR, and also with a preceding label.  The next item
1765 shows how to change this.
1766 .IP "\fB\-blil=s\fR,    \fB\-\-brace\-left\-and\-indent\-list=s\fR" 4
1767 .IX Item "-blil=s,    --brace-left-and-indent-list=s"
1768 Use this parameter to change the types of block braces for which the
1769 \&\fB\-bli\fR flag applies; see \*(L"Specifying Block Types\*(R".  For example,
1770 \&\fB\-blil='if elsif else'\fR would apply it to only \f(CW\*(C`if/elsif/else\*(C'\fR blocks.
1771 .IP "\fB\-bar\fR,    \fB\-\-opening\-brace\-always\-on\-right\fR" 4
1772 .IX Item "-bar,    --opening-brace-always-on-right"
1773 The default style, \fB\-nbl\fR places the opening code block brace on a new
1774 line if it does not fit on the same line as the opening keyword, like
1775 this:
1776 .Sp
1777 .Vb 5
1778 \&        if ( $bigwasteofspace1 && $bigwasteofspace2
1779 \&          || $bigwasteofspace3 && $bigwasteofspace4 )
1780 \&        {
1781 \&            big_waste_of_time();
1782 \&        }
1783 .Ve
1784 .Sp
1785 To force the opening brace to always be on the right, use the \fB\-bar\fR
1786 flag.  In this case, the above example becomes
1787 .Sp
1788 .Vb 4
1789 \&        if ( $bigwasteofspace1 && $bigwasteofspace2
1790 \&          || $bigwasteofspace3 && $bigwasteofspace4 ) {
1791 \&            big_waste_of_time();
1792 \&        }
1793 .Ve
1794 .Sp
1795 A conflict occurs if both \fB\-bl\fR and \fB\-bar\fR are specified.
1796 .IP "\fB\-otr\fR,  \fB\-\-opening\-token\-right\fR and related flags" 4
1797 .IX Item "-otr,  --opening-token-right and related flags"
1798 The \fB\-otr\fR flag is a hint that perltidy should not place a break between a
1799 comma and an opening token.  For example:
1800 .Sp
1801 .Vb 6
1802 \&    # default formatting
1803 \&    push @{ $self\->{$module}{$key} },
1804 \&      {
1805 \&        accno       => $ref\->{accno},
1806 \&        description => $ref\->{description}
1807 \&      };
1808 \&
1809 \&    # perltidy \-otr
1810 \&    push @{ $self\->{$module}{$key} }, {
1811 \&        accno       => $ref\->{accno},
1812 \&        description => $ref\->{description}
1813 \&      };
1814 .Ve
1815 .Sp
1816 The flag \fB\-otr\fR is actually an abbreviation for three other flags
1817 which can be used to control parens, hash braces, and square brackets
1818 separately if desired:
1819 .Sp
1820 .Vb 3
1821 \&  \-opr  or \-\-opening\-paren\-right
1822 \&  \-ohbr or \-\-opening\-hash\-brace\-right
1823 \&  \-osbr or \-\-opening\-square\-bracket\-right
1824 .Ve
1825 .IP "Vertical tightness of non-block curly braces, parentheses, and square brackets." 4
1826 .IX Item "Vertical tightness of non-block curly braces, parentheses, and square brackets."
1827 These parameters control what shall be called vertical tightness.  Here are the
1828 main points:
1829 .RS 4
1830 .IP "\(bu" 4
1831 Opening tokens (except for block braces) are controlled by \fB\-vt=n\fR, or
1832 \&\fB\-\-vertical\-tightness=n\fR, where
1833 .Sp
1834 .Vb 4
1835 \& \-vt=0 always break a line after opening token (default). 
1836 \& \-vt=1 do not break unless this would produce more than one 
1837 \&         step in indentation in a line.
1838 \& \-vt=2 never break a line after opening token
1839 .Ve
1840 .IP "\(bu" 4
1841 You must also use the \fB\-lp\fR flag when you use the \fB\-vt\fR flag; the
1842 reason is explained below.
1843 .IP "\(bu" 4
1844 Closing tokens (except for block braces) are controlled by \fB\-vtc=n\fR, or
1845 \&\fB\-\-vertical\-tightness\-closing=n\fR, where
1846 .Sp
1847 .Vb 5
1848 \& \-vtc=0 always break a line before a closing token (default), 
1849 \& \-vtc=1 do not break before a closing token which is followed 
1850 \&        by a semicolon or another closing token, and is not in 
1851 \&        a list environment.
1852 \& \-vtc=2 never break before a closing token.
1853 .Ve
1854 .Sp
1855 The rules for \fB\-vtc=1\fR are designed to maintain a reasonable balance
1856 between tightness and readability in complex lists.
1857 .IP "\(bu" 4
1858 Different controls may be applied to different token types,
1859 and it is also possible to control block braces; see below.
1860 .IP "\(bu" 4
1861 Finally, please note that these vertical tightness flags are merely
1862 hints to the formatter, and it cannot always follow them.  Things which
1863 make it difficult or impossible include comments, blank lines, blocks of
1864 code within a list, and possibly the lack of the \fB\-lp\fR parameter.
1865 Also, these flags may be ignored for very small lists (2 or 3 lines in
1866 length).
1867 .RE
1868 .RS 4
1869 .Sp
1870 Here are some examples:
1871 .Sp
1872 .Vb 7
1873 \&    # perltidy \-lp \-vt=0 \-vtc=0
1874 \&    %romanNumerals = (
1875 \&                       one   => \*(AqI\*(Aq,
1876 \&                       two   => \*(AqII\*(Aq,
1877 \&                       three => \*(AqIII\*(Aq,
1878 \&                       four  => \*(AqIV\*(Aq,
1879 \&    );
1880 \&
1881 \&    # perltidy \-lp \-vt=1 \-vtc=0
1882 \&    %romanNumerals = ( one   => \*(AqI\*(Aq,
1883 \&                       two   => \*(AqII\*(Aq,
1884 \&                       three => \*(AqIII\*(Aq,
1885 \&                       four  => \*(AqIV\*(Aq,
1886 \&    );
1887 \&
1888 \&    # perltidy \-lp \-vt=1 \-vtc=1
1889 \&    %romanNumerals = ( one   => \*(AqI\*(Aq,
1890 \&                       two   => \*(AqII\*(Aq,
1891 \&                       three => \*(AqIII\*(Aq,
1892 \&                       four  => \*(AqIV\*(Aq, );
1893 .Ve
1894 .Sp
1895 The difference between \fB\-vt=1\fR and \fB\-vt=2\fR is shown here:
1896 .Sp
1897 .Vb 6
1898 \&    # perltidy \-lp \-vt=1 
1899 \&    $init\->add(
1900 \&                mysprintf( "(void)find_threadsv(%s);",
1901 \&                           cstring( $threadsv_names[ $op\->targ ] )
1902 \&                )
1903 \&    );
1904 \&
1905 \&    # perltidy \-lp \-vt=2 
1906 \&    $init\->add( mysprintf( "(void)find_threadsv(%s);",
1907 \&                           cstring( $threadsv_names[ $op\->targ ] )
1908 \&                )
1909 \&    );
1910 .Ve
1911 .Sp
1912 With \fB\-vt=1\fR, the line ending in \f(CW\*(C`add(\*(C'\fR does not combine with the next
1913 line because the next line is not balanced.  This can help with
1914 readability, but \fB\-vt=2\fR can be used to ignore this rule.
1915 .Sp
1916 The tightest, and least readable, code is produced with both \f(CW\*(C`\-vt=2\*(C'\fR and
1917 \&\f(CW\*(C`\-vtc=2\*(C'\fR:
1918 .Sp
1919 .Vb 3
1920 \&    # perltidy \-lp \-vt=2 \-vtc=2
1921 \&    $init\->add( mysprintf( "(void)find_threadsv(%s);",
1922 \&                           cstring( $threadsv_names[ $op\->targ ] ) ) );
1923 .Ve
1924 .Sp
1925 Notice how the code in all of these examples collapses vertically as
1926 \&\fB\-vt\fR increases, but the indentation remains unchanged.  This is
1927 because perltidy implements the \fB\-vt\fR parameter by first formatting as
1928 if \fB\-vt=0\fR, and then simply overwriting one output line on top of the
1929 next, if possible, to achieve the desired vertical tightness.  The
1930 \&\fB\-lp\fR indentation style has been designed to allow this vertical
1931 collapse to occur, which is why it is required for the \fB\-vt\fR parameter.
1932 .Sp
1933 The \fB\-vt=n\fR and \fB\-vtc=n\fR parameters apply to each type of container
1934 token.  If desired, vertical tightness controls can be applied
1935 independently to each of the closing container token types.
1936 .Sp
1937 The parameters for controlling parentheses are \fB\-pvt=n\fR or
1938 \&\fB\-\-paren\-vertical\-tightness=n\fR, and \fB\-pcvt=n\fR or
1939 \&\fB\-\-paren\-vertical\-tightness\-closing=n\fR.
1940 .Sp
1941 Likewise, the parameters for square brackets are \fB\-sbvt=n\fR or
1942 \&\fB\-\-square\-bracket\-vertical\-tightness=n\fR, and \fB\-sbcvt=n\fR or
1943 \&\fB\-\-square\-bracket\-vertical\-tightness\-closing=n\fR.
1944 .Sp
1945 Finally, the parameters for controlling non-code block braces are
1946 \&\fB\-bvt=n\fR or \fB\-\-brace\-vertical\-tightness=n\fR, and \fB\-bcvt=n\fR or
1947 \&\fB\-\-brace\-vertical\-tightness\-closing=n\fR.
1948 .Sp
1949 In fact, the parameter \fB\-vt=n\fR is actually just an abbreviation for
1950 \&\fB\-pvt=n \-bvt=n sbvt=n\fR, and likewise \fB\-vtc=n\fR is an abbreviation
1951 for \fB\-pvtc=n \-bvtc=n sbvtc=n\fR.
1952 .RE
1953 .IP "\fB\-bbvt=n\fR or \fB\-\-block\-brace\-vertical\-tightness=n\fR" 4
1954 .IX Item "-bbvt=n or --block-brace-vertical-tightness=n"
1955 The \fB\-bbvt=n\fR flag is just like the \fB\-vt=n\fR flag but applies
1956 to opening code block braces.
1957 .Sp
1958 .Vb 4
1959 \& \-bbvt=0 break after opening block brace (default). 
1960 \& \-bbvt=1 do not break unless this would produce more than one 
1961 \&         step in indentation in a line.
1962 \& \-bbvt=2 do not break after opening block brace.
1963 .Ve
1964 .Sp
1965 It is necessary to also use either \fB\-bl\fR or \fB\-bli\fR for this to work,
1966 because, as with other vertical tightness controls, it is implemented by
1967 simply overwriting a line ending with an opening block brace with the
1968 subsequent line.  For example:
1969 .Sp
1970 .Vb 10
1971 \&    # perltidy \-bli \-bbvt=0
1972 \&    if ( open( FILE, "< $File" ) )
1973 \&      {
1974 \&        while ( $File = <FILE> )
1975 \&          {
1976 \&            $In .= $File;
1977 \&            $count++;
1978 \&          }
1979 \&        close(FILE);
1980 \&      }
1981 \&
1982 \&    # perltidy \-bli \-bbvt=1
1983 \&    if ( open( FILE, "< $File" ) )
1984 \&      { while ( $File = <FILE> )
1985 \&          { $In .= $File;
1986 \&            $count++;
1987 \&          }
1988 \&        close(FILE);
1989 \&      }
1990 .Ve
1991 .Sp
1992 By default this applies to blocks associated with keywords \fBif\fR,
1993 \&\fBelsif\fR, \fBelse\fR, \fBunless\fR, \fBfor\fR, \fBforeach\fR, \fBsub\fR, \fBwhile\fR,
1994 \&\fBuntil\fR, and also with a preceding label.  This can be changed with
1995 the parameter \fB\-bbvtl=string\fR, or
1996 \&\fB\-\-block\-brace\-vertical\-tightness\-list=string\fR, where \fBstring\fR is a
1997 space-separated list of block types.  For more information on the
1998 possible values of this string, see \*(L"Specifying Block Types\*(R"
1999 .Sp
2000 For example, if we want to just apply this style to \f(CW\*(C`if\*(C'\fR,
2001 \&\f(CW\*(C`elsif\*(C'\fR, and \f(CW\*(C`else\*(C'\fR blocks, we could use 
2002 \&\f(CW\*(C`perltidy \-bli \-bbvt=1 \-bbvtl=\*(Aqif elsif else\*(Aq\*(C'\fR.
2003 .Sp
2004 There is no vertical tightness control for closing block braces; with
2005 one exception they will be placed on separate lines.
2006 The exception is that a cascade of closing block braces may
2007 be stacked on a single line.  See \fB\-scbb\fR.
2008 .IP "\fB\-sot\fR,  \fB\-\-stack\-opening\-tokens\fR and related flags" 4
2009 .IX Item "-sot,  --stack-opening-tokens and related flags"
2010 The \fB\-sot\fR flag tells perltidy to \*(L"stack\*(R" opening tokens
2011 when possible to avoid lines with isolated opening tokens.
2012 .Sp
2013 For example:
2014 .Sp
2015 .Vb 8
2016 \&    # default
2017 \&    $opt_c = Text::CSV_XS\->new(
2018 \&        {
2019 \&            binary       => 1,
2020 \&            sep_char     => $opt_c,
2021 \&            always_quote => 1,
2022 \&        }
2023 \&    );
2024 \&
2025 \&    # \-sot
2026 \&    $opt_c = Text::CSV_XS\->new( {
2027 \&            binary       => 1,
2028 \&            sep_char     => $opt_c,
2029 \&            always_quote => 1,
2030 \&        }
2031 \&    );
2032 .Ve
2033 .Sp
2034 For detailed control of individual closing tokens the following
2035 controls can be used:
2036 .Sp
2037 .Vb 4
2038 \&  \-sop  or \-\-stack\-opening\-paren
2039 \&  \-sohb or \-\-stack\-opening\-hash\-brace
2040 \&  \-sosb or \-\-stack\-opening\-square\-bracket
2041 \&  \-sobb or \-\-stack\-opening\-block\-brace
2042 .Ve
2043 .Sp
2044 The flag \fB\-sot\fR is an abbreviation for \fB\-sop \-sohb \-sosb\fR.
2045 .Sp
2046 The flag \fB\-sobb\fR is a abbreviation for \fB\-bbvt=2 \-bbvtl='*'\fR.  This
2047 will case a cascade of opening block braces to appear on a single line,
2048 although this an uncommon occurrence except in test scripts.
2049 .IP "\fB\-sct\fR,  \fB\-\-stack\-closing\-tokens\fR and related flags" 4
2050 .IX Item "-sct,  --stack-closing-tokens and related flags"
2051 The \fB\-sct\fR flag tells perltidy to \*(L"stack\*(R" closing tokens
2052 when possible to avoid lines with isolated closing tokens.
2053 .Sp
2054 For example:
2055 .Sp
2056 .Vb 8
2057 \&    # default
2058 \&    $opt_c = Text::CSV_XS\->new(
2059 \&        {
2060 \&            binary       => 1,
2061 \&            sep_char     => $opt_c,
2062 \&            always_quote => 1,
2063 \&        }
2064 \&    );
2065 \&
2066 \&    # \-sct
2067 \&    $opt_c = Text::CSV_XS\->new(
2068 \&        {
2069 \&            binary       => 1,
2070 \&            sep_char     => $opt_c,
2071 \&            always_quote => 1,
2072 \&        } );
2073 .Ve
2074 .Sp
2075 The \fB\-sct\fR flag is somewhat similar to the \fB\-vtc\fR flags, and in some
2076 cases it can give a similar result.  The difference is that the \fB\-vtc\fR
2077 flags try to avoid lines with leading opening tokens by \*(L"hiding\*(R" them at
2078 the end of a previous line, whereas the \fB\-sct\fR flag merely tries to
2079 reduce the number of lines with isolated closing tokens by stacking them
2080 but does not try to hide them.  For example:
2081 .Sp
2082 .Vb 6
2083 \&    # \-vtc=2
2084 \&    $opt_c = Text::CSV_XS\->new(
2085 \&        {
2086 \&            binary       => 1,
2087 \&            sep_char     => $opt_c,
2088 \&            always_quote => 1, } );
2089 .Ve
2090 .Sp
2091 For detailed control of the stacking of individual closing tokens the
2092 following controls can be used:
2093 .Sp
2094 .Vb 4
2095 \&  \-scp  or \-\-stack\-closing\-paren
2096 \&  \-schb or \-\-stack\-closing\-hash\-brace
2097 \&  \-scsb or \-\-stack\-closing\-square\-bracket
2098 \&  \-scbb or \-\-stack\-closing\-block\-brace
2099 .Ve
2100 .Sp
2101 The flag \fB\-sct\fR is an abbreviation for stacking the non-block closing
2102 tokens, \fB\-scp \-schb \-scsb\fR.
2103 .Sp
2104 Stacking of closing block braces, \fB\-scbb\fR, causes a cascade of isolated
2105 closing block braces to be combined into a single line as in the following
2106 example:
2107 .Sp
2108 .Vb 7
2109 \&    # \-scbb:
2110 \&    for $w1 (@w1) {
2111 \&        for $w2 (@w2) {
2112 \&            for $w3 (@w3) {
2113 \&                for $w4 (@w4) {
2114 \&                    push( @lines, "$w1 $w2 $w3 $w4\en" );
2115 \&                } } } }
2116 .Ve
2117 .Sp
2118 To simplify input even further for the case in which both opening and closing
2119 non-block containers are stacked, the flag \fB\-sac\fR or \fB\-\-stack\-all\-containers\fR
2120 is an abbreviation for \fB\-sot \-sot\fR.
2121 .IP "\fB\-dnl\fR,  \fB\-\-delete\-old\-newlines\fR" 4
2122 .IX Item "-dnl,  --delete-old-newlines"
2123 By default, perltidy first deletes all old line break locations, and then it
2124 looks for good break points to match the desired line length.  Use \fB\-ndnl\fR
2125 or  \fB\-\-nodelete\-old\-newlines\fR to force perltidy to retain all old line break
2126 points.
2127 .IP "\fB\-anl\fR,  \fB\-\-add\-newlines\fR" 4
2128 .IX Item "-anl,  --add-newlines"
2129 By default, perltidy will add line breaks when necessary to create
2130 continuations of long lines and to improve the script appearance.  Use
2131 \&\fB\-nanl\fR or \fB\-\-noadd\-newlines\fR to prevent any new line breaks.
2132 .Sp
2133 This flag does not prevent perltidy from eliminating existing line
2134 breaks; see \fB\-\-freeze\-newlines\fR to completely prevent changes to line
2135 break points.
2136 .IP "Controlling whether perltidy breaks before or after operators" 4
2137 .IX Item "Controlling whether perltidy breaks before or after operators"
2138 Four command line parameters provide some control over whether
2139 a line break should be before or after specific token types.
2140 Two parameters give detailed control:
2141 .Sp
2142 \&\fB\-wba=s\fR or \fB\-\-want\-break\-after=s\fR, and
2143 .Sp
2144 \&\fB\-wbb=s\fR or \fB\-\-want\-break\-before=s\fR.
2145 .Sp
2146 These parameters are each followed by a quoted string, \fBs\fR, containing
2147 a list of token types (separated only by spaces).  No more than one of each
2148 of these parameters should be specified, because repeating a
2149 command-line parameter always overwrites the previous one before
2150 perltidy ever sees it.
2151 .Sp
2152 By default, perltidy breaks \fBafter\fR these token types:
2153   % + \- * / x != == >= <= =~ !~ < >  | & 
2154   = **= += *= &= <<= &&= \-= /= |= >>= ||= //= .= %= ^= x=
2155 .Sp
2156 And perltidy breaks \fBbefore\fR these token types by default:
2157   . << >> \-> && || //
2158 .Sp
2159 To illustrate, to cause a break after a concatenation operator, \f(CW\*(Aq.\*(Aq\fR,
2160 rather than before it, the command line would be
2161 .Sp
2162 .Vb 1
2163 \&  \-wba="."
2164 .Ve
2165 .Sp
2166 As another example, the following command would cause a break before 
2167 math operators \f(CW\*(Aq+\*(Aq\fR, \f(CW\*(Aq\-\*(Aq\fR, \f(CW\*(Aq/\*(Aq\fR, and \f(CW\*(Aq*\*(Aq\fR:
2168 .Sp
2169 .Vb 1
2170 \&  \-wbb="+ \- / *"
2171 .Ve
2172 .Sp
2173 These commands should work well for most of the token types that perltidy uses
2174 (use \fB\-\-dump\-token\-types\fR for a list).  Also try the \fB\-D\fR flag on a short
2175 snippet of code and look at the .DEBUG file to see the tokenization.  However,
2176 for a few token types there may be conflicts with hardwired logic which cause
2177 unexpected results.  One example is curly braces, which should be controlled
2178 with the parameter \fBbl\fR provided for that purpose.
2179 .Sp
2180 \&\fB\s-1WARNING\s0\fR Be sure to put these tokens in quotes to avoid having them
2181 misinterpreted by your command shell.
2182 .Sp
2183 Two additional parameters are available which, though they provide no further
2184 capability, can simplify input are:
2185 .Sp
2186 \&\fB\-baao\fR or \fB\-\-break\-after\-all\-operators\fR,
2187 .Sp
2188 \&\fB\-bbao\fR or \fB\-\-break\-before\-all\-operators\fR.
2189 .Sp
2190 The \-baao sets the default to be to break after all of the following operators:
2191 .Sp
2192 .Vb 3
2193 \&    % + \- * / x != == >= <= =~ !~ < > | & 
2194 \&    = **= += *= &= <<= &&= \-= /= |= >>= ||= //= .= %= ^= x=
2195 \&    . : ? && || and or err xor
2196 .Ve
2197 .Sp
2198 and the \fB\-bbao\fR flag sets the default to break before all of these operators.
2199 These can be used to define an initial break preference which can be fine-tuned
2200 with the \fB\-wba\fR and \fB\-wbb\fR flags.  For example, to break before all operators
2201 except an \fB=\fR one could use \-\-bbao \-wba='=' rather than listing every
2202 single perl operator except \fB=\fR on a \-wbb flag.
2203 .SS "Controlling List Formatting"
2204 .IX Subsection "Controlling List Formatting"
2205 Perltidy attempts to place comma-separated arrays of values in tables
2206 which look good.  Its default algorithms usually work well, and they
2207 have been improving with each release, but several parameters are
2208 available to control list formatting.
2209 .IP "\fB\-boc\fR,  \fB\-\-break\-at\-old\-comma\-breakpoints\fR" 4
2210 .IX Item "-boc,  --break-at-old-comma-breakpoints"
2211 This flag tells perltidy to try to break at all old commas.  This is not
2212 the default.  Normally, perltidy makes a best guess at list formatting,
2213 and seldom uses old comma breakpoints.  Usually this works well,
2214 but consider:
2215 .Sp
2216 .Vb 5
2217 \&    my @list = (1,
2218 \&                1, 1,
2219 \&                1, 2, 1,
2220 \&                1, 3, 3, 1,
2221 \&                1, 4, 6, 4, 1,);
2222 .Ve
2223 .Sp
2224 The default formatting will flatten this down to one line:
2225 .Sp
2226 .Vb 2
2227 \&    # perltidy (default)
2228 \&    my @list = ( 1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 4, 6, 4, 1, );
2229 .Ve
2230 .Sp
2231 which hides the structure. Using \fB\-boc\fR, plus additional flags
2232 to retain the original style, yields
2233 .Sp
2234 .Vb 6
2235 \&    # perltidy \-boc \-lp \-pt=2 \-vt=1 \-vtc=1
2236 \&    my @list = (1,
2237 \&                1, 1,
2238 \&                1, 2, 1,
2239 \&                1, 3, 3, 1,
2240 \&                1, 4, 6, 4, 1,);
2241 .Ve
2242 .Sp
2243 A disadvantage of this flag is that all tables in the file
2244 must already be nicely formatted.  For another possibility see
2245 the \-fs flag in \*(L"Skipping Selected Sections of Code\*(R".
2246 .IP "\fB\-mft=n\fR,  \fB\-\-maximum\-fields\-per\-table=n\fR" 4
2247 .IX Item "-mft=n,  --maximum-fields-per-table=n"
2248 If the computed number of fields for any table exceeds \fBn\fR, then it
2249 will be reduced to \fBn\fR.  The default value for \fBn\fR is a large number,
2250 40.  While this value should probably be left unchanged as a general
2251 rule, it might be used on a small section of code to force a list to
2252 have a particular number of fields per line, and then either the \fB\-boc\fR
2253 flag could be used to retain this formatting, or a single comment could
2254 be introduced somewhere to freeze the formatting in future applications
2255 of perltidy.
2256 .Sp
2257 .Vb 9
2258 \&    # perltidy \-mft=2
2259 \&    @month_of_year = (    
2260 \&        \*(AqJan\*(Aq, \*(AqFeb\*(Aq,
2261 \&        \*(AqMar\*(Aq, \*(AqApr\*(Aq,
2262 \&        \*(AqMay\*(Aq, \*(AqJun\*(Aq,
2263 \&        \*(AqJul\*(Aq, \*(AqAug\*(Aq,
2264 \&        \*(AqSep\*(Aq, \*(AqOct\*(Aq,
2265 \&        \*(AqNov\*(Aq, \*(AqDec\*(Aq
2266 \&    );
2267 .Ve
2268 .IP "\fB\-cab=n\fR,  \fB\-\-comma\-arrow\-breakpoints=n\fR" 4
2269 .IX Item "-cab=n,  --comma-arrow-breakpoints=n"
2270 A comma which follows a comma arrow, '=>', is given special
2271 consideration.  In a long list, it is common to break at all such
2272 commas.  This parameter can be used to control how perltidy breaks at
2273 these commas.  (However, it will have no effect if old comma breaks are
2274 being forced because \fB\-boc\fR is used).  The possible values of \fBn\fR are:
2275 .Sp
2276 .Vb 10
2277 \& n=0 break at all commas after =>  
2278 \& n=1 stable: break at all commas after => if container is open,
2279 \&     EXCEPT FOR one\-line containers
2280 \& n=2 break at all commas after =>, BUT try to form the maximum
2281 \&     maximum one\-line container lengths
2282 \& n=3 do not treat commas after => specially at all 
2283 \& n=4 break everything: like n=0 but ALSO break a short container with
2284 \&     a => not followed by a comma when \-vt=0 is used
2285 \& n=5 stable: like n=1 but ALSO break at open one\-line containers when
2286 \&     \-vt=0 is used (default)
2287 .Ve
2288 .Sp
2289 For example, given the following single line, perltidy by default will
2290 not add any line breaks because it would break the existing one-line
2291 container:
2292 .Sp
2293 .Vb 1
2294 \&    bless { B => $B, Root => $Root } => $package;
2295 .Ve
2296 .Sp
2297 Using \fB\-cab=0\fR will force a break after each comma-arrow item:
2298 .Sp
2299 .Vb 5
2300 \&    # perltidy \-cab=0:
2301 \&    bless {
2302 \&        B    => $B,
2303 \&        Root => $Root
2304 \&    } => $package;
2305 .Ve
2306 .Sp
2307 If perltidy is subsequently run with this container broken, then by
2308 default it will break after each '=>' because the container is now
2309 broken.  To reform a one-line container, the parameter \fB\-cab=2\fR could
2310 be used.
2311 .Sp
2312 The flag \fB\-cab=3\fR can be used to prevent these commas from being
2313 treated specially.  In this case, an item such as \*(L"01\*(R" => 31 is
2314 treated as a single item in a table.  The number of fields in this table
2315 will be determined by the same rules that are used for any other table.
2316 Here is an example.
2317 .Sp
2318 .Vb 6
2319 \&    # perltidy \-cab=3
2320 \&    my %last_day = (
2321 \&        "01" => 31, "02" => 29, "03" => 31, "04" => 30,
2322 \&        "05" => 31, "06" => 30, "07" => 31, "08" => 31,
2323 \&        "09" => 30, "10" => 31, "11" => 30, "12" => 31
2324 \&    );
2325 .Ve
2326 .SS "Retaining or Ignoring Existing Line Breaks"
2327 .IX Subsection "Retaining or Ignoring Existing Line Breaks"
2328 Several additional parameters are available for controlling the extent
2329 to which line breaks in the input script influence the output script.
2330 In most cases, the default parameter values are set so that, if a choice
2331 is possible, the output style follows the input style.  For example, if
2332 a short logical container is broken in the input script, then the
2333 default behavior is for it to remain broken in the output script.
2334 .PP
2335 Most of the parameters in this section would only be required for a
2336 one-time conversion of a script from short container lengths to longer
2337 container lengths.  The opposite effect, of converting long container
2338 lengths to shorter lengths, can be obtained by temporarily using a short
2339 maximum line length.
2340 .IP "\fB\-bol\fR,  \fB\-\-break\-at\-old\-logical\-breakpoints\fR" 4
2341 .IX Item "-bol,  --break-at-old-logical-breakpoints"
2342 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,
2343 or \f(CW\*(C`or\*(C'\fR, then the container will remain broken.  Also, breaks
2344 at internal keywords \f(CW\*(C`if\*(C'\fR and \f(CW\*(C`unless\*(C'\fR will normally be retained.
2345 To prevent this, and thus form longer lines, use \fB\-nbol\fR.
2346 .IP "\fB\-bok\fR,  \fB\-\-break\-at\-old\-keyword\-breakpoints\fR" 4
2347 .IX Item "-bok,  --break-at-old-keyword-breakpoints"
2348 By default, perltidy will retain a breakpoint before keywords which may
2349 return lists, such as \f(CW\*(C`sort\*(C'\fR and <map>.  This allows chains of these
2350 operators to be displayed one per line.  Use \fB\-nbok\fR to prevent
2351 retaining these breakpoints.
2352 .IP "\fB\-bot\fR,  \fB\-\-break\-at\-old\-ternary\-breakpoints\fR" 4
2353 .IX Item "-bot,  --break-at-old-ternary-breakpoints"
2354 By default, if a conditional (ternary) operator is broken at a \f(CW\*(C`:\*(C'\fR,
2355 then it will remain broken.  To prevent this, and thereby
2356 form longer lines, use \fB\-nbot\fR.
2357 .IP "\fB\-boa\fR,  \fB\-\-break\-at\-old\-attribute\-breakpoints\fR" 4
2358 .IX Item "-boa,  --break-at-old-attribute-breakpoints"
2359 By default, if an attribute list is broken at a \f(CW\*(C`:\*(C'\fR in the source file, then
2360 it will remain broken.  For example, given the following code, the line breaks
2361 at the ':'s will be retained:
2362 .Sp
2363 .Vb 4
2364 \&                    my @field
2365 \&                      : field
2366 \&                      : Default(1)
2367 \&                      : Get(\*(AqName\*(Aq => \*(Aqfoo\*(Aq) : Set(\*(AqName\*(Aq);
2368 .Ve
2369 .Sp
2370 If the attributes are on a single line in the source code then they will remain
2371 on a single line if possible.
2372 .Sp
2373 To prevent this, and thereby always form longer lines, use \fB\-nboa\fR.
2374 .IP "\fB\-iob\fR,  \fB\-\-ignore\-old\-breakpoints\fR" 4
2375 .IX Item "-iob,  --ignore-old-breakpoints"
2376 Use this flag to tell perltidy to ignore existing line breaks to the
2377 maximum extent possible.  This will tend to produce the longest possible
2378 containers, regardless of type, which do not exceed the line length
2379 limit.
2380 .IP "\fB\-kis\fR,  \fB\-\-keep\-interior\-semicolons\fR" 4
2381 .IX Item "-kis,  --keep-interior-semicolons"
2382 Use the \fB\-kis\fR flag to prevent breaking at a semicolon if
2383 there was no break there in the input file.  Normally
2384 perltidy places a newline after each semicolon which
2385 terminates a statement unless several statements are
2386 contained within a one-line brace block.  To illustrate,
2387 consider the following input lines:
2388 .Sp
2389 .Vb 2
2390 \&    dbmclose(%verb_delim); undef %verb_delim;
2391 \&    dbmclose(%expanded); undef %expanded;
2392 .Ve
2393 .Sp
2394 The default is to break after each statement, giving
2395 .Sp
2396 .Vb 4
2397 \&    dbmclose(%verb_delim);
2398 \&    undef %verb_delim;
2399 \&    dbmclose(%expanded);
2400 \&    undef %expanded;
2401 .Ve
2402 .Sp
2403 With \fBperltidy \-kis\fR the multiple statements are retained:
2404 .Sp
2405 .Vb 2
2406 \&    dbmclose(%verb_delim); undef %verb_delim;
2407 \&    dbmclose(%expanded);   undef %expanded;
2408 .Ve
2409 .Sp
2410 The statements are still subject to the specified value
2411 of \fBmaximum-line-length\fR and will be broken if this 
2412 maximum is exceeded.
2413 .SS "Blank Line Control"
2414 .IX Subsection "Blank Line Control"
2415 Blank lines can improve the readability of a script if they are carefully
2416 placed.  Perltidy has several commands for controlling the insertion,
2417 retention, and removal of blank lines.
2418 .IP "\fB\-fbl\fR,  \fB\-\-freeze\-blank\-lines\fR" 4
2419 .IX Item "-fbl,  --freeze-blank-lines"
2420 Set \fB\-fbl\fR if you want to the blank lines in your script to
2421 remain exactly as they are.  The rest of the parameters in
2422 this section may then be ignored.  (Note: setting the \fB\-fbl\fR flag
2423 is equivalent to setting \fB\-mbl=0\fR and \fB\-kbl=2\fR).
2424 .IP "\fB\-bbc\fR,  \fB\-\-blanks\-before\-comments\fR" 4
2425 .IX Item "-bbc,  --blanks-before-comments"
2426 A blank line will be introduced before a full-line comment.  This is the
2427 default.  Use \fB\-nbbc\fR or  \fB\-\-noblanks\-before\-comments\fR to prevent
2428 such blank lines from being introduced.
2429 .IP "\fB\-blbs=n\fR,  \fB\-\-blank\-lines\-before\-subs=n\fR" 4
2430 .IX Item "-blbs=n,  --blank-lines-before-subs=n"
2431 The parameter \fB\-blbs=n\fR requests that least \fBn\fR blank lines precede a sub
2432 definition which does not follow a comment and which is more than one-line
2433 long.  The default is <\-blbs=1>.  \fB\s-1BEGIN\s0\fR and \fB\s-1END\s0\fR blocks are included.
2434 .Sp
2435 The requested number of blanks statement will be inserted regardless of the
2436 value of \fB\-\-maximum\-consecutive\-blank\-lines=n\fR (\fB\-mbl=n\fR) with the exception
2437 that if \fB\-mbl=0\fR then no blanks will be output.
2438 .Sp
2439 This parameter interacts with the value \fBk\fR of the parameter \fB\-\-maximum\-consecutive\-blank\-lines=k\fR (\fB\-mbl=k\fR) as follows:
2440 .Sp
2441 1. If \fB\-mbl=0\fR then no blanks will be output.  This allows all blanks to be suppressed with a single parameter.  Otherwise,
2442 .Sp
2443 2. If the number of old blank lines in the script is less than \fBn\fR then
2444 additional blanks will be inserted to make the total \fBn\fR regardless of the
2445 value of \fB\-mbl=k\fR.
2446 .Sp
2447 3. If the number of old blank lines in the script equals or exceeds \fBn\fR then
2448 this parameter has no effect, however the total will not exceed
2449 value specified on the \fB\-mbl=k\fR flag.
2450 .IP "\fB\-blbp=n\fR,  \fB\-\-blank\-lines\-before\-packages=n\fR" 4
2451 .IX Item "-blbp=n,  --blank-lines-before-packages=n"
2452 The parameter \fB\-blbp=n\fR requests that least \fBn\fR blank lines precede a package
2453 which does not follow a comment.  The default is \fB\-blbp=1\fR.
2454 .Sp
2455 This parameter interacts with the value \fBk\fR of the parameter
2456 \&\fB\-\-maximum\-consecutive\-blank\-lines=k\fR (\fB\-mbl=k\fR) in the same way as described
2457 for the previous item \fB\-blbs=n\fR.
2458 .IP "\fB\-bbs\fR,  \fB\-\-blanks\-before\-subs\fR" 4
2459 .IX Item "-bbs,  --blanks-before-subs"
2460 For compatibility with previous versions, \fB\-bbs\fR or \fB\-\-blanks\-before\-subs\fR
2461 is equivalent to \fI\-blbp=1\fR and \fI\-blbs=1\fR.
2462 .Sp
2463 Likewise, \fB\-nbbs\fR or \fB\-\-noblanks\-before\-subs\fR 
2464 is equivalent to \fI\-blbp=0\fR and \fI\-blbs=0\fR.
2465 .IP "\fB\-bbb\fR,  \fB\-\-blanks\-before\-blocks\fR" 4
2466 .IX Item "-bbb,  --blanks-before-blocks"
2467 A blank line will be introduced before blocks of coding delimited by
2468 \&\fBfor\fR, \fBforeach\fR, \fBwhile\fR, \fBuntil\fR, and \fBif\fR, \fBunless\fR, in the following
2469 circumstances:
2470 .RS 4
2471 .IP "\(bu" 4
2472 The block is not preceded by a comment.
2473 .IP "\(bu" 4
2474 The block is not a one-line block.
2475 .IP "\(bu" 4
2476 The number of consecutive non-blank lines at the current indentation depth is at least \fB\-lbl\fR
2477 (see next section).
2478 .RE
2479 .RS 4
2480 .Sp
2481 This is the default.  The intention of this option is to introduce
2482 some space within dense coding.
2483 This is negated with \fB\-nbbb\fR or  \fB\-\-noblanks\-before\-blocks\fR.
2484 .RE
2485 .IP "\fB\-lbl=n\fR \fB\-\-long\-block\-line\-count=n\fR" 4
2486 .IX Item "-lbl=n --long-block-line-count=n"
2487 This controls how often perltidy is allowed to add blank lines before 
2488 certain block types (see previous section).  The default is 8.  Entering
2489 a value of \fB0\fR is equivalent to entering a very large number.
2490 .IP "\fB\-blao=i\fR or \fB\-\-blank\-lines\-after\-opening\-block=i\fR" 4
2491 .IX Item "-blao=i or --blank-lines-after-opening-block=i"
2492 This control places a minimum of \fBi\fR blank lines \fBafter\fR a line which \fBends\fR
2493 with an opening block brace of a specified type.  By default, this only applies
2494 to the block of a named \fBsub\fR, but this can be changed (see \fB\-blaol\fR below).
2495 The default is not to do this (\fBi=0\fR).
2496 .Sp
2497 Please see the note below on using the \fB\-blao\fR and \fB\-blbc\fR options.
2498 .IP "\fB\-blbc=i\fR or \fB\-\-blank\-lines\-before\-closing\-block=i\fR" 4
2499 .IX Item "-blbc=i or --blank-lines-before-closing-block=i"
2500 This control places a minimum of \fBi\fR blank lines \fBbefore\fR a line which
2501 \&\fBbegins\fR with a closing block brace of a specified type.  By default, this
2502 only applies to the block of a named \fBsub\fR, but this can be changed (see
2503 \&\fB\-blbcl\fR below).  The default is not to do this (\fBi=0\fR).
2504 .IP "\fB\-blaol=s\fR or \fB\-\-blank\-lines\-after\-opening\-block\-list=s\fR" 4
2505 .IX Item "-blaol=s or --blank-lines-after-opening-block-list=s"
2506 The parameter \fBs\fR is a list of block type keywords to which the flag \fB\-blao\fR
2507 should apply.  The section \*(L"Specifying Block Types\*(R" explains how to list
2508 block types.
2509 .IP "\fB\-blbcl=s\fR or \fB\-\-blank\-lines\-before\-closing\-block\-list=s\fR" 4
2510 .IX Item "-blbcl=s or --blank-lines-before-closing-block-list=s"
2511 This parameter is a list of block type keywords to which the flag \fB\-blbc\fR
2512 should apply.  The section \*(L"Specifying Block Types\*(R" explains how to list
2513 block types.
2514 .IP "Note on using the \fB\-blao\fR and \fB\-blbc\fR options." 4
2515 .IX Item "Note on using the -blao and -blbc options."
2516 These blank line controls introduce a certain minimum number of blank lines in
2517 the text, but the final number of blank lines may be greater, depending on
2518 values of the other blank line controls and the number of old blank lines.  A
2519 consequence is that introducing blank lines with these and other controls
2520 cannot be exactly undone, so some experimentation with these controls is
2521 recommended before using them.
2522 .Sp
2523 For example, suppose that for some reason we decide to introduce one blank
2524 space at the beginning and ending of all blocks.  We could do
2525 this using
2526 .Sp
2527 .Vb 1
2528 \&  perltidy \-blao=2 \-blbc=2 \-blaol=\*(Aq*\*(Aq \-blbcl=\*(Aq*\*(Aq filename
2529 .Ve
2530 .Sp
2531 Now suppose the script continues to be developed, but at some later date we
2532 decide we don't want these spaces after all. we might expect that running with
2533 the flags \fB\-blao=0\fR and \fB\-blbc=0\fR will undo them.  However, by default
2534 perltidy retains single blank lines, so the blank lines remain.
2535 .Sp
2536 We can easily fix this by telling perltidy to ignore old blank lines by
2537 including the added parameter \fB\-kbl=0\fR and rerunning. Then the unwanted blank
2538 lines will be gone.  However, this will cause all old blank lines to be
2539 ignored, perhaps even some that were added by hand to improve formatting. So
2540 please be cautious when using these parameters.
2541 .IP "\fB\-mbl=n\fR \fB\-\-maximum\-consecutive\-blank\-lines=n\fR" 4
2542 .IX Item "-mbl=n --maximum-consecutive-blank-lines=n"
2543 This parameter specifies the maximum number of consecutive blank lines which
2544 will be output within code sections of a script.  The default is n=1.  If the
2545 input file has more than n consecutive blank lines, the number will be reduced
2546 to n except as noted above for the \fB\-blbp\fR and \fB\-blbs\fR parameters.  If \fBn=0\fR
2547 then no blank lines will be output (unless all old blank lines are retained
2548 with the \fB\-kbl=2\fR flag of the next section).
2549 .Sp
2550 This flag obviously does not apply to pod sections,
2551 here-documents, and quotes.
2552 .IP "\fB\-kbl=n\fR,  \fB\-\-keep\-old\-blank\-lines=n\fR" 4
2553 .IX Item "-kbl=n,  --keep-old-blank-lines=n"
2554 The \fB\-kbl=n\fR flag gives you control over how your existing blank lines are
2555 treated.
2556 .Sp
2557 The possible values of \fBn\fR are:
2558 .Sp
2559 .Vb 3
2560 \& n=0 ignore all old blank lines
2561 \& n=1 stable: keep old blanks, but limited by the value of the B<\-mbl=n> flag
2562 \& n=2 keep all old blank lines, regardless of the value of the B<\-mbl=n> flag
2563 .Ve
2564 .Sp
2565 The default is \fBn=1\fR.
2566 .IP "\fB\-sob\fR,  \fB\-\-swallow\-optional\-blank\-lines\fR" 4
2567 .IX Item "-sob,  --swallow-optional-blank-lines"
2568 This is equivalent to \fBkbl=0\fR and is included for compatibility with
2569 previous versions.
2570 .IP "\fB\-nsob\fR,  \fB\-\-noswallow\-optional\-blank\-lines\fR" 4
2571 .IX Item "-nsob,  --noswallow-optional-blank-lines"
2572 This is equivalent to \fBkbl=1\fR and is included for compatibility with
2573 previous versions.
2574 .SS "Styles"
2575 .IX Subsection "Styles"
2576 A style refers to a convenient collection of existing parameters.
2577 .IP "\fB\-gnu\fR, \fB\-\-gnu\-style\fR" 4
2578 .IX Item "-gnu, --gnu-style"
2579 \&\fB\-gnu\fR gives an approximation to the \s-1GNU\s0 Coding Standards (which do
2580 not apply to perl) as they are sometimes implemented.  At present, this
2581 style overrides the default style with the following parameters:
2582 .Sp
2583 .Vb 1
2584 \&    \-lp \-bl \-noll \-pt=2 \-bt=2 \-sbt=2 \-icp
2585 .Ve
2586 .IP "\fB\-pbp\fR, \fB\-\-perl\-best\-practices\fR" 4
2587 .IX Item "-pbp, --perl-best-practices"
2588 \&\fB\-pbp\fR is an abbreviation for the parameters in the book \fBPerl Best Practices\fR
2589 by Damian Conway:
2590 .Sp
2591 .Vb 3
2592 \&    \-l=78 \-i=4 \-ci=4 \-st \-se \-vt=2 \-cti=0 \-pt=1 \-bt=1 \-sbt=1 \-bbt=1 \-nsfs \-nolq
2593 \&    \-wbb="% + \- * / x != == >= <= =~ !~ < > | & = 
2594 \&          **= += *= &= <<= &&= \-= /= |= >>= ||= //= .= %= ^= x="
2595 .Ve
2596 .Sp
2597 Please note that this parameter set includes \-st and \-se flags, which make
2598 perltidy act as a filter on one file only.  These can be overridden by placing
2599 \&\fB\-nst\fR and/or \fB\-nse\fR after the \-pbp parameter.
2600 .Sp
2601 Also note that the value of continuation indentation, \-ci=4, is equal to the
2602 value of the full indentation, \-i=4.  In some complex statements perltidy will
2603 produce nicer results with \-ci=2. This can be implemented by including \-ci=2
2604 after the \-pbp parameter.  For example,
2605 .Sp
2606 .Vb 11
2607 \&    # perltidy \-pbp
2608 \&    $self\->{_text} = (
2609 \&         !$section        ? \*(Aq\*(Aq
2610 \&        : $type eq \*(Aqitem\*(Aq ? "the $section entry"
2611 \&        :                   "the section on $section"
2612 \&        )
2613 \&        . (
2614 \&        $page
2615 \&        ? ( $section ? \*(Aq in \*(Aq : \*(Aq\*(Aq ) . "the $page$page_ext manpage"
2616 \&        : \*(Aq elsewhere in this document\*(Aq
2617 \&        );
2618 \&
2619 \&    # perltidy \-pbp \-ci=2
2620 \&    $self\->{_text} = (
2621 \&         !$section        ? \*(Aq\*(Aq
2622 \&        : $type eq \*(Aqitem\*(Aq ? "the $section entry"
2623 \&        :                   "the section on $section"
2624 \&      )
2625 \&      . (
2626 \&        $page
2627 \&        ? ( $section ? \*(Aq in \*(Aq : \*(Aq\*(Aq ) . "the $page$page_ext manpage"
2628 \&        : \*(Aq elsewhere in this document\*(Aq
2629 \&      );
2630 .Ve
2631 .SS "Other Controls"
2632 .IX Subsection "Other Controls"
2633 .IP "Deleting selected text" 4
2634 .IX Item "Deleting selected text"
2635 Perltidy can selectively delete comments and/or pod documentation.  The
2636 command \fB\-dac\fR or  \fB\-\-delete\-all\-comments\fR will delete all comments
2637 \&\fBand\fR all pod documentation, leaving just code and any leading system
2638 control lines.
2639 .Sp
2640 The command \fB\-dp\fR or \fB\-\-delete\-pod\fR will remove all pod documentation
2641 (but not comments).
2642 .Sp
2643 Two commands which remove comments (but not pod) are: \fB\-dbc\fR or
2644 \&\fB\-\-delete\-block\-comments\fR and \fB\-dsc\fR or  \fB\-\-delete\-side\-comments\fR.
2645 (Hanging side comments will be deleted with block comments here.)
2646 .Sp
2647 The negatives of these commands also work, and are the defaults.  When
2648 block comments are deleted, any leading 'hash\-bang' will be retained.
2649 Also, if the \fB\-x\fR flag is used, any system commands before a leading
2650 hash-bang will be retained (even if they are in the form of comments).
2651 .IP "Writing selected text to a file" 4
2652 .IX Item "Writing selected text to a file"
2653 When perltidy writes a formatted text file, it has the ability to also
2654 send selected text to a file with a \fI.TEE\fR extension.  This text can
2655 include comments and pod documentation.
2656 .Sp
2657 The command \fB\-tac\fR or  \fB\-\-tee\-all\-comments\fR will write all comments
2658 \&\fBand\fR all pod documentation.
2659 .Sp
2660 The command \fB\-tp\fR or \fB\-\-tee\-pod\fR will write all pod documentation (but
2661 not comments).
2662 .Sp
2663 The commands which write comments (but not pod) are: \fB\-tbc\fR or
2664 \&\fB\-\-tee\-block\-comments\fR and \fB\-tsc\fR or  \fB\-\-tee\-side\-comments\fR.
2665 (Hanging side comments will be written with block comments here.)
2666 .Sp
2667 The negatives of these commands also work, and are the defaults.
2668 .IP "Using a \fI.perltidyrc\fR command file" 4
2669 .IX Item "Using a .perltidyrc command file"
2670 If you use perltidy frequently, you probably won't be happy until you
2671 create a \fI.perltidyrc\fR file to avoid typing commonly-used parameters.
2672 Perltidy will first look in your current directory for a command file
2673 named \fI.perltidyrc\fR.  If it does not find one, it will continue looking
2674 for one in other standard locations.
2675 .Sp
2676 These other locations are system-dependent, and may be displayed with
2677 the command \f(CW\*(C`perltidy \-dpro\*(C'\fR.  Under Unix systems, it will first look
2678 for an environment variable \fB\s-1PERLTIDY\s0\fR.  Then it will look for a
2679 \&\fI.perltidyrc\fR file in the home directory, and then for a system-wide
2680 file \fI/usr/local/etc/perltidyrc\fR, and then it will look for
2681 \&\fI/etc/perltidyrc\fR.  Note that these last two system-wide files do not
2682 have a leading dot.  Further system-dependent information will be found
2683 in the \s-1INSTALL\s0 file distributed with perltidy.
2684 .Sp
2685 Under Windows, perltidy will also search for a configuration file named perltidy.ini since Windows does not allow files with a leading period (.).
2686 Use \f(CW\*(C`perltidy \-dpro\*(C'\fR to see the possible locations for your system.
2687 An example might be \fIC:\eDocuments and Settings\eAll Users\eperltidy.ini\fR.
2688 .Sp
2689 Another option is the use of the \s-1PERLTIDY\s0 environment variable.
2690 The method for setting environment variables depends upon the version of
2691 Windows that you are using.  Instructions for Windows 95 and later versions can
2692 be found here:
2693 .Sp
2694 http://www.netmanage.com/000/20021101_005_tcm21\-6336.pdf
2695 .Sp
2696 Under Windows \s-1NT\s0 / 2000 / \s-1XP\s0 the \s-1PERLTIDY\s0 environment variable can be placed in
2697 either the user section or the system section.  The later makes the
2698 configuration file common to all users on the machine.  Be sure to enter the
2699 full path of the configuration file in the value of the environment variable.
2700 Ex.  PERLTIDY=C:\eDocuments and Settings\eperltidy.ini
2701 .Sp
2702 The configuration file is free format, and simply a list of parameters, just as
2703 they would be entered on a command line.  Any number of lines may be used, with
2704 any number of parameters per line, although it may be easiest to read with one
2705 parameter per line.  Comment text begins with a #, and there must
2706 also be a space before the # for side comments.  It is a good idea to
2707 put complex parameters in either single or double quotes.
2708 .Sp
2709 Here is an example of a \fI.perltidyrc\fR file:
2710 .Sp
2711 .Vb 8
2712 \&  # This is a simple of a .perltidyrc configuration file
2713 \&  # This implements a highly spaced style
2714 \&  \-se    # errors to standard error output
2715 \&  \-w     # show all warnings
2716 \&  \-bl    # braces on new lines
2717 \&  \-pt=0  # parens not tight at all
2718 \&  \-bt=0  # braces not tight
2719 \&  \-sbt=0 # square brackets not tight
2720 .Ve
2721 .Sp
2722 The parameters in the \fI.perltidyrc\fR file are installed first, so any
2723 parameters given on the command line will have priority over them.
2724 .Sp
2725 To avoid confusion, perltidy ignores any command in the .perltidyrc
2726 file which would cause some kind of dump and an exit.  These are:
2727 .Sp
2728 .Vb 1
2729 \& \-h \-v \-ddf \-dln \-dop \-dsn \-dtt \-dwls \-dwrs \-ss
2730 .Ve
2731 .Sp
2732 There are several options may be helpful in debugging a \fI.perltidyrc\fR
2733 file:
2734 .RS 4
2735 .IP "\(bu" 4
2736 A very helpful command is \fB\-\-dump\-profile\fR or \fB\-dpro\fR.  It writes a
2737 list of all configuration filenames tested to standard output, and 
2738 if a file is found, it dumps the content to standard output before
2739 exiting.  So, to find out where perltidy looks for its configuration
2740 files, and which one if any it selects, just enter
2741 .Sp
2742 .Vb 1
2743 \&  perltidy \-dpro
2744 .Ve
2745 .IP "\(bu" 4
2746 It may be simplest to develop and test configuration files with
2747 alternative names, and invoke them with \fB\-pro=filename\fR on the command
2748 line.  Then rename the desired file to \fI.perltidyrc\fR when finished.
2749 .IP "\(bu" 4
2750 The parameters in the \fI.perltidyrc\fR file can be switched off with 
2751 the \fB\-npro\fR option.
2752 .IP "\(bu" 4
2753 The commands \fB\-\-dump\-options\fR, \fB\-\-dump\-defaults\fR, \fB\-\-dump\-long\-names\fR,
2754 and \fB\-\-dump\-short\-names\fR, all described below, may all be helpful.
2755 .RE
2756 .RS 4
2757 .RE
2758 .IP "Creating a new abbreviation" 4
2759 .IX Item "Creating a new abbreviation"
2760 A special notation is available for use in a \fI.perltidyrc\fR file
2761 for creating an abbreviation for a group
2762 of options.  This can be used to create a
2763 shorthand for one or more styles which are frequently, but not always,
2764 used.  The notation is to group the options within curly braces which
2765 are preceded by the name of the alias (without leading dashes), like this:
2766 .Sp
2767 .Vb 4
2768 \&        newword {
2769 \&        \-opt1
2770 \&        \-opt2
2771 \&        }
2772 .Ve
2773 .Sp
2774 where \fBnewword\fR is the abbreviation, and \fBopt1\fR, etc, are existing parameters
2775 \&\fIor other abbreviations\fR.  The main syntax requirement is that the new
2776 abbreviation along with its opening curly brace must begin on a new line.
2777 Space before and after the curly braces is optional.
2778 For a
2779 specific example, the following line
2780 .Sp
2781 .Vb 1
2782 \&        airy {\-bl \-pt=0 \-bt=0 \-sbt=0}
2783 .Ve
2784 .Sp
2785 could be placed in a \fI.perltidyrc\fR file, and then invoked at will with
2786 .Sp
2787 .Vb 1
2788 \&        perltidy \-airy somefile.pl
2789 .Ve
2790 .Sp
2791 (Either \f(CW\*(C`\-airy\*(C'\fR or \f(CW\*(C`\-\-airy\*(C'\fR may be used).
2792 .IP "Skipping leading non-perl commands with \fB\-x\fR or \fB\-\-look\-for\-hash\-bang\fR" 4
2793 .IX Item "Skipping leading non-perl commands with -x or --look-for-hash-bang"
2794 If your script has leading lines of system commands or other text which
2795 are not valid perl code, and which are separated from the start of the
2796 perl code by a \*(L"hash-bang\*(R" line, ( a line of the form \f(CW\*(C`#!...perl\*(C'\fR ),
2797 you must use the \fB\-x\fR flag to tell perltidy not to parse and format any
2798 lines before the \*(L"hash-bang\*(R" line.  This option also invokes perl with a
2799 \&\-x flag when checking the syntax.  This option was originally added to
2800 allow perltidy to parse interactive \s-1VMS\s0 scripts, but it should be used
2801 for any script which is normally invoked with \f(CW\*(C`perl \-x\*(C'\fR.
2802 .IP "Making a file unreadable" 4
2803 .IX Item "Making a file unreadable"
2804 The goal of perltidy is to improve the readability of files, but there
2805 are two commands which have the opposite effect, \fB\-\-mangle\fR and
2806 \&\fB\-\-extrude\fR.  They are actually
2807 merely aliases for combinations of other parameters.  Both of these
2808 strip all possible whitespace, but leave comments and pod documents,
2809 so that they are essentially reversible.  The
2810 difference between these is that \fB\-\-mangle\fR puts the fewest possible
2811 line breaks in a script while \fB\-\-extrude\fR puts the maximum possible.
2812 Note that these options do not provided any meaningful obfuscation, because
2813 perltidy can be used to reformat the files.  They were originally
2814 developed to help test the tokenization logic of perltidy, but they
2815 have other uses.
2816 One use for \fB\-\-mangle\fR is the following:
2817 .Sp
2818 .Vb 1
2819 \&  perltidy \-\-mangle myfile.pl \-st | perltidy \-o myfile.pl.new
2820 .Ve
2821 .Sp
2822 This will form the maximum possible number of one-line blocks (see next
2823 section), and can sometimes help clean up a badly formatted script.
2824 .Sp
2825 A similar technique can be used with \fB\-\-extrude\fR instead of \fB\-\-mangle\fR
2826 to make the minimum number of one-line blocks.
2827 .Sp
2828 Another use for \fB\-\-mangle\fR is to combine it with \fB\-dac\fR to reduce
2829 the file size of a perl script.
2830 .IP "One-line blocks" 4
2831 .IX Item "One-line blocks"
2832 There are a few points to note regarding one-line blocks.  A one-line
2833 block is something like this,
2834 .Sp
2835 .Vb 1
2836 \&        if ($x > 0) { $y = 1 / $x }
2837 .Ve
2838 .Sp
2839 where the contents within the curly braces is short enough to fit
2840 on a single line.
2841 .Sp
2842 With few exceptions, perltidy retains existing one-line blocks, if it
2843 is possible within the line-length constraint, but it does not attempt
2844 to form new ones.  In other words, perltidy will try to follow the
2845 one-line block style of the input file.
2846 .Sp
2847 If an existing one-line block is longer than the maximum line length,
2848 however, it will be broken into multiple lines.  When this happens, perltidy
2849 checks for and adds any optional terminating semicolon (unless the \fB\-nasc\fR
2850 option is used) if the block is a code block.
2851 .Sp
2852 The main exception is that perltidy will attempt to form new one-line
2853 blocks following the keywords \f(CW\*(C`map\*(C'\fR, \f(CW\*(C`eval\*(C'\fR, and \f(CW\*(C`sort\*(C'\fR, because
2854 these code blocks are often small and most clearly displayed in a single
2855 line.
2856 .Sp
2857 One-line block rules can conflict with the cuddled-else option.  When
2858 the cuddled-else option is used, perltidy retains existing one-line
2859 blocks, even if they do not obey cuddled-else formatting.
2860 .Sp
2861 Occasionally, when one-line blocks get broken because they exceed the
2862 available line length, the formatting will violate the requested brace style.
2863 If this happens, reformatting the script a second time should correct
2864 the problem.
2865 .IP "Debugging" 4
2866 .IX Item "Debugging"
2867 The following flags are available for debugging:
2868 .Sp
2869 \&\fB\-\-dump\-defaults\fR or \fB\-ddf\fR will write the default option set to standard output and quit
2870 .Sp
2871 \&\fB\-\-dump\-profile\fR or \fB\-dpro\fR  will write the name of the current 
2872 configuration file and its contents to standard output and quit.
2873 .Sp
2874 \&\fB\-\-dump\-options\fR or \fB\-dop\fR  will write current option set to standard
2875 output and quit.
2876 .Sp
2877 \&\fB\-\-dump\-long\-names\fR or \fB\-dln\fR  will write all command line long names (passed 
2878 to Get_options) to standard output and quit.
2879 .Sp
2880 \&\fB\-\-dump\-short\-names\fR  or \fB\-dsn\fR will write all command line short names 
2881 to standard output and quit.
2882 .Sp
2883 \&\fB\-\-dump\-token\-types\fR or \fB\-dtt\fR  will write a list of all token types 
2884 to standard output and quit.
2885 .Sp
2886 \&\fB\-\-dump\-want\-left\-space\fR or \fB\-dwls\fR  will write the hash \f(CW%want_left_space\fR
2887 to standard output and quit.  See the section on controlling whitespace
2888 around tokens.
2889 .Sp
2890 \&\fB\-\-dump\-want\-right\-space\fR or \fB\-dwrs\fR  will write the hash \f(CW%want_right_space\fR
2891 to standard output and quit.  See the section on controlling whitespace
2892 around tokens.
2893 .Sp
2894 \&\fB\-\-no\-memoize\fR or \fB\-nmem\fR  will turn of memoizing.
2895 Memoization can reduce run time when running perltidy repeatedly in a 
2896 single process.  It is on by default but can be deactivated for
2897 testing with \fB\-nmem\fR.
2898 .Sp
2899 \&\fB\-DEBUG\fR  will write a file with extension \fI.DEBUG\fR for each input file 
2900 showing the tokenization of all lines of code.
2901 .IP "Working with MakeMaker, AutoLoader and SelfLoader" 4
2902 .IX Item "Working with MakeMaker, AutoLoader and SelfLoader"
2903 The first \f(CW$VERSION\fR line of a file which might be eval'd by MakeMaker
2904 is passed through unchanged except for indentation.  
2905 Use \fB\-\-nopass\-version\-line\fR, or \fB\-npvl\fR, to deactivate this feature.
2906 .Sp
2907 If the AutoLoader module is used, perltidy will continue formatting
2908 code after seeing an _\|_END_\|_ line.
2909 Use \fB\-\-nolook\-for\-autoloader\fR, or \fB\-nlal\fR, to deactivate this feature.
2910 .Sp
2911 Likewise, if the SelfLoader module is used, perltidy will continue formatting
2912 code after seeing a _\|_DATA_\|_ line.
2913 Use \fB\-\-nolook\-for\-selfloader\fR, or \fB\-nlsl\fR, to deactivate this feature.
2914 .IP "Working around problems with older version of Perl" 4
2915 .IX Item "Working around problems with older version of Perl"
2916 Perltidy contains a number of rules which help avoid known subtleties
2917 and problems with older versions of perl, and these rules always
2918 take priority over whatever formatting flags have been set.  For example,
2919 perltidy will usually avoid starting a new line with a bareword, because
2920 this might cause problems if \f(CW\*(C`use strict\*(C'\fR is active.
2921 .Sp
2922 There is no way to override these rules.
2923 .SH "HTML OPTIONS"
2924 .IX Header "HTML OPTIONS"
2925 .IP "The \fB\-html\fR master switch" 4
2926 .IX Item "The -html master switch"
2927 The flag \fB\-html\fR causes perltidy to write an html file with extension
2928 \&\fI.html\fR.  So, for example, the following command
2929 .Sp
2930 .Vb 1
2931 \&        perltidy \-html somefile.pl
2932 .Ve
2933 .Sp
2934 will produce a syntax-colored html file named \fIsomefile.pl.html\fR
2935 which may be viewed with a browser.
2936 .Sp
2937 \&\fBPlease Note\fR: In this case, perltidy does not do any formatting to the
2938 input file, and it does not write a formatted file with extension
2939 \&\fI.tdy\fR.  This means that two perltidy runs are required to create a
2940 fully reformatted, html copy of a script.
2941 .IP "The \fB\-pre\fR flag for code snippets" 4
2942 .IX Item "The -pre flag for code snippets"
2943 When the \fB\-pre\fR flag is given, only the pre-formatted section, within
2944 the <\s-1PRE\s0> and </PRE> tags, will be output.  This simplifies inclusion
2945 of the output in other files.  The default is to output a complete
2946 web page.
2947 .IP "The \fB\-nnn\fR flag for line numbering" 4
2948 .IX Item "The -nnn flag for line numbering"
2949 When the \fB\-nnn\fR flag is given, the output lines will be numbered.
2950 .IP "The \fB\-toc\fR, or \fB\-\-html\-table\-of\-contents\fR flag" 4
2951 .IX Item "The -toc, or --html-table-of-contents flag"
2952 By default, a table of contents to packages and subroutines will be
2953 written at the start of html output.  Use \fB\-ntoc\fR to prevent this.
2954 This might be useful, for example, for a pod document which contains a
2955 number of unrelated code snippets.  This flag only influences the code
2956 table of contents; it has no effect on any table of contents produced by
2957 pod2html (see next item).
2958 .IP "The \fB\-pod\fR, or \fB\-\-pod2html\fR flag" 4
2959 .IX Item "The -pod, or --pod2html flag"
2960 There are two options for formatting pod documentation.  The default is
2961 to pass the pod through the Pod::Html module (which forms the basis of
2962 the pod2html utility).  Any code sections are formatted by perltidy, and
2963 the results then merged.  Note: perltidy creates a temporary file when
2964 Pod::Html is used; see \*(L"\s-1FILES\s0\*(R".  Also, Pod::Html creates temporary
2965 files for its cache.
2966 .Sp
2967 \&\s-1NOTE:\s0 Perltidy counts the number of \f(CW\*(C`=cut\*(C'\fR lines, and either moves the
2968 pod text to the top of the html file if there is one \f(CW\*(C`=cut\*(C'\fR, or leaves
2969 the pod text in its original order (interleaved with code) otherwise.
2970 .Sp
2971 Most of the flags accepted by pod2html may be included in the perltidy
2972 command line, and they will be passed to pod2html.  In some cases,
2973 the flags have a prefix \f(CW\*(C`pod\*(C'\fR to emphasize that they are for the
2974 pod2html, and this prefix will be removed before they are passed to
2975 pod2html.  The flags which have the additional \f(CW\*(C`pod\*(C'\fR prefix are:
2976 .Sp
2977 .Vb 2
2978 \&   \-\-[no]podheader \-\-[no]podindex \-\-[no]podrecurse \-\-[no]podquiet 
2979 \&   \-\-[no]podverbose \-\-podflush
2980 .Ve
2981 .Sp
2982 The flags which are unchanged from their use in pod2html are:
2983 .Sp
2984 .Vb 2
2985 \&   \-\-backlink=s \-\-cachedir=s \-\-htmlroot=s \-\-libpods=s \-\-title=s
2986 \&   \-\-podpath=s \-\-podroot=s
2987 .Ve
2988 .Sp
2989 where 's' is an appropriate character string.  Not all of these flags are
2990 available in older versions of Pod::Html.  See your Pod::Html documentation for
2991 more information.
2992 .Sp
2993 The alternative, indicated with \fB\-npod\fR, is not to use Pod::Html, but
2994 rather to format pod text in italics (or whatever the stylesheet
2995 indicates), without special html markup.  This is useful, for example,
2996 if pod is being used as an alternative way to write comments.
2997 .IP "The \fB\-frm\fR, or \fB\-\-frames\fR flag" 4
2998 .IX Item "The -frm, or --frames flag"
2999 By default, a single html output file is produced.  This can be changed
3000 with the \fB\-frm\fR option, which creates a frame holding a table of
3001 contents in the left panel and the source code in the right side. This
3002 simplifies code browsing.  Assume, for example, that the input file is
3003 \&\fIMyModule.pm\fR.  Then, for default file extension choices, these three
3004 files will be created:
3005 .Sp
3006 .Vb 3
3007 \& MyModule.pm.html      \- the frame
3008 \& MyModule.pm.toc.html  \- the table of contents
3009 \& MyModule.pm.src.html  \- the formatted source code
3010 .Ve
3011 .Sp
3012 Obviously this file naming scheme requires that output be directed to a real
3013 file (as opposed to, say, standard output).  If this is not the
3014 case, or if the file extension is unknown, the \fB\-frm\fR option will be
3015 ignored.
3016 .IP "The \fB\-text=s\fR, or \fB\-\-html\-toc\-extension\fR flag" 4
3017 .IX Item "The -text=s, or --html-toc-extension flag"
3018 Use this flag to specify the extra file extension of the table of contents file
3019 when html frames are used.  The default is \*(L"toc\*(R".
3020 See \*(L"Specifying File Extensions\*(R".
3021 .IP "The \fB\-sext=s\fR, or \fB\-\-html\-src\-extension\fR flag" 4
3022 .IX Item "The -sext=s, or --html-src-extension flag"
3023 Use this flag to specify the extra file extension of the content file when html
3024 frames are used.  The default is \*(L"src\*(R".
3025 See \*(L"Specifying File Extensions\*(R".
3026 .IP "The \fB\-hent\fR, or \fB\-\-html\-entities\fR flag" 4
3027 .IX Item "The -hent, or --html-entities flag"
3028 This flag controls the use of Html::Entities for html formatting.  By
3029 default, the module Html::Entities is used to encode special symbols.
3030 This may not be the right thing for some browser/language
3031 combinations.  Use \-\-nohtml\-entities or \-nhent to prevent this.
3032 .IP "Style Sheets" 4
3033 .IX Item "Style Sheets"
3034 Style sheets make it very convenient to control and adjust the
3035 appearance of html pages.  The default behavior is to write a page of
3036 html with an embedded style sheet.
3037 .Sp
3038 An alternative to an embedded style sheet is to create a page with a
3039 link to an external style sheet.  This is indicated with the
3040 \&\fB\-css=filename\fR,  where the external style sheet is \fIfilename\fR.  The
3041 external style sheet \fIfilename\fR will be created if and only if it does
3042 not exist.  This option is useful for controlling multiple pages from a
3043 single style sheet.
3044 .Sp
3045 To cause perltidy to write a style sheet to standard output and exit,
3046 use the \fB\-ss\fR, or \fB\-\-stylesheet\fR, flag.  This is useful if the style
3047 sheet could not be written for some reason, such as if the \fB\-pre\fR flag
3048 was used.  Thus, for example,
3049 .Sp
3050 .Vb 1
3051 \&  perltidy \-html \-ss >mystyle.css
3052 .Ve
3053 .Sp
3054 will write a style sheet with the default properties to file
3055 \&\fImystyle.css\fR.
3056 .Sp
3057 The use of style sheets is encouraged, but a web page without a style
3058 sheets can be created with the flag \fB\-nss\fR.  Use this option if you
3059 must to be sure that older browsers (roughly speaking, versions prior to
3060 4.0 of Netscape Navigator and Internet Explorer) can display the
3061 syntax-coloring of the html files.
3062 .IP "Controlling \s-1HTML\s0 properties" 4
3063 .IX Item "Controlling HTML properties"
3064 Note: It is usually more convenient to accept the default properties
3065 and then edit the stylesheet which is produced.  However, this section
3066 shows how to control the properties with flags to perltidy.
3067 .Sp
3068 Syntax colors may be changed from their default values by flags of the either
3069 the long form, \fB\-html\-color\-xxxxxx=n\fR, or more conveniently the short form,
3070 \&\fB\-hcx=n\fR, where \fBxxxxxx\fR is one of the following words, and \fBx\fR is the
3071 corresponding abbreviation:
3072 .Sp
3073 .Vb 10
3074 \&      Token Type             xxxxxx           x 
3075 \&      \-\-\-\-\-\-\-\-\-\-             \-\-\-\-\-\-\-\-         \-\-
3076 \&      comment                comment          c
3077 \&      number                 numeric          n
3078 \&      identifier             identifier       i
3079 \&      bareword, function     bareword         w
3080 \&      keyword                keyword          k
3081 \&      quite, pattern         quote            q
3082 \&      here doc text          here\-doc\-text    h
3083 \&      here doc target        here\-doc\-target  hh
3084 \&      punctuation            punctuation      pu
3085 \&      parentheses            paren            p
3086 \&      structural braces      structure        s
3087 \&      semicolon              semicolon        sc
3088 \&      colon                  colon            co
3089 \&      comma                  comma            cm
3090 \&      label                  label            j
3091 \&      sub definition name    subroutine       m
3092 \&      pod text               pod\-text         pd
3093 .Ve
3094 .Sp
3095 A default set of colors has been defined, but they may be changed by providing
3096 values to any of the following parameters, where \fBn\fR is either a 6 digit 
3097 hex \s-1RGB\s0 color value or an ascii name for a color, such as 'red'.
3098 .Sp
3099 To illustrate, the following command will produce an html 
3100 file \fIsomefile.pl.html\fR with \*(L"aqua\*(R" keywords:
3101 .Sp
3102 .Vb 1
3103 \&        perltidy \-html \-hck=00ffff somefile.pl
3104 .Ve
3105 .Sp
3106 and this should be equivalent for most browsers:
3107 .Sp
3108 .Vb 1
3109 \&        perltidy \-html \-hck=aqua somefile.pl
3110 .Ve
3111 .Sp
3112 Perltidy merely writes any non-hex names that it sees in the html file.
3113 The following 16 color names are defined in the \s-1HTML\s0 3.2 standard:
3114 .Sp
3115 .Vb 10
3116 \&        black   => 000000,
3117 \&        silver  => c0c0c0,
3118 \&        gray    => 808080,
3119 \&        white   => ffffff,
3120 \&        maroon  => 800000,
3121 \&        red     => ff0000,
3122 \&        purple  => 800080,
3123 \&        fuchsia => ff00ff,
3124 \&        green   => 008000,
3125 \&        lime    => 00ff00,
3126 \&        olive   => 808000,
3127 \&        yellow  => ffff00
3128 \&        navy    => 000080,
3129 \&        blue    => 0000ff,
3130 \&        teal    => 008080,
3131 \&        aqua    => 00ffff,
3132 .Ve
3133 .Sp
3134 Many more names are supported in specific browsers, but it is safest
3135 to use the hex codes for other colors.  Helpful color tables can be
3136 located with an internet search for \*(L"\s-1HTML\s0 color tables\*(R".
3137 .Sp
3138 Besides color, two other character attributes may be set: bold, and italics.
3139 To set a token type to use bold, use the flag
3140 \&\fB\-\-html\-bold\-xxxxxx\fR or \fB\-hbx\fR, where \fBxxxxxx\fR or \fBx\fR are the long
3141 or short names from the above table.  Conversely, to set a token type to 
3142 \&\s-1NOT\s0 use bold, use \fB\-\-nohtml\-bold\-xxxxxx\fR or \fB\-nhbx\fR.
3143 .Sp
3144 Likewise, to set a token type to use an italic font, use the flag
3145 \&\fB\-\-html\-italic\-xxxxxx\fR or \fB\-hix\fR, where again \fBxxxxxx\fR or \fBx\fR are the
3146 long or short names from the above table.  And to set a token type to
3147 \&\s-1NOT\s0 use italics, use \fB\-\-nohtml\-italic\-xxxxxx\fR or \fB\-nhix\fR.
3148 .Sp
3149 For example, to use bold braces and lime color, non-bold, italics keywords the
3150 following command would be used:
3151 .Sp
3152 .Vb 1
3153 \&        perltidy \-html \-hbs \-hck=00FF00 \-nhbk \-hik somefile.pl
3154 .Ve
3155 .Sp
3156 The background color can be specified with \fB\-\-html\-color\-background=n\fR,
3157 or \fB\-hcbg=n\fR for short, where n is a 6 character hex \s-1RGB\s0 value.  The
3158 default color of text is the value given to \fBpunctuation\fR, which is
3159 black as a default.
3160 .Sp
3161 Here are some notes and hints:
3162 .Sp
3163 1. If you find a preferred set of these parameters, you may want
3164 to create a \fI.perltidyrc\fR file containing them.  See the perltidy man
3165 page for an explanation.
3166 .Sp
3167 2. Rather than specifying values for these parameters, it is probably
3168 easier to accept the defaults and then edit a style sheet.  The style
3169 sheet contains comments which should make this easy.
3170 .Sp
3171 3. The syntax-colored html files can be very large, so it may be best to
3172 split large files into smaller pieces to improve download times.
3173 .SH "SOME COMMON INPUT CONVENTIONS"
3174 .IX Header "SOME COMMON INPUT CONVENTIONS"
3175 .SS "Specifying Block Types"
3176 .IX Subsection "Specifying Block Types"
3177 Several parameters which refer to code block types may be customized by also
3178 specifying an associated list of block types.  The type of a block is the name
3179 of the keyword which introduces that block, such as \fBif\fR, \fBelse\fR, or \fBsub\fR.
3180 An exception is a labeled block, which has no keyword, and should be specified
3181 with just a colon.  To specify all blocks use \fB'*'\fR.
3182 .PP
3183 The keyword \fBsub\fR indicates a named sub.  For anonymous subs, use the special
3184 keyword \fBasub\fR.
3185 .PP
3186 For example, the following parameter specifies \f(CW\*(C`sub\*(C'\fR, labels, \f(CW\*(C`BEGIN\*(C'\fR, and
3187 \&\f(CW\*(C`END\*(C'\fR blocks:
3188 .PP
3189 .Vb 1
3190 \&   \-cscl="sub : BEGIN END"
3191 .Ve
3192 .PP
3193 (the meaning of the \-cscl parameter is described above.)  Note that
3194 quotes are required around the list of block types because of the
3195 spaces.  For another example, the following list specifies all block types
3196 for vertical tightness:
3197 .PP
3198 .Vb 1
3199 \&   \-bbvtl=\*(Aq*\*(Aq
3200 .Ve
3201 .SS "Specifying File Extensions"
3202 .IX Subsection "Specifying File Extensions"
3203 Several parameters allow default file extensions to be overridden.  For
3204 example, a backup file extension may be specified with \fB\-bext=ext\fR,
3205 where \fBext\fR is some new extension.  In order to provides the user some
3206 flexibility, the following convention is used in all cases to decide if
3207 a leading '.' should be used.  If the extension \f(CW\*(C`ext\*(C'\fR begins with
3208 \&\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
3209 an intermediate '.' (or perhaps an '_' on \s-1VMS\s0 systems).  Otherwise, it
3210 will be appended directly.
3211 .PP
3212 For example, suppose the file is \fIsomefile.pl\fR.  For \f(CW\*(C`\-bext=old\*(C'\fR, a '.' is
3213 added to give \fIsomefile.pl.old\fR.  For \f(CW\*(C`\-bext=.old\*(C'\fR, no additional '.' is
3214 added, so again the backup file is \fIsomefile.pl.old\fR.  For \f(CW\*(C`\-bext=~\*(C'\fR, then no
3215 dot is added, and the backup file will be \fIsomefile.pl~\fR  .
3216 .SH "SWITCHES WHICH MAY BE NEGATED"
3217 .IX Header "SWITCHES WHICH MAY BE NEGATED"
3218 The following list shows all short parameter names which allow a prefix
3219 \&'n' to produce the negated form:
3220 .PP
3221 .Vb 6
3222 \& D    anl asc  aws  b    bbb bbc bbs  bl   bli  boc bok  bol  bot  ce
3223 \& csc  dac dbc  dcsc ddf  dln dnl dop  dp   dpro dsc dsm  dsn  dtt  dwls
3224 \& dwrs dws f    fll  frm  fs  hsc html ibc  icb  icp iob  isbc lal  log
3225 \& lp   lsl ohbr okw  ola  oll opr opt  osbr otr  ple  pod  pvl  q
3226 \& sbc  sbl schb scp  scsb sct se  sfp  sfs  skp  sob sohb sop  sosb sot
3227 \& ssc  st  sts  syn  t    tac tbc toc  tp   tqw  tsc w    x    bar  kis
3228 .Ve
3229 .PP
3230 Equivalently, the prefix 'no' or 'no\-' on the corresponding long names may be
3231 used.
3232 .SH "LIMITATIONS"
3233 .IX Header "LIMITATIONS"
3234 .IP "Parsing Limitations" 4
3235 .IX Item "Parsing Limitations"
3236 Perltidy should work properly on most perl scripts.  It does a lot of
3237 self-checking, but still, it is possible that an error could be
3238 introduced and go undetected.  Therefore, it is essential to make
3239 careful backups and to test reformatted scripts.
3240 .Sp
3241 The main current limitation is that perltidy does not scan modules
3242 included with 'use' statements.  This makes it necessary to guess the
3243 context of any bare words introduced by such modules.  Perltidy has good
3244 guessing algorithms, but they are not infallible.  When it must guess,
3245 it leaves a message in the log file.
3246 .Sp
3247 If you encounter a bug, please report it.
3248 .IP "What perltidy does not parse and format" 4
3249 .IX Item "What perltidy does not parse and format"
3250 Perltidy indents but does not reformat comments and \f(CW\*(C`qw\*(C'\fR quotes. 
3251 Perltidy does not in any way modify the contents of here documents or
3252 quoted text, even if they contain source code.  (You could, however,
3253 reformat them separately).  Perltidy does not format 'format' sections
3254 in any way.  And, of course, it does not modify pod documents.
3255 .SH "FILES"
3256 .IX Header "FILES"
3257 .IP "Temporary files" 4
3258 .IX Item "Temporary files"
3259 Under the \-html option with the default \-\-pod2html flag, a temporary file is
3260 required to pass text to Pod::Html.  Unix systems will try to use the \s-1POSIX\s0
3261 \&\fItmpnam()\fR function.  Otherwise the file \fIperltidy.TMP\fR will be temporarily
3262 created in the current working directory.
3263 .IP "Special files when standard input is used" 4
3264 .IX Item "Special files when standard input is used"
3265 When standard input is used, the log file, if saved, is \fIperltidy.LOG\fR,
3266 and any errors are written to \fIperltidy.ERR\fR unless the \fB\-se\fR flag is
3267 set.  These are saved in the current working directory.
3268 .IP "Files overwritten" 4
3269 .IX Item "Files overwritten"
3270 The following file extensions are used by perltidy, and files with these
3271 extensions may be overwritten or deleted: \fI.ERR\fR, \fI.LOG\fR, \fI.TEE\fR,
3272 and/or \fI.tdy\fR, \fI.html\fR, and \fI.bak\fR, depending on the run type and
3273 settings.
3274 .IP "Files extensions limitations" 4
3275 .IX Item "Files extensions limitations"
3276 Perltidy does not operate on files for which the run could produce a file with
3277 a duplicated file extension.  These extensions include \fI.LOG\fR, \fI.ERR\fR,
3278 \&\fI.TEE\fR, and perhaps \fI.tdy\fR and \fI.bak\fR, depending on the run type.  The
3279 purpose of this rule is to prevent generating confusing filenames such as
3280 \&\fIsomefile.tdy.tdy.tdy\fR.
3281 .SH "SEE ALSO"
3282 .IX Header "SEE ALSO"
3283 \&\fIperlstyle\fR\|(1), \fIPerl::Tidy\fR\|(3)
3284 .SH "VERSION"
3285 .IX Header "VERSION"
3286 This man page documents perltidy version 20170521.
3287 .SH "BUG REPORTS"
3288 .IX Header "BUG REPORTS"
3289 A list of current bugs and issues can be found at the \s-1CPAN\s0 site
3290 .PP
3291 .Vb 1
3292 \&     https://rt.cpan.org/Public/Dist/Display.html?Name=Perl\-Tidy
3293 .Ve
3294 .PP
3295 To report a new bug or problem, use the link on this page.
3296 .SH "COPYRIGHT"
3297 .IX Header "COPYRIGHT"
3298 Copyright (c) 2000\-2017 by Steve Hancock
3299 .SH "LICENSE"
3300 .IX Header "LICENSE"
3301 This package is free software; you can redistribute it and/or modify it
3302 under the terms of the \*(L"\s-1GNU\s0 General Public License\*(R".
3303 .PP
3304 Please refer to the file \*(L"\s-1COPYING\s0\*(R" for details.
3305 .SH "DISCLAIMER"
3306 .IX Header "DISCLAIMER"
3307 This package is distributed in the hope that it will be useful,
3308 but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of
3309 \&\s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0.
3310 .PP
3311 See the \*(L"\s-1GNU\s0 General Public License\*(R" for more details.