5 - No significant bugs have been found since the last release to CPAN.
6 Several minor issues have been fixed, and some new parameters have been
9 - Added parameter --one-line-block-exclusion-list=s, or -olbxl=s, where
10 s is a list of block types which should not automatically be turned
11 into one-line blocks. This implements the issue raised in PR #111.
12 The list s may include any of the words 'sort map grep eval', or
13 it may be '*' to indicate all of these. So for example to prevent
14 multi-line 'eval' blocks from becoming one-line blocks, the command
15 would be -olbxl='eval'.
17 - For the -b (--backup-and-modify-in-place) option, the file timestamps
18 are changing (git #113, rt#145999). First, if there are no formatting
19 changes to an input file, it will keep its original modification time.
20 Second, any backup file will keep its original modification time. This
21 was previously true for --backup-method=move but not for the default
22 --backup-method=copy. The purpose of these changes is to avoid
23 triggering Makefile operations when there are no actual file changes.
24 If this causes a problem please open an issue for discussion on github.
26 - A change was made to the way line breaks are made at the '.'
27 operator when the user sets -wba='.' to requests breaks after a '.'
28 ( this setting is not recommended because it can be hard to read ).
29 The goal of the change is to make switching from breaks before '.'s
30 to breaks after '.'s just move the dots from the end of
31 lines to the beginning of lines. For example:
33 # default and recommended (--want-break-before='.'):
39 . '_JAVA)' . "\n" . "\t"
40 . '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) '
41 . '$(JAVACFLAGS) $?' . "\n" . "\t"
42 . 'echo timestamp > class'
47 # perltidy --want-break-after='.'
53 '_JAVA)' . "\n" . "\t" .
54 '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) ' .
55 '$(JAVACFLAGS) $?' . "\n" . "\t" .
56 'echo timestamp > class' .
61 For existing code formatted with -wba='.', this may cause some
62 changes in the formatting of code with long concatenation chains.
64 - Added option --use-feature=class, or -uf=class, for issue rt #145706.
65 This adds keywords 'class', 'method', 'field', and 'ADJUST' in support of
66 this feature which is being tested for future inclusion in Perl.
67 An effort has been made to avoid conflicts with past uses of these
68 words, especially 'method' and 'class'. The default setting
69 is --use-feature=class. If this causes a conflict, this option can
70 be turned off by entering -uf=' '.
72 In other words, perltidy should work for both old and new uses of
73 these keywords with the default settings, but this flag is available
76 - Added option -bfvt=n, or --brace-follower-vertical-tightness=n,
77 for part of issue git #110. For n=2, this option looks for lines
78 which would otherwise be, by default,
83 and joins them into a single line
87 where the or can be one of a number of logical operators or if unless.
88 The default is not to do this and can be indicated with n=1.
90 - Added option -cpb, or --cuddled-paren-brace, for issue git #110.
91 This option will cause perltidy to join two lines which
92 otherwise would be, by default,
101 - Some minor changes to existing formatted output may occur as a result
102 of fixing minor formatting issues with edge cases. This is especially
103 true for code which uses the -lp or -xlp styles.
105 - Added option -dbs, or --dump-block-summary, to dump summary
106 information about code blocks in a file to standard output.
107 The basic command is:
109 perltidy -dbs somefile.pl >blocks.csv
111 Instead of formatting ``somefile.pl``, this dumps the following
112 comma-separated items describing its blocks to the standard output:
114 filename - the name of the file
115 line - the line number of the opening brace of this block
116 line_count - the number of lines between opening and closing braces
117 code_lines - the number of lines excluding blanks, comments, and pod
118 type - the block type (sub, for, foreach, ...)
119 name - the block name if applicable (sub name, label, asub name)
120 depth - the nesting depth of the opening block brace
121 max_change - the change in depth to the most deeply nested code block
122 block_count - the total number of code blocks nested in this block
123 mccabe_count - the McCabe complexity measure of this code block
125 This can be useful for code restructuring. The man page for perltidy
126 has more information and describes controls for selecting block types.
128 - This version was stress-tested for over 100 cpu hours with random
129 input parameters. No failures to converge, internal fault checks,
130 undefined variable references or other irregularities were seen.
132 - This version runs a few percent faster than the previous release on
133 large files due to optimizations made with the help of Devel::NYTProf.
137 - Fix rt #145095, undef warning in Perl before 5.12. Version 20221112 is
138 identical to 2022111 except for this fix for older versions of Perl.
140 - No significant bugs have been found since the last release to CPAN.
141 Several minor issues have been fixed, and some new parameters have been
144 - Fixed rare problem with irregular indentation involving --cuddled-else,
145 usually also with the combination -xci and -lp. Reported in rt #144979.
147 - Add option --weld-fat-comma (-wfc) for issue git #108. When -wfc
148 is set, along with -wn, perltidy is allowed to weld an opening paren
149 to an inner opening container when they are separated by a hash key
150 and fat comma (=>). For example:
156 some_other_arg3 => $bar->{'baz'},
161 elf->call_method( method_name_foo => {
163 some_other_arg3 => $bar->{'baz'},
166 This flag is off by default.
168 - Fix issue git #106. This fixes some edge cases of formatting with the
169 combination -xlp -pt=2, mainly for two-line lists with short function
170 names. One indentation space is removed to improve alignment:
172 # OLD: perltidy -xlp -pt=2
173 is($module->VERSION, $expected,
174 "$main_module->VERSION matches $module->VERSION ($expected)");
176 # NEW: perltidy -xlp -pt=2
177 is($module->VERSION, $expected,
178 "$main_module->VERSION matches $module->VERSION ($expected)");
180 - Fix for issue git #105, incorrect formatting with 5.36 experimental
183 - Fix for issue git #103. For parameter -b, or --backup-and-modify-in-place,
184 the default backup method has been changed to preserve the inode value
185 of the file being formatted. If this causes a problem, the previous
186 method is available and can be used by setting -backup-mode='move', or
187 -bm='move'. The new default corresponds to -bm='copy'. The difference
188 between the two methods is as follows. For the older method,
189 -bm='move', the input file was moved to the backup, and a new file was
190 created for the formatted output. This caused the inode to change. For
191 the new default method, -bm='copy', the input is copied to the backup
192 and then the input file is reopened and rewritten. This preserves the
193 file inode. Tests have not produced any problems with this change, but
194 before using the --backup-and-modify-in-place parameter please verify
195 that it works correctly in your environment and operating system. The
196 initial update for this had an error which was caught and fixed
199 - Fix undefined value message when perltidy -D is used (git #104)
201 - Fixed an inconsistency in html colors near pointers when -html is used.
202 Previously, a '->' at the end of a line got the 'punctuation color', black
203 by default but a '->' before an identifier got the color of the following
204 identifier. Now all pointers get the same color, which is black by default.
205 Also, previously a word following a '->' was given the color of a bareword,
206 black by default, but now it is given the color of an identifier.
208 - Fixed incorrect indentation of any function named 'err'. This was
209 due to some old code from when "use feature 'err'" was valid.
212 my ($curr) = current();
216 my ($curr) = current();
219 - Added parameter --delete-repeated-commas (-drc) to delete repeated
220 commas. This is off by default. For example, given:
222 ignoreSpec( $file, "file",, \%spec, \%Rspec );
225 ignoreSpec( $file, "file", \%spec, \%Rspec );
227 - Add continuation indentation to long C-style 'for' terms; i.e.
234 && $array->[$j] gt $array->[ $j + $shell ] ;
243 && $array->[$j] gt $array->[ $j + $shell ] ;
247 This will change some existing formatting with very long 'for' terms.
249 - The following new parameters are available for manipulating
250 trailing commas of lists. They are described in the manual.
252 --want-trailing-commas=s, -wtc=s
253 --add-trailing-commas, -atc
254 --delete-trailing-commas, -dtc
255 --delete-weld-interfering-commas, -dwic
257 - Files with errors due to missing, extra or misplaced parens, braces,
258 or square brackets are now written back out verbatim, without any
259 attempt at formatting.
261 - This version runs 10 to 15 percent faster than the previous
262 release on large files due to optimizations made with the help of
265 - This version was stress-tested for over 200 cpu hours with random
266 input parameters. No failures to converge, internal fault checks,
267 undefined variable references or other irregularities were seen.
271 - No significant bugs have been found since the last release but users
272 of programs which call the Perl::Tidy module should note the first
273 item below, which changes a default setting. The main change to
274 existing formatting is the second item below, which adds vertical
275 alignment to 'use' statements.
277 - The flag --encode-output-strings, or -eos, is now set 'on' by default.
278 This has no effect on the use of the 'perltidy' binary script, but could
279 change the behavior of some programs which use the Perl::Tidy module on
280 files encoded in UTF-8. If any problems are noticed, an emergency fix
281 can be made by reverting to the old default by setting -neos. For
282 an explanation of why this change needs to be made see:
284 https://github.com/perltidy/perltidy/issues/92
286 https://github.com/perltidy/perltidy/blob/master/docs/eos_flag.md
288 - Added vertical alignment for qw quotes and empty parens in 'use'
289 statements (see issue #git 93). This new alignment is 'on' by default
290 and will change formatting as shown below. If this is not wanted it can
291 be turned off with the parameter -vxl='q' (--valign-exclusion-list='q').
293 # old default, or -vxl='q'
294 use Getopt::Long qw(GetOptions);
295 use Fcntl qw(O_RDONLY O_WRONLY O_EXCL O_CREAT);
296 use Symbol qw(gensym);
300 use Getopt::Long qw(GetOptions);
301 use Fcntl qw(O_RDONLY O_WRONLY O_EXCL O_CREAT);
302 use Symbol qw(gensym);
305 - The parameter -kbb (--keep-break-before) now ignores a request to break
306 before an opening token, such as '('. Likewise, -kba (--keep-break-after)
307 now ignores a request to break after a closing token, such as ')'. This
308 change was made to avoid a rare instability discovered in random testing.
310 - Previously, if a -dsc command was used to delete all side comments,
311 then any special side comments for controlling non-indenting braces got
312 deleted too. Now, these control side comments are retained when -dsc is
313 set unless a -nnib (--nonon-indenting-braces) flag is also set to
316 - This version runs about 10 percent faster on large files than the previous
317 release due to optimizations made with the help of Devel::NYTProf. Much
318 of the gain came from faster processing of blank tokens and comments.
320 - This version of perltidy was stress-tested for many cpu hours with
321 random input parameters. No failures to converge, internal fault checks,
322 undefined variable references or other irregularities were seen.
326 - A new flag, --encode-output-strings, or -eos, has been added to resolve
327 issue git #83. This issue involves the interface between Perl::Tidy and
328 calling programs, and Code::TidyAll (tidyall) in particular. The problem
329 is that perltidy by default returns decoded character strings, but
330 tidyall expects encoded strings. This flag provides a fix for that.
332 So, tidyall users who process encoded (utf8) files should update to this
333 version of Perl::Tidy and use -eos for tidyall. For further info see:
335 https://github.com/houseabsolute/perl-code-tidyall/issues/84, and
336 https://github.com/perltidy/perltidy/issues/83
338 If there are other applications having utf8 problems at the interface
339 with Perl::Tidy, this flag probably may need to be set.
341 - The default value of the new flag, --encode-output-strings, -eos, is currently
342 -neos BUT THIS MAY CHANGE in a future release because the current
343 default is inconvenient. So authors of programs which receive character
344 strings back from Perl::Tidy should set this flag, if necessary,
345 to avoid any problems when the default changes. For more information see the
346 above links and the Perl::Tidy man pages for example coding.
348 - The possible values of the string 's' for the flag '--character-encoding=s'
349 have been limited to 'utf8' (or UTF-8), 'none', or 'guess'. Previously an
350 arbitrary encoding could also be specified, but as a result of discussions
351 regarding git #83 it became clear that this could cause trouble
352 since the output encoding was still restricted to UTF-8. Users
353 who need to work in other encodings can write a short program calling
354 Perl::Tidy with pre- and post-processing to handle encoding/decoding.
356 - A new flag --break-after-labels=i, or -bal=i, was added for git #86. This
357 controls line breaks after labels, to provide a uniform style, as follows:
359 -bal=0 follows the input line breaks [DEFAULT]
360 -bal=1 always break after a label
361 -bal=2 never break after a label
376 - Fix issue git #82, an error handling something like ${bareword} in a
377 possible indirect object location. Perl allows this, now perltidy does too.
379 - The flags -kbb=s or --keep-old-breakpoints-before=s, and its counterpart
380 -kba=s or --keep-old-breakpoints-after=s have expanded functionality
381 for the container tokens: { [ ( } ] ). The updated man pages have
384 - Two new flags have been added to provide finer vertical alignment control,
385 --valign-exclusion-list=s (-vxl=s) and --valign-inclusion-list=s (-vil=s).
386 This has been requested several times, most recently in git #79, and it
387 finally got done. For example, -vil='=>' means just align on '=>'.
389 - A new flag -gal=s, --grep-alias-list=s, has been added as suggested in
390 git #77. This allows code blocks passed to list operator functions to
391 be formatted in the same way as a code block passed to grep, map, or sort.
392 By default, the following list operators in List::Util are included:
394 all any first none notall reduce reductions
396 They can be changed with the flag -gaxl=s, -grep-alias-exclusion-list=s
398 - A new flag -xlp has been added which can be set to avoid most of the
399 limitations of the -lp flag regarding side comments, blank lines, and
400 code blocks. See the man pages for more info. This fixes git #64 and git #74.
401 The older -lp flag still works.
403 - A new flag -lpil=s, --line-up-parentheses-inclusion-list=s, has been added
404 as an alternative to -lpxl=s, --line-up-parentheses-exclusion-list=s.
405 It supplies equivalent information but is much easier to describe and use.
406 It works for both the older -lp version and the newer -xlp.
408 - The coding for the older -lp flag has been updated to avoid some problems
409 and limitations. The new coding allows the -lp indentation style to
410 mix smoothly with the standard indentation in a single file. Some problems
411 where -lp and -xci flags were not working well together have been fixed, such
412 as happened in issue rt140025. As a result of these updates some minor
413 changes in existing code using the -lp style may occur.
415 - This version of perltidy was stress-tested for many cpu hours with
416 random input parameters. No failures to converge, internal fault checks,
417 undefined variable references or other irregularities were seen.
419 - Numerous minor fixes have been made, mostly very rare formatting
420 instabilities found in random testing.
424 - No significant bugs have been found since the last release, but several
425 minor issues have been fixed. Vertical alignment has been improved for
426 lists of call args which are not contained within parens (next item).
428 - Vertical alignment of function calls without parens has been improved with
429 the goal of making vertical alignment essentially the same with or
430 without parens around the call args. Some examples:
433 mkTextConfig $c, $x, $y, -anchor => 'se', $color;
434 mkTextConfig $c, $x + 30, $y, -anchor => 's', $color;
435 mkTextConfig $c, $x + 60, $y, -anchor => 'sw', $color;
436 mkTextConfig $c, $x, $y + 30, -anchor => 'e', $color;
439 mkTextConfig $c, $x, $y, -anchor => 'se', $color;
440 mkTextConfig $c, $x + 30, $y, -anchor => 's', $color;
441 mkTextConfig $c, $x + 60, $y, -anchor => 'sw', $color;
442 mkTextConfig $c, $x, $y + 30, -anchor => 'e', $color;
445 is id_2obj($id), undef, "unregistered object not retrieved";
446 is scalar keys %$ob_reg, 0, "object registry empty";
447 is register($obj), $obj, "object returned by register";
448 is scalar keys %$ob_reg, 1, "object registry nonempty";
449 is id_2obj($id), $obj, "registered object retrieved";
452 is id_2obj($id), undef, "unregistered object not retrieved";
453 is scalar keys %$ob_reg, 0, "object registry empty";
454 is register($obj), $obj, "object returned by register";
455 is scalar keys %$ob_reg, 1, "object registry nonempty";
456 is id_2obj($id), $obj, "registered object retrieved";
458 This will cause some changes in alignment, hopefully for the better,
459 particularly in test code which often uses numerous parenless function
460 calls with functions like 'ok', 'is', 'is_deeply', ....
462 - Two new parameters were added to control the block types to which the
463 -bl (--opening-brace-on-new-line) flag applies. The new parameters are
464 -block-left-list=s, or -bll=s, and --block-left-exclusion-list=s,
465 or -blxl=s. Previously the -bl flag was 'hardwired' to apply to
466 nearly all blocks. The default values of the new parameters
467 retain the the old default behavior but allow it to be changed.
469 - The default behavior of the -bli (-brace-left-and-indent) flag has changed
470 slightly. Previously, if you set -bli, then the -bl flag would also
471 automatically be set. Consequently, block types which were not included
472 in the default list for -bli would get -bl formatting. This is no longer done,
473 and these two styles are now controlled independently. The manual describes
474 the controls. If you want to recover the exact previous default behavior of
475 the -bli then add the -bl flag.
477 - A partial fix was made for issue for git #74. The -lp formatting style was
478 being lost when a one-line anonymous sub was followed by a closing brace.
480 - Fixed issue git #73, in which the -nfpva flag was not working correctly.
481 Some unwanted vertical alignments of spaced function perens
484 - Updated the man pages to clarify the flags -valign and -novalign
485 for turning vertical alignment on and off (issue git #72).
486 Added parameters -vc -vsc -vbc for separately turning off vertical
487 alignment of code, side comments and block comments.
489 - Fixed issue git #68, where a blank line following a closing code-skipping
490 comment, '#>>V', could be lost.
492 - This version runs 10 to 15 percent faster on large files than the
493 previous release due to optimizations made with the help of NYTProf.
495 - This version of perltidy was stress-tested for many cpu hours with
496 random input parameters. No instabilities, internal fault checks,
497 undefined variable references or other irregularities were seen.
499 - Numerous minor fixes have been made, mostly very rare formatting instabilities
500 found in random testing. An effort has been made to minimize changes to
501 existing formatting that these fixes produce, but occasional changes
502 may occur. Many of these updates are listed at:
504 https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod
508 - This release is being made mainly because of the next item, in which an
509 error message about an uninitialized value error message could be produced
510 in certain cases when format-skipping is used. The error message was
511 annoying but harmless to formatting.
513 - Fixed an undefined variable message, see git #67. When a format skipping
514 comment '#<<' is placed before the first line of code in a script, a
515 message 'Use of uninitialized value $Ktoken_vars in numeric ...' can
518 - A warning will no longer be given if a script has an opening code-skipping
519 comment '#<<V' which is not terminated with a closing comment '#>>V'. This
520 makes code-skipping and format-skipping behave in a similar way: an
521 opening comment without a corresponding closing comment will cause
522 the rest of a file to be skipped. If there is a question about which lines
523 are skipped, a .LOG file can be produced with the -g flag and it will have
526 - Removed the limit on -ci=n when -xci is set, reference: rt #136415.
527 This update removes a limit in the previous two versions in which the
528 value of -ci=n was limited to the value of -i=n when -xci was set.
529 This limit had been placed to avoid some formatting instabilities,
530 but recent coding improvements allow the limit to be removed.
532 - The -wn and -bbxx=n flags were not working together correctly. This has
535 - This version may produce occasional differences in formatting compared to
536 previous versions, mainly for lines which are near the specified line
537 length limit. This is due to ongoing efforts to eliminate edge cases of
538 formatting instability.
540 - Numerous minor fixes have been made. A complete list is at:
542 https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod
546 - This release adds several new requested parameters. No significant bugs have
547 been found since the last release, but a number of minor problems have been
550 - Added a new option '--code-skipping', requested in git #65, in which code
551 between comment lines '#<<V' and '#>>V' is passed verbatim to the output
552 stream without error checking. It is simmilar to --format-skipping
553 but there is no error checking of the skipped code. This can be useful for
554 skipping past code which employs an extended syntax.
556 - Added a new option for closing paren placement, -vtc=3, requested in rt #136417.
558 - Added flag -atnl, --add-terminal-newline, to help issue git #58.
559 This flag tells perltidy to terminate the last line of the output stream
560 with a newline character, regardless of whether or not the input stream
561 was terminated with a newline character. This is the default.
562 If this flag is negated, with -natnl, then perltidy will add a terminal
563 newline character to the the output stream only if the input
564 stream is terminated with a newline.
566 - Some nested structures formatted with the -lp indentation option may have
567 some changes in indentation. This is due to updates which were made to
568 prevent formatting instability when line lengths are limited by the maximum line
569 length. Most scripts will not be affected. If this causes unwanted formatting
570 changes, try increasing the --maximum-line-length by a few characters.
572 - Numerous minor fixes have been made. A complete list is at:
574 https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod
578 - This release fixes several non-critical bugs which have been found since the last
579 release. An effort has been made to keep existing formatting unchanged.
581 - Fixed issue git #57 regarding uninitialized warning flag.
583 - Added experimental flag -lpxl=s requested in issue git #56 to provide some
584 control over which containers get -lp indentation.
586 - Fixed issue git #55 regarding lack of coordination of the --break-before-xxx
587 flags and the --line-up-parens flag.
589 - Fixed issue git #54 regarding irregular application of the --break-before-paren
590 and similar --break-before-xxx flags, in which lists without commas were not
591 being formatted according to these flags.
593 - Fixed issue git #53. A flag was added to turn off alignment of spaced function
594 parens. If the --space-function-paren, -sfp flag is set, a side-effect is that the
595 spaced function parens may get vertically aligned. This can be undesirable,
596 so a new parameter '--function-paren-vertical-alignment', or '-fpva', has been
597 added to turn this vertical alignment off. The default is '-fpva', so that
598 existing formatting is not changed. Use '-nfpva' to turn off unwanted
599 vertical alignment. To illustrate the possibilities:
602 myfun( $aaa, $b, $cc );
603 mylongfun( $a, $b, $c );
606 myfun ( $aaa, $b, $cc );
607 mylongfun ( $a, $b, $c );
609 # perltidy -sfp -nfpva
610 myfun ( $aaa, $b, $cc );
611 mylongfun ( $a, $b, $c );
613 - Fixed issue git #51, a closing qw bare paren was not being outdented when
614 the -nodelete-old-newlines flag was set.
616 - Fixed numerous edge cases involving unusual parameter combinations which
617 could cause alternating output states. Most scripts will not be
618 changed by these fixes.
620 - A more complete list of updates is at
622 https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod
626 - Fixed issue git #49, -se breaks warnings exit status behavior.
627 The exit status flag was not always being set when the -se flag was set.
629 - Some improvements have been made in the method for aligning side comments.
630 One of the problems that was fixed is that there was a tendency for side comment
631 placement to drift to the right in long scripts. Programs with side comments
632 may have a few changes.
634 - Some improvements have been made in formatting qw quoted lists. This
635 fixes issue git #51, in which closing qw pattern delimiters not always
636 following the settings specified by the --closing-token-indentation=n settings.
637 Now qw closing delimiters ')', '}' and ']' follow these flags, and the
638 delimiter '>' follows the flag for ')'. Other qw pattern delimiters remain
639 indented as the are now. This change will cause some small formatting changes
640 in some existing programs.
642 - Another change involving qw lists is that they get full indentation,
643 rather than just continuation indentation, if
645 (1) the closing delimiter is one of } ) ] > and is on a separate line,
646 (2) the opening delimiter (i.e. 'qw{' ) is also on a separate line, and
647 (3) the -xci flag (--extended-continuation-indentation) is set.
649 This improves formatting when qw lists are contained in other lists. For example,
654 AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
655 SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
658 LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
659 SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
666 AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4
667 SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3
670 LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2
671 SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4
675 - Some minor improvements have been made to the rules for formatting
676 some edge vertical alignment cases, usually involving two dissimilar lines.
678 - A more complete list of updates is at
680 https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod
684 - Fixed issue git #47, incorrect welding of anonymous subs.
685 An incorrect weld format was being made when the --weld-nested-containers option
686 (-wn) was used in to format a function which returns a list of anonymous subs.
687 For example, the following snippet was incorrectly being welded.
690 sub { $all->resolve(@_); () },
692 $results->[$i] = [@_];
693 $all->reject(@$results) if --$remaining <= 0;
698 This was due to an error introduced in v20201201 related to parsing sub
699 signatures. Reformatting with the current version will fix the problem.
703 - This release is being made primarily to make available a several new formatting
704 parameters, in particular -xci, -kbb=s, -kba=s, and -wnxl=s. No significant
705 bugs have been found since the previous release, but numerous minor issues have
706 been found and fixed as listed below.
708 - This version is about 20% faster than the previous version due to optimizations
709 made with the help of Devel::NYTProf.
711 - Added flag -wnxl=s, --weld-nested-exclusion-list=s, to provide control which containers
712 are welded with the --weld-nested-containers parameter. This is related to issue git #45.
714 - Merged pull request git #46 which fixes the docs regarding the -fse flag.
716 - Fixed issue git #45, -vtc=n flag was ignored when -wn was set.
718 - implement request RT #133649, delete-old-newlines selectively. Two parameters,
720 -kbb=s or --keep-old-breakpoints-before=s, and
721 -kba=s or --keep-old-breakpoints-after=s
723 were added to request that old breakpoints be kept before or after
724 selected token types. For example, -kbb='=>' means that newlines before
725 fat commas should be kept.
727 - Fix git #44, fix exit status for assert-tidy/untidy. The exit status was
728 always 0 for --assert-tidy if the user had turned off all error messages with
729 the -quiet flag. This has been fixed.
731 - Add flag -maxfs=n, --maximum-file-size-mb=n. This parameter is provided to
732 avoid causing system problems by accidentally attempting to format an
733 extremely large data file. The default is n=10. The command to increase
734 the limit to 20 MB for example would be -mfs=20. This only applies to
735 files specified by filename on the command line.
737 - Skip formatting if there are too many indentation level errors. This is
738 controlled with -maxle=n, --maximum-level-errors=n. This means that if
739 the ending indentation differs from the starting indentation by more than
740 n levels, the file will be output verbatim. The default is n=1.
741 To skip this check, set n=-1 or set n to a large number.
743 - A related new flag, --maximum-unexpected-errors=n, or -maxue=n, is available
744 but is off by default.
746 - Add flag -xci, --extended-continuation-indentation, regarding issue git #28
747 This flag causes continuation indentation to "extend" deeper into structures.
748 Since this is a fairly new flag, the default is -nxci to avoid disturbing
749 existing formatting. BUT you will probably see some improved formatting
750 in complex data structures by setting this flag if you currently use -ci=n
751 and -i=n with the same value of 'n' (as is the case if you use -pbp,
752 --perl-best-practices, where n=4).
754 - Fix issue git #42, clarify how --break-at-old-logical-breakpoints works.
755 The man page was updated to note that it does not cause all logical breakpoints
756 to be replicated in the output file.
758 - Fix issue git #41, typo in manual regarding -fsb.
760 - Fix issue git #40: when using the -bli option, a closing brace followed by
761 a semicolon was not being indented. This applies to braces which require
762 semicolons, such as a 'do' block.
764 - Added 'state' as a keyword.
766 - A better test for convergence has been added. When iterations are requested,
767 the new test will stop after the first pass if no changes in line break
768 locations are made. Previously, file checksums were used and required at least two
769 passes to verify convergence unless no formatting changes were made. With the new test,
770 only a single pass is needed when formatting changes are limited to adjustments of
771 indentation and whitespace on the lines of code. Extensive testing has been made to
772 verify the correctness of the new convergence test.
774 - Line breaks are now automatically placed after 'use overload' to
775 improve formatting when there are numerous overloaded operators. For
782 - A number of minor problems with parsing signatures and prototypes have
783 been corrected, particularly multi-line signatures. Some signatures
784 had previously been parsed as if they were prototypes, which meant the
785 normal spacing rules were not applied. For example
788 sub echo ($message= 'Hello World!' ) {
793 sub echo ( $message = 'Hello World!' ) {
797 - Numerous minor issues that the average user would not encounter were found
798 and fixed. They can be seen in the more complete list of updates at
800 https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod
804 - Robustness of perltidy has been significantly improved. Updating is recommended. Continual
805 automated testing runs began about 1 Sep 2020 and numerous issues have been found and fixed.
806 Many involve references to uninitialized variables when perltidy is fed random text and random
809 - Added the token '->' to the list of alignment tokens, as suggested in git
810 #39, so that it can be vertically aligned if a space is placed before them with -wls='->'.
812 - Added parameters -bbhb=n (--break-before-hash-brace=n), -bbsb=n (--break-before-square-bracket=n),
813 and -bbp=n (--break-before-paren=n) suggested in git #38. These provide control over the
814 opening container token of a multiple-line list. Related new parameters -bbhbi=n, -bbsbi=n, -bbpi=n
815 control indentation of these tokens.
817 - Added keyword 'isa'.
821 - Fixed bug git #37, an error when the combination -scbb -csc was used.
822 It occurs in perltidy versions 20200110, 20200619, and 20200822. What happens is
823 that when two consecutive lines with isolated closing braces had new side
824 comments generated by the -csc parameter, a separating newline was missing.
825 The resulting script will not then run, but worse, if it is reformatted with
826 the same parameters then closing side comments could be overwritten and data
829 This problem was found during automated random testing. The parameter
830 -scbb is rarely used, which is probably why this has not been reported. Please
831 upgrade your version.
833 - Added parameter --non-indenting-braces, or -nib, which prevents
834 code from indenting one level if it follows an opening brace marked
835 with a special side comment, '#<<<'. For example,
837 { #<<< a closure to contain lexical vars
839 my $var; # this line does not indent
843 # this line cannot 'see' $var;
845 This is on by default. If your code happens to have some
846 opening braces followed by '#<<<', and you
847 don't want this, you can use -nnib to deactivate it.
849 - Side comment locations reset at a line ending in a level 0 open
850 block, such as when a new multi-line sub begins. This is intended to
851 help keep side comments from drifting to far to the right.
855 - Fix RT #133166, encoding not set for -st. Also reported as RT #133171
858 This is a significant bug in version 20200616 which can corrupt data if
859 perltidy is run as a filter on encoded text.
862 - Fix issue RT #133161, perltidy -html was not working on pod
864 - Fix issue git #33, allow control of space after '->'
866 - Vertical alignment has been improved. Numerous minor issues have
869 - Formatting with the -lp option is improved.
871 - Fixed issue git #32, misparse of bare 'ref' in ternary
873 - When --assert-tidy is used and triggers an error, the first difference
874 between input and output files is shown in the error output. This is
875 a partial response to issue git #30.
879 - Added support for Switch::Plain syntax, issue git #31.
881 - Fixed minor problem where trailing 'unless' clauses were not
882 getting vertically aligned.
884 - Added a parameter --logical-padding or -lop to allow logical padding
885 to be turned off. Requested by git #29. This flag is on by default.
886 The man pages have examples.
888 - Added a parameter -kpit=n to control spaces inside of parens following
889 certain keywords, requested in git#26. This flag is off by default.
891 - Added fix for git#25, improve vertical alignment for long lists with
892 varying numbers of items per line.
894 - calls to the module Perl::Tidy can now capture any output produced
895 by a debug flag or one of the 'tee' flags through the new 'debugfile' and
896 'teefile' call parameters. These output streams are rarely used but
897 they are now treated the same as any 'logfile' stream.
899 - add option --break-at-old-semicolon-breakpoints', -bos, requested
900 in RT#131644. This flag will keep lines beginning with a semicolon.
902 - Added --use-unicode-gcstring to control use of Unicode::GCString for
903 evaluating character widths of encoded data. The default is
904 not to use this (--nouse-unicode-gcstring). If this flag is set,
905 perltidy will look for Unicode::GCString and, if found, will use it
906 to evaluate character display widths. This can improve displayed
907 vertical alignment for files with wide characters. It is a nice
908 feature but it is off by default to avoid conflicting formatting
909 when there are multiple developers. Perltidy installation does not
910 require Unicode::GCString, so users wanting to use this feature need
911 set this flag and also to install Unicode::GCString separately.
913 - Added --character-encoding=guess or -guess to have perltidy guess
914 if a file (or other input stream) is encoded as -utf8 or some
915 other single-byte encoding. This is useful when processing a mixture
916 of file types, such as utf8 and latin-1.
918 Please Note: The default encoding has been set to be 'guess'
919 instead of 'none'. This seems like the best default, since
920 it allows perltidy work properly with both
921 utf8 files and older latin-1 files. The guess mode uses Encode::Guess,
922 which is included in standard perl distributions, and only tries to
923 guess if a file is utf8 or not, never any other encoding. If the guess is
924 utf8, and if the file successfully decodes as utf8, then it the encoding
925 is assumed to be utf8. Otherwise, no encoding is assumed.
926 If you do not want to use this new default guess mode, or have a
927 problem with it, you can set --character-encoding=none (the previous
928 default) or --character-encoding=utf8 (if you deal with utf8 files).
930 - Specific encodings of input files other than utf8 may now be given, for
931 example --character-encoding=euc-jp.
933 - Fix for git#22, Preserve function signature on a single line. An
934 unwanted line break was being introduced when a closing signature paren
935 followed a closing do brace.
937 - Fix RT#132059, the -dac parameter was not working and caused an error exit
939 - When -utf8 is used, any error output is encoded as utf8
941 - Fix for git#19, adjust line break around an 'xor'
943 - Fix for git#18, added warning for missing comma before unknown bare word.
947 - This release adds a flag to control the feature RT#130394 (allow short nested blocks)
948 introduced in the previous release. Unfortunately that feature breaks
949 RPerl installations, so a control flag has been introduced and that feature is now
950 off by default. The flag is:
952 --one-line-block-nesting=n, or -olbn=n, where n is an integer as follows:
954 -olbn=0 break nested one-line blocks into multiple lines [new DEFAULT]
955 -olbn=1 stable; keep existing nested-one line blocks intact [previous DEFAULT]
957 For example, consider this input line:
959 foreach (@list) { if ($_ eq $asked_for) { last } ++$found }
961 The new default behavior (-olbn=0), and behavior prior to version 20191203, is to break it into multiple lines:
964 if ( $_ eq $asked_for ) { last }
968 To keep nested one-line blocks such as this on a single line you can add the parameter -olbn=1.
970 - Fixed issue RT#131288: parse error for un-prototyped constant function without parenthesized
971 call parameters followed by ternary.
973 - Fixed issue RT#131360, installation documentation. Added a note that the binary
974 'perltidy' comes with the Perl::Tidy module. They can both normally be installed with
980 - Fixed issue RT#131115: -bli option not working correctly.
981 Closing braces were not indented in some cases due to a glitch
982 introduced in version 20181120.
984 - Fixed issue RT#130394: Allow short nested blocks. Given the following
986 $factorial = sub { reduce { $a * $b } 1 .. 11 };
988 Previous versions would always break the sub block because it
989 contains another block (the reduce block). The fix keeps
990 short one-line blocks such as this intact.
992 - Implement issue RT#130640: Allow different subroutine keywords.
993 Added a flag --sub-alias-list=s or -sal=s, where s is a string with
994 one or more aliases for 'sub', separated by spaces or commas.
997 perltidy -sal='method fun'
999 will cause the perltidy to treat the words 'method' and 'fun' to be
1000 treated the same as if they were 'sub'.
1002 - Added flag --space-prototype-paren=i, or -spp=i, to control spacing
1003 before the opening paren of a prototype, where i=0, 1, or 2:
1005 i=1 follow input [current and default]
1008 Previously, perltidy always followed the input.
1009 For example, given the following input
1014 sub usage(); # i=0 [no space]
1015 sub usage(); # i=1 [default; follows input]
1016 sub usage (); # i=2 [space]
1018 - Fixed issue git#16, minor vertical alignment issue.
1020 - Fixed issue git#10, minor conflict of -wn and -ce
1022 - Improved some vertical alignments involving two lines.
1027 - fixed issue RT#130344: false warning "operator in print statement"
1030 - fixed issue RT#130304: standard error output should include filename.
1031 When perltidy error messages are directed to the standard error output
1032 with -se or --standard-error-output, the message lines now have a prefix
1033 'filename:' for clarification in case multiple files
1034 are processed, where 'filename' is the name of the input file. If
1035 input is from the standard input the displayed filename is '<stdin>',
1036 and if it is from a data structure then displayed filename
1037 is '<source_stream>'.
1039 - implement issue RT#130425: check mode. A new flag '--assert-tidy'
1040 will cause an error message if the output script is not identical to
1041 the input script. For completeness, the opposite flag '--assert-untidy'
1042 has also been added. The next item, RT#130297, insures that the script
1043 will exit with a non-zero exit flag if the assertion fails.
1045 - fixed issue RT#130297; the perltidy script now exits with a nonzero exit
1046 status if it wrote to the standard error output. Prevously only fatal
1047 run errors produced a non-zero exit flag. Now, even non-fatal messages
1048 requested with the -w flag will cause a non-zero exit flag. The exit
1049 flag now has these values:
1052 1 = perltidy could not run to completion due to errors
1053 2 = perltidy ran to completion with error messages
1055 - added warning message for RT#130008, which warns of conflicting input
1056 parameters -iob and -bom or -boc.
1058 - fixed RT#129850; concerning a space between a closing block brace and
1059 opening bracket or brace, as occurs before the '[' in this line:
1061 my @addunix = map { File::Spec::Unix->catfile( @ROOT, @$_ ) } ['b'];
1063 Formerly, any space was removed. Now it is optional, and the output will
1066 - fixed issue git#13, needless trailing whitespace in error message
1068 - fixed issue git#9: if the -ce (--cuddled-else) flag is used,
1069 do not try to form new one line blocks for a block type
1070 specified with -cbl, particularly map, sort, grep
1072 - iteration speedup for unchanged code. Previously, when iterations were
1073 requested, at least two formatting passes were made. Now just a single pass
1074 is made if the formatted code is identical to the input code.
1076 - some improved vertical alignments
1080 - rt #128477: Prevent inconsistent owner/group and setuid/setgid bits.
1081 In the -b (--backup-and-modify-in-place) mode, an attempt is made to set ownership
1082 of the output file equal to the input file, if they differ.
1083 In all cases, if the final output file ownership differs from input file, any setuid/setgid bits are cleared.
1085 - Added option -bom (--break-at-old-method-breakpoints) by
1086 merrillymeredith which preserves breakpoints of method chains. Modified to also handle a cuddled call style.
1088 - Merged patch to fix Windows EOL translation error with UTF-8 written by
1089 Ron Ivy. This update prevents automatic conversion to 'DOS' CRLF line
1090 endings. Also, Windows system testing at the appveyor site is working again.
1092 - RT #128280, added flag --one-line-block-semicolons=n (-olbs=n)
1093 to control semicolons in one-line blocks. The values of n are:
1094 n=0 means no semicolons termininating simple one-line blocks
1095 n=1 means stable; do not change from input file [DEFAULT and current]
1096 n=2 means always add semicolons in one-line blocks
1097 The current behavior corresponds to the default n=1.
1099 - RT #128216, Minor update to prevent inserting unwanted blank line at
1100 indentation level change. This should not change existing scripts.
1102 - RT #81852: Improved indentation when quoted word (qw) lists are
1103 nested within other containers using the --weld-nested (-wn) flag.
1104 The example given previously (below) is now closer to what it would
1105 be with a simple list instead of qw:
1119 - RT#12764, introduced new feature allowing placement of blanks around
1120 sequences of selected keywords. This can be activated with the -kgb*
1121 series of parameters described in the manual.
1123 - Rewrote vertical algnment module. It is better at finding
1124 patterns in complex code. For example,
1127 /^-std$/ && do { $std = 1; next; };
1128 /^--$/ && do { @link_args = @argv; last; };
1129 /^-I(.*)/ && do { $path = $1 || shift @argv; next; };
1132 /^-std$/ && do { $std = 1; next; };
1133 /^--$/ && do { @link_args = @argv; last; };
1134 /^-I(.*)/ && do { $path = $1 || shift @argv; next; };
1136 - Add repository URLs to META files
1138 - RT #118553, "leave only one newline at end of file". This option was not
1139 added because of undesirable side effects, but a new filter script
1140 was added which can do this, "examples/delete_ending_blank_lines.pl".
1144 - fix RT#127736 Perl-Tidy-20181119 has the EXE_FILES entry commented out in
1145 Makefile.PL so it doesn't install the perltidy script or its manpage.
1150 - Removed test case 'filter_example.t' which was causing a failure on a
1151 Windows installation for unknown reasons, possibly due to an unexpected
1152 perltidyrc being read by the test script. Added VERSION numbers to all
1157 - Fixed RT #126965, in which a ternary operator was misparsed if immediately
1158 following a function call without arguments, such as:
1159 my $restrict_customer = shift ? 1 : 0;
1161 - Fixed RT #125012: bug in -mangle --delete-all-comments
1162 A needed blank space before bareword tokens was being removed when comments
1165 - Fixed RT #81852: Stacked containers and quoting operators. Quoted words
1166 (qw) delimited by container tokens ('{', '[', '(', '<') are now included in
1167 the --weld-nested (-wn) flag:
1181 - The cuddled-else (-ce) coding was merged with the new cuddled-block (-cb)
1182 coding. The change is backward compatible and simplifies input.
1183 The --cuddled-block-option=n (-cbo=n) flag now applies to both -ce and -cb
1184 formatting. In fact the -cb flag is just an alias for -ce now.
1186 - Fixed RT #124594, license text desc. changed from 'GPL-2.0+' to 'gpl_2'
1188 - Fixed bug in which a warning about a possible code bug was issued in a
1189 script with brace errors.
1191 - added option --notimestamp or -nts to eliminate any time stamps in output
1192 files. This is used to prevent differences in test scripts from causing
1193 failure at installation. For example, the -cscw option will put a date
1194 stamp on certain closing side comments. We need to avoid this in order
1195 to test this feature in an installation test.
1197 - Fixed bug with the entab option, -et=8, in which the leading space of
1198 some lines was was not entabbed. This happened in code which was adjusted
1199 for vertical alignment and in hanging side comments. Thanks to Glenn.
1201 - Fixed RT #127633, undesirable line break after return when -baao flag is set
1203 - Fixed RT #127035, vertical alignment. Vertical alignment has been improved
1204 in several ways. Thanks especially to Michael Wardman and Glenn for sending
1207 - Alignment of the =~ operators has been reactivated.
1210 $service_profile =~ s/^\s+|\s+$//g;
1211 $host_profile =~ s/^\s+|\s+$//g;
1214 $service_profile =~ s/^\s+|\s+$//g;
1215 $host_profile =~ s/^\s+|\s+$//g;
1217 - Alignment of the // operator has been reactivated.
1220 is( pop // 7, 7, 'pop // ... works' );
1221 is( pop() // 7, 0, 'pop() // ... works' );
1222 is( pop @ARGV // 7, 3, 'pop @array // ... works' );
1225 is( pop // 7, 7, 'pop // ... works' );
1226 is( pop() // 7, 0, 'pop() // ... works' );
1227 is( pop @ARGV // 7, 3, 'pop @array // ... works' );
1229 - The rules for alignment of just two lines have been adjusted,
1230 hopefully to be a little better overall. In some cases, two
1231 lines which were previously unaligned are now aligned, and vice-versa.
1234 $expect = "1$expect" if $expect =~ /^e/i;
1235 $p = "1$p" if defined $p and $p =~ /^e/i;
1238 $expect = "1$expect" if $expect =~ /^e/i;
1239 $p = "1$p" if defined $p and $p =~ /^e/i;
1242 - RT #106493; source code repository location has been added to docs; it is
1243 https://github.com/perltidy/perltidy
1245 - The packaging for this version has changed. The Tidy.pm module is much
1246 smaller. Supporting modules have been split out from it and placed below
1247 it in the path Perl/Tidy/*.
1249 - A number of new installation test cases have been added. Updates are now
1250 continuously tested at Travis CI against versions back to Perl 5.08.
1254 - RT #124469, #124494, perltidy often making empty files. The previous had
1255 an index error causing it to fail, particularly in version 5.18 of Perl.
1257 Please avoid version 20180219.
1261 - RT #79947, cuddled-else generalization. A new flag -cb provides
1262 'cuddled-else' type formatting for an arbitrary type of block chain. The
1263 default is try-catch-finally, but this can be modified with the
1266 - Fixed RT #124298: add space after ! operator without breaking !! secret
1269 - RT #123749: numerous minor improvements to the -wn flag were made.
1271 - Fixed a problem with convergence tests in which iterations were stopping
1274 - Here doc targets for <<~ type here-docs may now have leading whitespace.
1276 - Fixed RT #124354. The '-indent-only' flag was not working correctly in the
1277 previous release. A bug in version 20180101 caused extra blank lines
1280 - Issue RT #124114. Some improvements were made in vertical alignment
1281 involving 'fat commas'.
1285 - Added new flag -wn (--weld-nested-containers) which addresses these issues:
1286 RT #123749: Problem with promises;
1287 RT #119970: opening token stacking strange behavior;
1288 RT #81853: Can't stack block braces
1290 This option causes closely nested pairs of opening and closing containers
1291 to be "welded" together and essentially be formatted as a single unit,
1292 with just one level of indentation.
1294 Since this is a new flag it is set to be "off" by default but it has given
1295 excellent results in testing.
1297 EXAMPLE 1, multiple blocks, default formatting:
1300 next if $x == $y; # do something here
1307 } } until $x++ > $z;
1309 EXAMPLE 2, three levels of wrapped function calls, default formatting:
1313 translate( param('verb') ), param('tense'),
1321 translate( param('verb') ),
1322 param('tense'), param('person')
1325 # EXAMPLE 3, chained method calls, default formatting:
1326 get('http://mojolicious.org')->then(
1329 say $mojo->res->code;
1330 return get('http://metacpan.org');
1335 say $cpan->res->code;
1340 warn "Something went wrong: $err";
1345 get('http://mojolicious.org')->then( sub {
1347 say $mojo->res->code;
1348 return get('http://metacpan.org');
1351 say $cpan->res->code;
1354 warn "Something went wrong: $err";
1358 - Fixed RT #114359: Missparsing of "print $x ** 0.5;
1360 - Deactivated the --check-syntax flag for better security. It will be
1363 - Corrected minimum perl version from 5.004 to 5.008 based on perlver
1364 report. The change is required for coding involving wide characters.
1366 - For certain severe errors, the source file will be copied directly to the
1367 output without formatting. These include ending in a quote, ending in a
1368 here doc, and encountering an unidentified character.
1372 - RT #123749, partial fix. "Continuation indentation" is removed from lines
1373 with leading closing parens which are part of a call chain.
1374 For example, the call to pack() is is now outdented to the starting
1375 indentation in the following experession:
1379 -text => "New Document",
1380 -command => \&new_document
1388 -text => "New Document",
1389 -command => \&new_document
1395 This modification improves readability of complex expressions, especially
1396 when the user uses the same value for continuation indentation (-ci=n) and
1397 normal indentation (-i=n). Perltidy was already programmed to
1398 do this but a minor bug was preventing it.
1400 - RT #123774, added flag to control space between a backslash and a single or
1401 double quote, requested by Robert Rothenberg. The issue is that lines like
1406 confuse syntax highlighters unless a space is left between the backslash and
1409 The new flag to control this is -sbq=n (--space-backslash-quote=n),
1410 where n=0 means no space, n=1 means follow existing code, n=2 means always
1411 space. The default is n=1, meaning that a space will be retained if there
1412 is one in the source code.
1414 - Fixed RT #123492, support added for indented here doc operator <<~ added
1415 in v5.26. Thanks to Chris Weyl for the report.
1417 - Fixed docs; --closing-side-comment-list-string should have been just
1418 --closing-side-comment-list. Thanks to F.Li.
1420 - Added patch RT #122030] Perl::Tidy sometimes does not call binmode.
1421 Thanks to Irilis Aelae.
1423 - Fixed RT #121959, PERLTIDY doesn't honor the 'three dot' notation for
1424 locating a config file using environment variables. Thanks to John
1427 - Minor improvements to formatting, in which some additional vertical
1428 aligmnemt is done. Thanks to Keith Neargarder.
1430 - RT #119588. Vertical alignment is no longer done for // operator.
1434 - Fixed debian #862667: failure to check for perltidy.ERR deletion can lead
1435 to overwriting arbitrary files by symlink attack. Perltidy was continuing
1436 to write files after an unlink failure. Thanks to Don Armstrong
1439 - Fixed RT #116344, perltidy fails on certain anonymous hash references:
1440 in the following code snippet the '?' was misparsed as a pattern
1441 delimiter rather than a ternary operator.
1442 return ref {} ? 1 : 0;
1444 - Fixed RT #113792: misparsing of a fat comma (=>) right after
1445 the __END__ or __DATA__ tokens. These keywords were getting
1446 incorrectly quoted by the following => operator.
1448 - Fixed RT #118558. Custom Getopt::Long configuration breaks parsing
1449 of perltidyrc. Perltidy was resetting the users configuration too soon.
1451 - Fixed RT #119140, failure to parse double diamond operator. Code to
1452 handle this new operator has been added.
1454 - Fixed RT #120968. Fixed problem where -enc=utf8 didn't work
1455 with --backup-and-modify-in-place. Thanks to Heinz Knutzen for this patch.
1457 - Fixed minor formatting issue where one-line blocks for subs with signatures
1458 were unnecessarily broken
1460 - RT #32905, patch to fix utf-8 error when output was STDOUT.
1462 - RT #79947, improved spacing of try/catch/finally blocks. Thanks to qsimpleq
1465 - Fixed #114909, Anonymous subs with signatures and prototypes misparsed as
1466 broken ternaries, in which a statement such as this was not being parsed
1468 return sub ( $fh, $out ) : prototype(*$) { ... }
1470 - Implemented RT #113689, option to introduces spaces after an opening block
1471 brace and before a closing block brace. Four new optional controls are
1472 added. The first two define the minimum number of blank lines to be
1475 -blao=i or --blank-lines-after-opening-block=i
1476 -blbc=i or --blank-lines-before-closing-block=i
1478 where i is an integer, the number of lines (the default is 0).
1480 The second two define the types of blocks to which the first two apply
1482 -blaol=s or --blank-lines-after-opening-block-list=s
1483 -blbcl=s or --blank-lines-before-closing-block-list=s
1485 where s is a string of possible block keywords (default is just 'sub',
1486 meaning a named subroutine).
1488 For more information please see the documentation.
1490 - The method for specifying block types for certain input parameters has
1491 been generalized to distinguish between normal named subroutines and
1492 anonymous subs. The keyword for normal subroutines remains 'sub', and
1493 the new keyword for anonymous subs is 'asub'.
1495 - Minor documentation changes. The BUGS sections now have a link
1496 to CPAN where most open bugs and issues can be reviewed and bug reports
1497 can be submitted. The information in the AUTHOR and CREDITS sections of
1498 the man pages have been removed from the man pages to streamline the
1499 documentation. This information is still in the source code.
1503 - RT #112534. Corrected a minor problem in which an unwanted newline
1504 was placed before the closing brace of an anonymous sub with
1505 a signature, if it was in a list. Thanks to Dmytro Zagashev.
1507 - Corrected a minor problem in which occasional extra indentation was
1508 given to the closing brace of an anonymous sub in a list when the -lp
1513 - RT #104427. Added support for signatures.
1515 - RT #111512. Changed global warning flag $^W = 1 to use warnings;
1516 Thanks to Dmytro Zagashev.
1518 - RT #110297, added support for new regexp modifier /n
1519 Thanks to Dmytro Zagashev.
1521 - RT #111519. The -io (--indent-only) and -dac (--delete-all-comments)
1522 can now both be used in one pass. Thanks to Dmitry Veltishev.
1524 - Patch to avoid error message with 'catch' used by TryCatch, as in
1528 Thanks to Nick Tonkin.
1530 - RT #32905, UTF-8 coding is now more robust. Thanks to qsimpleq
1531 and Dmytro for patches.
1533 - RT #106885. Added string bitwise operators ^. &. |. ~. ^.= &.= |.=
1535 - Fixed RT #107832 and #106492, lack of vertical alignment of two lines
1536 when -boc flag (break at old commas) is set. This bug was
1537 inadvertently introduced in previous bug fix RT #98902.
1539 - Some common extensions to Perl syntax are handled better.
1540 In particular, the following snippet is now foratted cleanly:
1542 method deposit( Num $amount) {
1543 $self->balance( $self->balance + $amount );
1546 A new flag -xs (--extended-syntax) was added to enable this, and the default
1549 In previous versions, and now only when -nxs is set, this snippet of code
1550 generates the following error message:
1552 "syntax error at ') {', didn't see one of: case elsif for foreach given if switch unless until when while"
1556 - Fixed RT# 105484, Invalid warning about 'else' in 'switch' statement. The
1557 warning happened if a 'case' statement did not use parens.
1559 - Fixed RT# 101547, misparse of // caused error message. Also..
1561 - Fixed RT# 102371, misparse of // caused unwated space in //=
1563 - Fixed RT# 100871, "silent failure of HTML Output on Windows".
1564 Changed calls to tempfile() from:
1565 my ( $fh_tmp, $tmpfile ) = tempfile();
1566 to have the full path name:
1567 my ( $fh_tmp, $tmpfile ) = File::Temp::tempfile()
1568 because of problems in the Windows version reported by Dean Pearce.
1570 - Fixed RT# 99514, calling the perltidy module multiple times with
1571 a .perltidyrc file containing the parameter --output-line-ending
1572 caused a crash. This was a glitch in the memoization logic.
1574 - Fixed RT#99961, multiple lines inside a cast block caused unwanted
1575 continuation indentation.
1577 - RT# 32905, broken handling of UTF-8 strings.
1578 A new flag -utf8 causes perltidy assume UTF-8 encoding for input and
1579 output of an io stream. Thanks to Sebastian Podjasek for a patch.
1580 This feature may not work correctly in older versions of Perl.
1581 It worked in a linux version 5.10.1 but not in a Windows version 5.8.3 (but
1582 otherwise perltidy ran correctly).
1584 - Warning files now report perltidy VERSION. Suggested by John Karr.
1586 - Fixed long flag --nostack-closing-tokens (-nsct has always worked though).
1587 This was due to a typo. This also fixed --nostack-opening-tokens to
1588 behave correctly. Thanks to Rob Dixon.
1592 - Fixed RT #94902: abbreviation parsing in .perltidyrc files was not
1593 working for multi-line abbreviations. Thanks to Eric Fung for
1596 - Fixed RT #95708, misparsing of a hash when the first key was a perl
1597 keyword, causing a semicolon to be incorrectly added.
1599 - Fixed RT #94338 for-loop in a parenthesized block-map. A code block within
1600 parentheses of a map, sort, or grep function was being mistokenized. In
1601 rare cases this could produce in an incorrect error message. The fix will
1602 produce some minor formatting changes. Thanks to Daniel Trizen
1603 discovering and documenting this.
1605 - Fixed RT #94354, excess indentation for stacked tokens. Thanks to
1606 Colin Williams for supplying a patch.
1608 - Added support for experimental postfix dereferencing notation introduced in
1609 perl 5.20. RT #96021.
1611 - Updated documentation to clarify the behavior of the -io flag
1612 in response to RT #95709. You can add -noll or -l=0 to prevent
1613 long comments from being outdented when -io is used.
1615 - Added a check to prevent a problem reported in RT #81866, where large
1616 scripts which had been compressed to a single line could not be formatted
1617 because of a check for VERSION for MakeMaker. The workaround was to
1618 use -nvpl, but this shouldn't be necessary now.
1620 - Fixed RT #96101; Closing brace of anonymous sub in a list was being
1621 indented. For example, the closing brace of the anonymous sub below
1622 will now be lined up with the word 'callback'. This problem
1623 occurred if there was no comma after the closing brace of the anonymous sub.
1624 This update may cause minor changes to formatting of code with lists
1625 of anonymous subs, especially TK code.
1632 path => '/_Operate/Transcode and split',
1634 return 1 if not $self->project_opened;
1635 $self->comp('project')->transcode( split => 1 );
1645 path => '/_Operate/Transcode and split',
1647 return 1 if not $self->project_opened;
1648 $self->comp('project')->transcode( split => 1 );
1655 - Fixed RT #94190 and debian Bug #742004: perltidy.LOG file left behind.
1656 Thanks to George Hartzell for debugging this. The problem was
1657 caused by the memoization speedup patch in version 20121207. An
1658 unwanted flag was being set which caused a LOG to be written if
1659 perltidy was called multiple times.
1661 - New default behavior for LOG files: If the source is from an array or
1662 string (through a call to the perltidy module) then a LOG output is only
1663 possible if a logfile stream is specified. This is to prevent
1664 unexpected perltidy.LOG files.
1666 - Fixed debian Bug #740670, insecure temporary file usage. File::Temp is now
1667 used to get a temporary file. Thanks to Don Anderson for a patch.
1669 - Any -b (--backup-and-modify-in-place) flag is silently ignored when a
1670 source stream, destination stream, or standard output is used.
1671 This is because the -b flag may have been in a .perltidyrc file and
1672 warnings break Test::NoWarnings. Thanks to Marijn Brand.
1676 - Fixed RT #88020. --converge was not working with wide characters.
1678 - Fixed RT #78156. package NAMESPACE VERSION syntax not accepted.
1680 - First attempt to fix RT #88588. INDEX END tag change in pod2html breaks
1681 perltidy -html. I put in a patch which should work but I don't yet have
1682 a way of testing it.
1686 - Fixed RT #87107, spelling
1690 - Fixed RT #87502, incorrect of parsing of smartmatch before hash brace
1692 - Added feature request RT #87330, trim whitespace after POD.
1693 The flag -trp (--trim-pod) will trim trailing whitespace from lines of POD
1697 - Fixed RT #86929, #86930, missing lhs of assignment.
1699 - Fixed RT #84922, moved pod from Tidy.pm into Tidy.pod
1703 - The flag -cab=n or --comma-arrow-breakpoints=n has been generalized
1704 to give better control over breaking open short containers. The
1705 possible values are now:
1707 n=0 break at all commas after =>
1708 n=1 stable: break at all commas after => if container is open,
1709 EXCEPT FOR one-line containers
1710 n=2 break at all commas after =>, BUT try to form the maximum
1711 maximum one-line container lengths
1712 n=3 do not treat commas after => specially at all
1713 n=4 break everything: like n=0 but also break a short container with
1714 a => not followed by a comma
1715 n=5 stable: like n=1 but ALSO break at open one-line containers (default)
1717 New values n=4 and n=5 have been added to allow short blocks to be
1718 broken open. The new default is n=5, stable. It should more closely
1719 follow the breaks in the input file, and previously formatted code
1720 should remain unchanged. If this causes problems use -cab=1 to recover
1721 the former behavior. Thanks to Tony Maszeroski for the suggestion.
1723 To illustrate the need for the new options, if perltidy is given
1724 the following code, then the old default (-cab=1) was to close up
1725 the 'index' container even if it was open in the source. The new
1726 default (-cab=5) will keep it open if it was open in the source.
1741 - New debug flag --memoize (-mem). This version contains a
1742 patch supplied by Jonathan Swartz which can significantly speed up
1743 repeated calls to Perl::Tidy::perltidy in a single process by caching
1744 the result of parsing the formatting parameters. A factor of up to 10
1745 speedup was achieved for masontidy (https://metacpan.org/module/masontidy).
1746 The memoization patch is on by default but can be deactivated for
1747 testing with -nmem (or --no-memoize).
1749 - New flag -tso (--tight-secret-operators) causes certain perl operator
1750 sequences (secret operators) to be formatted "tightly" (without spaces).
1751 The most common of these are 0 + and + 0 which become 0+ and +0. The
1752 operators currently modified by this flag are:
1753 =( )= 0+ +0 ()x!! ~~<> ,=>
1754 Suggested by by Philippe Bruhat. See https://metacpan.org/module/perlsecret
1755 This flag is off by default.
1757 - New flag -vmll (--variable-maximum-line-length) makes the maximum
1758 line length increase with the nesting depth of a line of code.
1759 Basically, it causes the length of leading whitespace to be ignored when
1760 setting line breaks, so the formatting of a block of code is independent
1761 of its nesting depth. Try this option if you have deeply nested
1762 code or data structures, perhaps in conjunction with the -wc flag
1763 described next. The default is not todo this.
1765 - New flag -wc=n (--whitespace-cycle=n) also addresses problems with
1766 very deeply nested code and data structures. When this parameter is
1767 used and the nesting depth exceeds the value n, the leading whitespace
1768 will be reduced and start at 1 again. The result is that deeply
1769 nested blocks of code will shift back to the left. This occurs cyclically
1770 to any nesting depth. This flag may be used either with or without -vmll.
1771 The default is not to use this (-wc=0).
1773 - Fixed RT #78764, error parsing smartmatch operator followed by anonymous
1774 hash or array and then a ternary operator; two examples:
1776 qr/3/ ~~ ['1234'] ? 1 : 0;
1777 map { $_ ~~ [ '0', '1' ] ? 'x' : 'o' } @a;
1779 - Fixed problem with specifying spaces around arrows using -wls='->'
1780 and -wrs='->'. Thanks to Alain Valleton for documenting this problem.
1782 - Implemented RT #53183, wishlist, lines of code with the same indentation
1783 level which are contained with multiple stacked opening and closing tokens
1784 (requested with flags -sot -sct) now have reduced indentation.
1790 subject => $subject,
1795 # OLD: perltidy -sot -sct
1798 subject => $subject,
1802 # NEW: perltidy -sot -sct
1805 subject => $subject,
1809 - New flag -act=n (--all-containers-tightness=n) is an abbreviation for
1810 -pt=n -sbt=n -bt=n -bbt=n, where n=0,1, or 2. It simplifies input when all
1811 containers have the same tightness. Using the same example:
1813 # NEW: perltidy -sot -sct -act=2
1816 subject => $subject,
1820 - New flag -sac (--stack-all-containers) is an abbreviation for -sot -sct
1821 This is part of wishlist item RT #53183. Using the same example again:
1823 # NEW: perltidy -sac -act=2
1826 subject => $subject,
1830 - new flag -scbb (--stack-closing-block-brace) causes isolated closing
1831 block braces to stack as in the following example. (Wishlist item RT#73788)
1838 push( @lines, "$w1 $w2 $w3 $w4\n" );
1849 push( @lines, "$w1 $w2 $w3 $w4\n" );
1852 There is, at present, no flag to place these closing braces at the end
1853 of the previous line. It seems difficult to develop good rules for
1854 doing this for a wide variety of code and data structures.
1856 - Parameters defining block types may use a wildcard '*' to indicate
1857 all block types. Previously it was not possible to include bare blocks.
1859 - A flag -sobb (--stack-opening-block-brace) has been introduced as an
1860 alias for -bbvt=2 -bbvtl='*'. So for example the following test code:
1862 {{{{{{{ $testing }}}}}}}
1864 cannot be formatted as above but can at least be kept vertically compact
1865 using perltidy -sobb -scbb
1867 { { { { { { { $testing
1870 Or even, perltidy -sobb -scbb -i=1 -bbt=2
1875 - Error message improved for conflicts due to -pbp; thanks to Djun Kim.
1877 - Fixed RT #80645, error parsing special array name '@$' when used as
1880 - Eliminated the -chk debug flag which was included in version 20010406 to
1881 do a one-time check for a bug with multi-line quotes. It has not been
1884 - Numerous other minor formatting improvements.
1888 - Added flag -iscl (--ignore-side-comment-lengths) which causes perltidy
1889 to ignore the length of side comments when setting line breaks,
1890 RT #71848. The default is to include the length of side comments when
1891 breaking lines to stay within the length prescribed by the -l=n
1892 maximum line length parameter. For example,
1894 Default behavior on a single line with long side comment:
1895 $vmsfile =~ s/;[\d\-]*$//
1896 ; # Clip off version number; we can use a newer version as well
1898 perltidy -iscl leaves the line intact:
1900 $vmsfile =~ s/;[\d\-]*$//; # Clip off version number; we can use a newer version as well
1902 - Fixed RT #78182, side effects with STDERR. Error handling has been
1903 revised and the documentation has been updated. STDERR can now be
1904 redirected to a string reference, and perltidy now returns an
1905 error flag instead of calling die when input errors are detected.
1906 If the error flag is set then no tidied output was produced.
1907 See man Perl::Tidy for an example.
1909 - Fixed RT #78156, erroneous warning message for package VERSION syntax.
1911 - Added abbreviations -conv (--converge) to simplify iteration control.
1912 -conv is equivalent to -it=4 and will insure that the tidied code is
1913 converged to its final state with the minimum number of iterations.
1915 - Minor formatting modifications have been made to insure convergence.
1917 - Simplified and hopefully improved the method for guessing the starting
1918 indentation level of entabbed code. Added flag -dt=n (--default_tabsize=n)
1919 which might be helpful if the guessing method does not work well for
1922 - Added support for stacked labels, upper case X/B in hex and binary, and
1925 - Eliminated warning messages for using keyword names as constants.
1929 - Corrected problem introduced by using a chomp on scalar references, RT #77978
1931 - Added support for Perl 5.14 package block syntax, RT #78114.
1933 - A convergence test is made if three or more iterations are requested with
1934 the -it=n parameter to avoid wasting computer time. Several hundred Mb of
1935 code gleaned from the internet were searched with the results that:
1936 - It is unusual for two iterations to be required unless a major
1937 style change is being made.
1938 - Only one case has been found where three iterations were required.
1939 - No cases requiring four iterations have been found with this version.
1940 For the previous version several cases where found the results could
1941 oscillate between two semi-stable states. This version corrects this.
1943 So if it is important that the code be converged it is okay to set -it=4
1944 with this version and it will probably stop after the second iteration.
1946 - Improved ability to identify and retain good line break points in the
1947 input stream, such as at commas and equals. You can always tell
1948 perltidy to ignore old breakpoints with -iob.
1950 - Fixed glitch in which a terminal closing hash brace followed by semicolon
1951 was not outdented back to the leading line depth like other closing
1952 tokens. Thanks to Keith Neargarder for noting this.
1955 my ( $pre, $post ) = @{
1957 "pp_anonlist" => [ "[", "]" ],
1958 "pp_anonhash" => [ "{", "}" ]
1963 my ( $pre, $post ) = @{
1965 "pp_anonlist" => [ "[", "]" ],
1966 "pp_anonhash" => [ "{", "}" ]
1970 - Removed extra indentation given to trailing 'if' and 'unless' clauses
1971 without parentheses because this occasionally produced undesirable
1972 results. This only applies where parens are not used after the if or
1977 unless my ( $who, $actions ) =
1978 $clause =~ /^($who_re)((?:$action_re)+)$/o;
1982 unless my ( $who, $actions ) =
1983 $clause =~ /^($who_re)((?:$action_re)+)$/o;
1987 - Updated perltidy to handle all quote modifiers defined for perl 5 version 16.
1989 - Side comment text in perltidyrc configuration files must now begin with
1990 at least one space before the #. Thus:
1993 -l=78 # Max line width is 78 cols
1995 -l=78# Max line width is 78 cols
1997 This is probably true of almost all existing perltidyrc files,
1998 but if you get an error message about bad parameters
1999 involving a '#' the first time you run this version, please check the side
2000 comments in your perltidyrc file, and add a space before the # if necessary.
2001 You can quickly see the contents your perltidyrc file, if any, with the
2006 The reason for this change is that some parameters naturally involve
2007 the # symbol, and this can get interpreted as a side comment unless the
2008 parameter is quoted. For example, to define -sphb=# it used to be necessary
2011 to keep the # from becoming part of a comment. This was causing
2012 trouble for new users. Now it can also be written without quotes:
2015 - Fixed bug in processing some .perltidyrc files containing parameters with
2016 an opening brace character, '{'. For example the following was
2017 incorrectly processed:
2018 --static-block-comment-prefix="^#{2,}[^\s#]"
2021 - Added flag -boa (--break-at-old-attribute-breakpoints) which retains
2022 any existing line breaks at attribute separation ':'. This is now the
2023 default, use -nboa to deactivate. Thanks to Daphne Phister for the patch.
2024 For example, given the following code, the line breaks at the ':'s will be
2030 : Get('Name' => 'foo') : Set('Name');
2032 whereas the previous version would have output a single line. If
2033 the attributes are on a single line then they will remain on a single line.
2035 - Added new flags --blank-lines-before-subs=n (-blbs=n) and
2036 --blank-lines-before-packages=n (-blbp=n) to put n blank lines before
2037 subs and packages. The old flag -bbs is now equivalent to -blbs=1 -blbp=1.
2038 and -nbbs is equivalent to -blbs=0 -blbp=0. Requested by M. Schwern and
2041 - Added feature -nsak='*' meaning no space between any keyword and opening
2042 paren. This avoids listing entering a long list of keywords. Requested
2045 - Added option to delete a backup of original file with in-place-modify (-b)
2046 if there were no errors. This can be requested with the flag -bext='/'.
2047 See documentation for details. Requested by M. Schwern and others.
2049 - Fixed bug where the module postfilter parameter was not applied when -b
2050 flag was used. This was discovered during testing.
2052 - Fixed in-place-modify (-b) to work with symbolic links to source files.
2053 Thanks to Ted Johnson.
2055 - Fixed bug where the Perl::Tidy module did not allow -b to be used
2058 - No extra blank line is added before a comment which follows
2059 a short line ending in an opening token, for example like this:
2063 # unless we follow a blank or comment line
2064 $last_line_leading_type !~ /^[#b]$/
2069 # unless we follow a blank or comment line
2070 $last_line_leading_type !~ /^[#b]$/
2073 The blank is not needed for readability in these cases because there
2074 already is already space above the comment. If a blank already
2075 exists there it will not be removed, so this change should not
2076 change code which has previously been formatted with perltidy.
2077 Thanks to R.W.Stauner.
2079 - Likewise, no extra blank line is added above a comment consisting of a
2080 single #, since nothing is gained in readability.
2082 - Fixed error in which a blank line was removed after a #>>> directive.
2083 Thanks to Ricky Morse.
2085 - Unnecessary semicolons after given/when/default blocks are now removed.
2087 - Fixed bug where an unwanted blank line could be added before
2088 pod text in __DATA__ or __END__ section. Thanks to jidani.
2090 - Changed exit flags from 1 to 0 to indicate success for -help, -version,
2091 and all -dump commands. Also added -? as another way to dump the help.
2092 Requested by Keith Neargarder.
2094 - Fixed bug where .ERR and .LOG files were not written except for -it=2 or more
2096 - Fixed bug where trailing blank lines at the end of a file were dropped when
2099 - Fixed bug where a line occasionally ended with an extra space. This reduces
2100 rhe number of instances where a second iteration gives a result different
2103 - Updated documentation to note that the Tidy.pm module <stderr> parameter may
2104 not be a reference to SCALAR or ARRAY; it must be a file.
2106 - Syntax check with perl now work when the Tidy.pm module is processing
2107 references to arrays and strings. Thanks to Charles Alderman.
2109 - Zero-length files are no longer processed due to concerns for data loss
2110 due to side effects in some scenarios.
2112 - block labels, if any, are now included in closing side comment text
2113 when the -csc flag is used. Suggested by Aaron. For example,
2114 the label L102 in the following block is now included in the -csc text:
2116 L102: for my $i ( 1 .. 10 ) {
2118 } ## end L102: for my $i ( 1 .. 10 )
2122 - added new flag -it=n or --iterations=n
2123 This flag causes perltidy to do n complete iterations.
2124 For most purposes the default of n=1 should be satisfactory. However n=2
2125 can be useful when a major style change is being made, or when code is being
2126 beautified on check-in to a source code control system. The run time will be
2127 approximately proportional to n, and it should seldom be necessary to use a
2128 value greater than n=2. Thanks to Jonathan Swartz
2130 - A configuration file pathname begins with three dots, e.g.
2131 ".../.perltidyrc", indicates that the file should be searched for starting
2132 in the current directory and working upwards. This makes it easier to have
2133 multiple projects each with their own .perltidyrc in their root directories.
2134 Thanks to Jonathan Swartz for this patch.
2136 - Added flag --notidy which disables all formatting and causes the input to be
2137 copied unchanged. This can be useful in conjunction with hierarchical
2138 F<.perltidyrc> files to prevent unwanted tidying.
2139 Thanks to Jonathan Swartz for this patch.
2141 - Added prefilters and postfilters in the call to the Tidy.pm module.
2142 Prefilters and postfilters. The prefilter is a code reference that
2143 will be applied to the source before tidying, and the postfilter
2144 is a code reference to the result before outputting.
2146 Thanks to Jonathan Swartz for this patch. He writes:
2147 This is useful for all manner of customizations. For example, I use
2148 it to convert the 'method' keyword to 'sub' so that perltidy will work for
2149 Method::Signature::Simple code:
2151 Perl::Tidy::perltidy(
2152 prefilter => sub { $_ = $_[0]; s/^method (.*)/sub $1 \#__METHOD/gm; return $_ },
2153 postfilter => sub { $_ = $_[0]; s/^sub (.*?)\s* \#__METHOD/method $1/gm; return $_ }
2156 - The starting indentation level of sections of code entabbed with -et=n
2157 is correctly guessed if it was also produced with the same -et=n flag. This
2158 keeps the indentation stable on repeated formatting passes within an editor.
2159 Thanks to Sam Kington and Glenn.
2161 - Functions with prototype '&' had a space between the function and opening
2162 peren. This space now only occurs if the flag --space-function-paren (-sfp)
2163 is set. Thanks to Zrajm Akfohg.
2165 - Patch to never put spaces around a bare word in braces beginning with ^ as in:
2166 my $before = ${^PREMATCH};
2167 even if requested with the -bt=0 flag because any spaces cause a syntax error in perl.
2168 Thanks to Fabrice Dulanoy.
2172 - Allow configuration file to be 'perltidy.ini' for Windows systems.
2173 i.e. C:\Documents and Settings\User\perltidy.ini
2174 and added documentation for setting configuation file under Windows in man
2175 page. Thanks to Stuart Clark.
2177 - Corrected problem of unwanted semicolons in hash ref within given/when code.
2178 Thanks to Nelo Onyiah.
2180 - added new flag -cscb or --closing-side-comments-balanced
2181 When using closing-side-comments, and the closing-side-comment-maximum-text
2182 limit is exceeded, then the comment text must be truncated. Previous
2183 versions of perltidy terminate with three dots, and this can still be
2184 achieved with -ncscb:
2186 perltidy -csc -ncscb
2188 } ## end foreach my $foo (sort { $b cmp $a ...
2190 However this causes a problem with older editors which cannot recognize
2191 comments or are not configured to doso because they cannot "bounce" around in
2192 the text correctly. The B<-cscb> flag tries to help them by
2193 appending appropriate terminal balancing structure:
2197 } ## end foreach my $foo (sort { $b cmp $a ... })
2199 Since there is much to be gained and little to be lost by doing this,
2200 the default is B<-cscb>. Use B<-ncscb> if you do not want this.
2202 Thanks to Daniel Becker for suggesting this option.
2204 - After an isolated closing eval block the continuation indentation will be
2205 removed so that the braces line up more like other blocks. Thanks to Yves Orton.
2224 -A new flag -asbl (or --opening-anonymous-sub-brace-on-new-line) has
2225 been added to put the opening brace of anonymous sub's on a new line,
2226 as in the following snippet:
2234 This was not possible before because the -sbl flag only applies to named
2235 subs. Thanks to Benjamin Krupp.
2237 -Fix tokenization bug with the following snippet
2238 print 'hi' if { x => 1, }->{x};
2239 which resulted in a semicolon being added after the comma. The workaround
2240 was to use -nasc, but this is no longer necessary. Thanks to Brian Duggan.
2242 -Fixed problem in which an incorrect error message could be triggered
2243 by the (unusual) combination of parameters -lp -i=0 -l=2 -ci=0 for
2244 example. Thanks to Richard Jelinek.
2246 -A new flag --keep-old-blank-lines=n has been added to
2247 give more control over the treatment of old blank lines in
2248 a script. The manual has been revised to discuss the new
2249 flag and clarify the treatment of old blank lines. Thanks
2254 -Improved support for perl 5.10: New quote modifier 'p', new block type UNITCHECK,
2255 new keyword break, improved formatting of given/when.
2257 -Corrected tokenization bug of something like $var{-q}.
2259 -Numerous minor formatting improvements.
2261 -Corrected list of operators controlled by -baao -bbao to include
2262 . : ? && || and or err xor
2264 -Corrected very minor error in log file involving incorrect comment
2265 regarding need for upper case of labels.
2267 -Fixed problem where perltidy could run for a very long time
2268 when given certain non-perl text files.
2270 -Line breaks in un-parenthesized lists now try to follow
2271 line breaks in the input file rather than trying to fill
2272 lines. This usually works better, but if this causes
2273 trouble you can use -iob to ignore any old line breaks.
2274 Example for the following input snippet:
2277 "conformability (Not the same dimension)\n",
2278 "\t", $have, " is ", text_unit($hu), "\n",
2279 "\t", $want, " is ", text_unit($wu), "\n",
2283 print "conformability (Not the same dimension)\n", "\t", $have, " is ",
2284 text_unit($hu), "\n", "\t", $want, " is ", text_unit($wu), "\n",;
2287 print "conformability (Not the same dimension)\n",
2288 "\t", $have, " is ", text_unit($hu), "\n",
2289 "\t", $want, " is ", text_unit($wu), "\n",
2294 -Added -fpsc option (--fixed-position-side-comment). Thanks to Ueli Hugenschmidt.
2295 For example -fpsc=40 tells perltidy to put side comments in column 40
2298 -Added -bbao and -baao options (--break-before-all-operators and
2299 --break-after-all-operators) to simplify command lines and configuration
2300 files. These define an initial preference for breaking at operators which can
2301 be modified with -wba and -wbb flags. For example to break before all operators
2302 except an = one could use --bbao -wba='=' rather than listing every
2303 single perl operator (except =) on a -wbb flag.
2305 -Added -kis option (--keep-interior-semicolons). Use the B<-kis> flag
2306 to prevent breaking at a semicolon if there was no break there in the
2307 input file. To illustrate, consider the following input lines:
2309 dbmclose(%verb_delim); undef %verb_delim;
2310 dbmclose(%expanded); undef %expanded;
2311 dbmclose(%global); undef %global;
2313 Normally these would be broken into six lines, but
2314 perltidy -kis gives:
2316 dbmclose(%verb_delim); undef %verb_delim;
2317 dbmclose(%expanded); undef %expanded;
2318 dbmclose(%global); undef %global;
2320 -Improved formatting of complex ternary statements, with indentation
2321 of nested statements.
2323 return defined( $cw->{Selected} )
2325 ? @{ $cw->{Selected} }
2326 : $cw->{Selected}[0]
2330 return defined( $cw->{Selected} )
2332 ? @{ $cw->{Selected} }
2333 : $cw->{Selected}[0]
2336 -Text following un-parenthesized if/unless/while/until statements get a
2337 full level of indentation. Suggested by Jeff Armstrong and others.
2339 return $ship->chargeWeapons("phaser-canon")
2340 if $encounter->description eq 'klingon'
2341 and $ship->firepower >= $encounter->firepower
2342 and $location->status ne 'neutral';
2344 return $ship->chargeWeapons("phaser-canon")
2345 if $encounter->description eq 'klingon'
2346 and $ship->firepower >= $encounter->firepower
2347 and $location->status ne 'neutral';
2351 -Fixed bug where #line directives were being indented. Thanks to
2356 -Fixed problem where an extra blank line was added after an =cut when either
2357 (a) the =cut started (not stopped) a POD section, or (b) -mbl > 1.
2358 Thanks to J. Robert Ray and Bill Moseley.
2362 -ole (--output-line-ending) and -ple (--preserve-line-endings) should
2363 now work on all systems rather than just unix systems. Thanks to Dan
2366 -Fixed problem of a warning issued for multiple subs for BEGIN subs
2367 and other control subs. Thanks to Heiko Eissfeldt.
2369 -Fixed problem where no space was introduced between a keyword or
2370 bareword and a colon, such as:
2372 ( ref($result) eq 'HASH' && !%$result ) ? undef: $result;
2376 -Added a utility program 'break_long_quotes.pl' to the examples directory of
2377 the distribution. It breaks long quoted strings into a chain of concatenated
2378 sub strings no longer than a selected length. Suggested by Michael Renner as
2379 a perltidy feature but was judged to be best done in a separate program.
2381 -Updated docs to remove extra < and >= from list of tokens
2382 after which breaks are made by default. Thanks to Bob Kleemann.
2384 -Removed improper uses of $_ to avoid conflicts with external calls, giving
2385 error message similar to:
2386 Modification of a read-only value attempted at
2387 /usr/share/perl5/Perl/Tidy.pm line 6907.
2388 Thanks to Michael Renner.
2390 -Fixed problem when errorfile was not a plain filename or filehandle
2391 in a call to Tidy.pm. The call
2392 perltidy(source => \$input, destination => \$output, errorfile => \$err);
2393 gave the following error message:
2394 Not a GLOB reference at /usr/share/perl5/Perl/Tidy.pm line 3827.
2395 Thanks to Michael Renner and Phillipe Bruhat.
2397 -Fixed problem where -sot would not stack an opening token followed by
2398 a side comment. Thanks to Jens Schicke.
2400 -improved breakpoints in complex math and other long statements. Example:
2403 log($n) + 0.577215664901532 + ( 1 / ( 2 * $n ) ) -
2404 ( 1 / ( 12 * ( $n**2 ) ) ) + ( 1 / ( 120 * ( $n**4 ) ) );
2407 log($n) + 0.577215664901532 +
2408 ( 1 / ( 2 * $n ) ) -
2409 ( 1 / ( 12 * ( $n**2 ) ) ) +
2410 ( 1 / ( 120 * ( $n**4 ) ) );
2412 -more robust vertical alignment of complex terminal else blocks and ternary
2417 -Eliminated bug where a here-doc invoked through an 'e' modifier on a pattern
2418 replacement text was not recognized. The tokenizer now recursively scans
2419 replacement text (but does not reformat it).
2421 -improved vertical alignment of terminal else blocks and ternary statements.
2422 Thanks to Chris for the suggestion.
2425 if ( IsBitmap() ) { return GetBitmap(); }
2426 elsif ( IsFiles() ) { return GetFiles(); }
2427 else { return GetText(); }
2430 if ( IsBitmap() ) { return GetBitmap(); }
2431 elsif ( IsFiles() ) { return GetFiles(); }
2432 else { return GetText(); }
2436 $opts{"t"} ? 'title'
2437 : $opts{"s"} ? 'subject'
2438 : $opts{"a"} ? 'author'
2443 $opts{"t"} ? 'title'
2444 : $opts{"s"} ? 'subject'
2445 : $opts{"a"} ? 'author'
2448 -improved indentation of try/catch blocks and other externally defined
2449 functions accepting a block argument. Thanks to jae.
2451 -Added support for Perl 5.10 features say and smartmatch.
2453 -Added flag -pbp (--perl-best-practices) as an abbreviation for parameters
2454 suggested in Damian Conway's "Perl Best Practices". -pbp is the same as:
2456 -l=78 -i=4 -ci=4 -st -se -vt=2 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nsfs -nolq
2457 -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < =
2458 **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
2460 Please note that the -st here restricts input to standard input; use
2461 -nst if necessary to override.
2463 -Eliminated some needless breaks at equals signs in -lp indentation.
2467 Math::Complex->make(LEFT + $x * (RIGHT - LEFT) / SIZE,
2468 TOP + $y * (BOTTOM - TOP) / SIZE);
2470 $c = Math::Complex->make(LEFT + $x * (RIGHT - LEFT) / SIZE,
2471 TOP + $y * (BOTTOM - TOP) / SIZE);
2473 A break at an equals is sometimes useful for preventing complex statements
2474 from hitting the line length limit. The decision to do this was
2475 over-eager in some cases and has been improved. Thanks to Royce Reece.
2477 -qw quotes contained in braces, square brackets, and parens are being
2478 treated more like those containers as far as stacking of tokens. Also
2479 stack of closing tokens ending ');' will outdent to where the ');' would
2480 have outdented if the closing stack is matched with a similar opening stack.
2482 OLD: perltidy -soc -sct
2483 __PACKAGE__->load_components(
2489 NEW: perltidy -soc -sct
2490 __PACKAGE__->load_components( qw(
2494 Thanks to Aran Deltac
2496 -Eliminated some undesirable or marginally desirable vertical alignments.
2497 These include terminal colons, opening braces, and equals, and particularly
2498 when just two lines would be aligned.
2501 my $accurate_timestamps = $Stamps{lnk};
2505 my $accurate_timestamps = $Stamps{lnk};
2508 -Corrected a problem with -mangle in which a space would be removed
2509 between a keyword and variable beginning with ::.
2513 -Attribute argument lists are now correctly treated as quoted strings
2514 and not formatted. This is the most important update in this version.
2515 Thanks to Borris Zentner, Greg Ferguson, Steve Kirkup.
2517 -Updated to recognize the defined or operator, //, to be released in Perl 10.
2518 Thanks to Sebastien Aperghis-Tramoni.
2520 -A useful utility perltidyrc_dump.pl is included in the examples section. It
2521 will read any perltidyrc file and write it back out in a standard format
2522 (though comments are lost).
2524 -Added option to have perltidy read and return a hash with the contents of a
2525 perltidyrc file. This may be used by Leif Eriksen's tidyview code. This
2526 feature is used by the demonstration program 'perltidyrc_dump.pl' in the
2529 -Improved error checking in perltidyrc files. Unknown bare words were not
2532 -The --dump-options parameter now dumps parameters in the format required by a
2535 -V-Strings with underscores are now recognized.
2536 For example: $v = v1.2_3;
2538 -cti=3 option added which gives one extra indentation level to closing
2539 tokens always. This provides more predictable closing token placement
2540 than cti=2. If you are using cti=2 you might want to try cti=3.
2542 -To identify all left-adjusted comments as static block comments, use C<-sbcp='^#'>.
2544 -New parameters -fs, -fsb, -fse added to allow sections of code between #<<<
2545 and #>>> to be passed through verbatim. This is enabled by default and turned
2546 off by -nfs. Flags -fsb and -fse allow other beginning and ending markers.
2547 Thanks to Wolfgang Werner and Marion Berryman for suggesting this.
2549 -added flag -skp to put a space between all Perl keywords and following paren.
2550 The default is to only do this for certain keywords. Suggested by
2553 -added flag -sfp to put a space between a function name and following paren.
2554 The default is not to do this. Suggested by H.Merijn Brand.
2556 -Added patch to avoid breaking GetOpt::Long::Configure set by calling program.
2557 Thanks to Philippe Bruhat.
2559 -An error was fixed in which certain parameters in a .perltidyrc file given
2560 without the equals sign were not recognized. That is,
2561 '--brace-tightness 0' gave an error but '--brace-tightness=0' worked
2562 ok. Thanks to Zac Hansen.
2564 -An error preventing the -nwrs flag from working was corrected. Thanks to
2567 -Corrected some alignment problems with entab option.
2569 -A bug with the combination of -lp and -extrude was fixed (though this
2570 combination doesn't really make sense). The bug was that a line with
2571 a single zero would be dropped. Thanks to Cameron Hayne.
2573 -Updated Windows detection code to avoid an undefined variable.
2574 Thanks to Joe Yates and Russ Jones.
2576 -Improved formatting for short trailing statements following a closing paren.
2577 Thanks to Joe Matarazzo.
2579 -The handling of the -icb (indent closing block braces) flag has been changed
2580 slightly to provide more consistent and predictable formatting of complex
2581 structures. Instead of giving a closing block brace the indentation of the
2582 previous line, it is now given one extra indentation level. The two methods
2583 give the same result if the previous line was a complete statement, as in this
2592 The change also fixes a problem with empty blocks such as:
2602 -A problem with -icb was fixed in which a closing brace was misplaced when
2603 it followed a quote which spanned multiple lines.
2605 -Some improved breakpoints for -wba='&& || and or'
2607 -Fixed problem with misaligned cuddled else in complex statements
2608 when the -bar flag was also used. Thanks to Alex and Royce Reese.
2610 -Corrected documentation to show that --outdent-long-comments is the default.
2611 Thanks to Mario Lia.
2613 -New flag -otr (opening-token-right) is similar to -bar (braces-always-right)
2614 but applies to non-structural opening tokens.
2616 -new flags -sot (stack-opening-token), -sct (stack-closing-token).
2621 -The default has been changed to not do syntax checking with perl.
2622 Use -syn if you want it. Perltidy is very robust now, and the -syn
2623 flag now causes more problems than it's worth because of BEGIN blocks
2624 (which get executed with perl -c). For example, perltidy will never
2625 return when trying to beautify this code if -syn is used:
2627 BEGIN { 1 while { }; }
2629 Although this is an obvious error, perltidy is often run on untested
2630 code which is more likely to have this sort of problem. A more subtle
2633 BEGIN { use FindBin; }
2635 which may hang on some systems using -syn if a shared file system is
2638 -Changed style -gnu to use -cti=1 instead of -cti=2 (see next item).
2639 In most cases it looks better. To recover the previous format, use
2642 -Added flags -cti=n for finer control of closing token indentation.
2643 -cti = 0 no extra indentation (default; same as -nicp)
2644 -cti = 1 enough indentation so that the closing token
2645 aligns with its opening token.
2646 -cti = 2 one extra indentation level if the line has the form
2647 ); ]; or }; (same as -icp).
2649 The new option -cti=1 works well with -lp:
2653 # perltidy -lp -cti=1
2655 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
2656 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
2659 # perltidy -lp -cti=2
2661 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
2662 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
2664 This is backwards compatible with -icp. See revised manual for
2665 details. Suggested by Mike Pennington.
2667 -Added flag '--preserve-line-endings' or '-ple' to cause the output
2668 line ending to be the same as in the input file, for unix, dos,
2669 or mac line endings. Only works under unix. Suggested by
2672 -Added flag '--output-line-ending=s' or '-ole=s' where s=dos or win,
2673 unix, or mac. Only works under unix.
2675 -Files with Mac line endings should now be handled properly under unix
2676 and dos without being passed through a converter.
2678 -You may now include 'and', 'or', and 'xor' in the list following
2679 '--want-break-after' to get line breaks after those keywords rather than
2680 before them. Suggested by Rainer Hochschild.
2682 -Corrected problem with command line option for -vtc=n and -vt=n. The
2683 equals sign was being eaten up by the Windows shell so perltidy didn't
2688 -Corrected cause of warning message with recent versions of Perl:
2689 "Possible precedence problem on bitwise & operator at ..."
2690 Thanks to Jim Files.
2692 -fixed bug with -html with '=for pod2html' sections, in which code/pod
2693 output order was incorrect. Thanks to Tassilo von Parseval.
2695 -fixed bug when the -html flag is used, in which the following error
2696 message, plus others, appear:
2697 did not see <body> in pod2html output
2698 This was caused by a change in the format of html output by pod2html
2699 VERSION 1.04 (included with perl 5.8). Thanks to Tassilo von Parseval.
2701 -Fixed bug where an __END__ statement would be mistaken for a label
2702 if it is immediately followed by a line with a leading colon. Thanks
2705 -Implemented guessing logic for brace types when it is ambiguous. This
2706 has been on the TODO list a long time. Thanks to Boris Zentner for
2709 -Long options may now be negated either as '--nolong-option'
2710 or '--no-long-option'. Thanks to Philip Newton for the suggestion.
2712 -added flag --html-entities or -hent which controls the use of
2713 Html::Entities for html formatting. Use --nohtml-entities or -nhent to
2714 prevent the use of Html::Entities to encode special symbols. The
2715 default is -hent. Html::Entities when formatting perl text to escape
2716 special symbols. This may or may not be the right thing to do,
2717 depending on browser/language combinations. Thanks to Burak Gursoy for
2720 -Bareword strings with leading '-', like, '-foo' now count as 1 token
2721 for horizontal tightness. This way $a{'-foo'}, $a{foo}, and $a{-foo}
2722 are now all treated similarly. Thus, by default, OLD: $a{ -foo } will
2723 now be NEW: $a{-foo}. Suggested by Mark Olesen.
2725 -added 2 new flags to control spaces between keywords and opening parens:
2726 -sak=s or --space-after-keyword=s, and
2727 -nsak=s or --nospace-after-keyword=s, where 's' is a list of keywords.
2729 The new default list of keywords which get a space is:
2731 "my local our and or eq ne if else elsif until unless while for foreach
2732 return switch case given when"
2734 Use -sak=s and -nsak=s to add and remove keywords from this list,
2737 Explanation: Stephen Hildrey noted that perltidy was being inconsistent
2738 in placing spaces between keywords and opening parens, and sent a patch
2739 to give user control over this. The above list was selected as being
2740 a reasonable default keyword list. Previously, perltidy
2741 had a hardwired list which also included these keywords:
2743 push pop shift unshift join split die
2745 but did not have 'our'. Example: if you prefer to make perltidy behave
2746 exactly as before, you can include the following two lines in your
2749 -sak="push pop local shift unshift join split die"
2752 -Corrected html error in .toc file when -frm -html is used (extra ");
2753 browsers were tolerant of it.
2755 -Improved alignment of chains of binary and ?/: operators. Example:
2769 -improved breakpoint choices involving '->'
2771 -Corrected tokenization of things like ${#}. For example,
2772 ${#} is valid, but ${# } is a syntax error.
2774 -Corrected minor tokenization errors with indirect object notation.
2775 For example, 'new A::()' works now.
2777 -Minor tokenization improvements; all perl code distributed with perl 5.8
2778 seems to be parsed correctly except for one instance (lextest.t)
2783 -Implemented scalar attributes. Thanks to Sean Tobin for noting this.
2785 -Fixed glitch introduced in previous release where -pre option
2786 was not outputting a leading html <pre> tag.
2788 -Numerous minor improvements in vertical alignment, including the following:
2790 -Improved alignment of opening braces in many cases. Needed for improved
2791 switch/case formatting, and also suggested by Mark Olesen for sort/map/grep
2792 formatting. For example:
2797 sort { $a->[1] <=> $b->[1] }
2798 map { [ $_, -M ] } @filenames;
2803 sort { $a->[1] <=> $b->[1] }
2804 map { [ $_, -M ] } @filenames;
2806 -Eliminated alignments across unrelated statements. Example:
2808 $borrowerinfo->configure( -state => 'disabled' );
2809 $borrowerinfo->grid( -col => 1, -row => 0, -sticky => 'w' );
2812 $borrowerinfo->configure( -state => 'disabled' );
2813 $borrowerinfo->grid( -col => 1, -row => 0, -sticky => 'w' );
2815 Thanks to Mark Olesen for suggesting this.
2817 -Improved alignement of '='s in certain cases.
2818 Thanks to Norbert Gruener for sending an example.
2820 -Outdent-long-comments (-olc) has been re-instated as a default, since
2821 it works much better now. Use -nolc if you want to prevent it.
2823 -Added check for 'perltidy file.pl -o file.pl', which causes file.pl
2824 to be lost. (The -b option should be used instead). Thanks to mreister
2825 for reporting this problem.
2829 -Switch/case or given/when syntax is now recognized. Its vertical alignment
2830 is not great yet, but it parses ok. The words 'switch', 'case', 'given',
2831 and 'when' are now treated as keywords. If this causes trouble with older
2832 code, we could introduce a switch to deactivate it. Thanks to Stan Brown
2833 and Jochen Schneider for recommending this.
2835 -Corrected error parsing sub attributes with call parameters.
2836 Thanks to Marc Kerr for catching this.
2838 -Sub prototypes no longer need to be on the same line as sub names.
2840 -a new flag -frm or --frames will cause html output to be in a
2841 frame, with table of contents in the left panel and formatted source
2842 in the right panel. Try 'perltidy -html -frm somemodule.pm' for example.
2844 -The new default for -html formatting is to pass the pod through Pod::Html.
2845 The result is syntax colored code within your pod documents. This can be
2846 deactivated with -npod. Thanks to those who have written to discuss this,
2847 particularly Mark Olesen and Hugh Myers.
2849 -the -olc (--outdent-long-comments) option works much better. It now outdents
2850 groups of consecutive comments together, and by just the amount needed to
2851 avoid having any one line exceeding the maximum line length.
2853 -block comments are now trimmed of trailing whitespace.
2855 -if a directory specified with -opath does not exist, it will be created.
2857 -a table of contents to packages and subs is output when -html is used.
2858 Use -ntoc to prevent this.
2860 -fixed an unusual bug in which a 'for' statement following a 'format'
2861 statement was not correctly tokenized. Thanks to Boris Zentner for
2864 -Tidy.pm is no longer dependent on modules IO::Scalar and IO::ScalarArray.
2865 There were some speed issues. Suggested by Joerg Walter.
2867 -The treatment of quoted wildcards (file globs) is now system-independent.
2870 perltidy 'b*x.p[lm]'
2872 would match box.pl, box.pm, brinx.pm under any operating system. Of
2873 course, anything unquoted will be subject to expansion by any shell.
2875 -default color for keywords under -html changed from
2876 SaddleBrown (#8B4513) to magenta4 (#8B008B).
2878 -fixed an arg parsing glitch in which something like:
2880 would trigger the help message and exit, rather than operate on the
2885 -New option '-b' or '--backup-and-modify-in-place' will cause perltidy to
2886 overwrite the original file with the tidied output file. The original
2887 file will be saved with a '.bak' extension (which can be changed with
2888 -bext=s). Thanks to Rudi Farkas for the suggestion.
2890 -An index to all subs is included at the top of -html output, unless
2891 only the <pre> section is written.
2893 -Anchor lines of the form <a name="mysub"></a> are now inserted at key points
2894 in html output, such as before sub definitions, for the convenience of
2895 postprocessing scripts. Suggested by Howard Owen.
2897 -The cuddled-else (-ce) flag now also makes cuddled continues, like
2900 while ( ( $pack, $file, $line ) = caller( $i++ ) ) {
2906 Suggested by Simon Perreault.
2908 -Fixed bug in which an extra blank line was added before an =head or
2909 similar pod line after an __END__ or __DATA__ line each time
2910 perltidy was run. Also, an extra blank was being added after
2911 a terminal =cut. Thanks to Mike Birdsall for reporting this.
2915 -Fixed bug in which space was inserted in a hyphenated hash key:
2916 my $val = $myhash{USER-NAME};
2918 my $val = $myhash{USER -NAME};
2919 Thanks to an anonymous bug reporter at sourceforge.
2921 -Fixed problem with the '-io' ('--indent-only') where all lines
2922 were double spaced. Thanks to Nick Andrew for reporting this bug.
2924 -Fixed tokenization error in which something like '-e1' was
2927 -Corrected a rare problem involving older perl versions, in which
2928 a line break before a bareword caused problems with 'use strict'.
2929 Thanks to Wolfgang Weisselberg for noting this.
2931 -More syntax error checking added.
2933 -Outdenting labels (-ola) has been made the default, in order to follow the
2934 perlstyle guidelines better. It's probably a good idea in general, but
2935 if you do not want this, use -nola in your .perltidyrc file.
2937 -Updated rules for padding logical expressions to include more cases.
2938 Thanks to Wolfgang Weisselberg for helpful discussions.
2940 -Added new flag -osbc (--outdent-static-block-comments) which will
2941 outdent static block comments by 2 spaces (or whatever -ci equals).
2942 Requested by Jon Robison.
2946 -Corrected a bug, introduced in the previous release, in which some
2947 closing side comments (-csc) could have incorrect text. This is
2948 annoying but will be correct the next time perltidy is run with -csc.
2950 -Fixed bug where whitespace was being removed between 'Bar' and '()'
2951 in a use statement like:
2955 -Whenever possible, if a logical expression is broken with leading
2956 '&&', '||', 'and', or 'or', then the leading line will be padded
2957 with additional space to produce alignment. This has been on the
2958 todo list for a long time; thanks to Frank Steinhauer for reminding
2959 me to do it. Notice the first line after the open parens here:
2963 !param("rules.to.$linecount")
2964 && !param("rules.from.$linecount")
2965 && !param("rules.subject.$linecount")
2967 param("rules.fieldname.$linecount")
2968 && param("rules.fieldval.$linecount")
2970 && !param("rules.size.$linecount")
2971 && !param("rules.custom.$linecount")
2976 !param("rules.to.$linecount")
2977 && !param("rules.from.$linecount")
2978 && !param("rules.subject.$linecount")
2980 param("rules.fieldname.$linecount")
2981 && param("rules.fieldval.$linecount")
2983 && !param("rules.size.$linecount")
2984 && !param("rules.custom.$linecount")
2989 -Corrected a mistokenization of variables for a package with a name
2990 equal to a perl keyword. For example:
2994 sub qx{print "Hello from my::qx\n";}
2996 In this case, the leading 'my' was mistokenized as a keyword, and a
2997 space was being place between 'my' and '::'. This has been
2998 corrected. Thanks to Martin Sluka for discovering this.
3000 -A new flag -bol (--break-at-old-logic-breakpoints)
3001 has been added to control whether containers with logical expressions
3002 should be broken open. This is the default.
3004 -A new flag -bok (--break-at-old-keyword-breakpoints)
3005 has been added to follow breaks at old keywords which return lists,
3006 such as sort and map. This is the default.
3008 -A new flag -bot (--break-at-old-trinary-breakpoints) has been added to
3009 follow breaks at trinary (conditional) operators. This is the default.
3011 -A new flag -cab=n has been added to control breaks at commas after
3012 '=>' tokens. The default is n=1, meaning break unless this breaks
3013 open an existing on-line container.
3015 -A new flag -boc has been added to allow existing list formatting
3016 to be retained. (--break-at-old-comma-breakpoints). See updated manual.
3018 -A new flag -iob (--ignore-old-breakpoints) has been added to
3019 prevent the locations of old breakpoints from influencing the output
3022 -Corrected problem where nested parentheses were not getting full
3023 indentation. This has been on the todo list for some time; thanks
3024 to Axel Rose for a snippet demonstrating this issue.
3026 OLD: inner list is not indented
3030 $ret->name, $user->username, $user->host,
3031 $user->server->name, $user->nick, "H"
3039 $ret->name, $user->username, $user->host,
3040 $user->server->name, $user->nick, "H"
3044 -Code cleaned up by removing the following unused, undocumented flags.
3045 They should not be in any .perltidyrc files because they were just
3046 experimental flags which were never documented. Most of them placed
3047 artificial limits on spaces, and Wolfgang Weisselberg convinced me that
3048 most of them they do more harm than good by causing unexpected results.
3050 --maximum-continuation-indentation (-mci)
3051 --maximum-whitespace-columns
3052 --maximum-space-to-comment (-xsc)
3053 --big-space-jump (-bsj)
3055 -Pod file 'perltidy.pod' has been appended to the script 'perltidy', and
3056 Tidy.pod has been append to the module 'Tidy.pm'. Older MakeMaker's
3057 were having trouble.
3059 -A new flag -isbc has been added for more control on comments. This flag
3060 has the effect that if there is no leading space on the line, then the
3061 comment will not be indented, and otherwise it may be. If both -ibc and
3062 -isbc are set, then -isbc takes priority. Thanks to Frank Steinhauer
3063 for suggesting this.
3065 -A new document 'stylekey.pod' has been created to quickly guide new users
3066 through the maze of perltidy style parameters. An html version is
3067 on the perltidy web page. Take a look! It should be very helpful.
3069 -Parameters for controlling 'vertical tightness' have been added:
3070 -vt and -vtc are the main controls, but finer control is provided
3071 with -pvt, -pcvt, -bvt, -bcvt, -sbvt, -sbcvt. Block brace vertical
3072 tightness controls have also been added.
3073 See updated manual and also see 'stylekey.pod'. Simple examples:
3075 # perltidy -lp -vt=1 -vtc=1
3076 @month_of_year = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
3077 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
3079 # perltidy -lp -vt=1 -vtc=0
3080 @month_of_year = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
3081 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
3084 -Lists which do not format well in uniform columns are now better
3085 identified and formated.
3088 return $c->create( 'polygon', $x, $y, $x + $ruler_info{'size'},
3089 $y + $ruler_info{'size'}, $x - $ruler_info{'size'},
3090 $y + $ruler_info{'size'} );
3095 $x + $ruler_info{'size'},
3096 $y + $ruler_info{'size'},
3097 $x - $ruler_info{'size'},
3098 $y + $ruler_info{'size'}
3102 radlablist($f1, pad('Initial', $p), $b->{Init}->get_panel_ref, 'None ',
3103 'None', 'Default', 'Default', 'Simple', 'Simple');
3107 $b->{Init}->get_panel_ref,
3108 'None ', 'None', 'Default', 'Default', 'Simple', 'Simple');
3110 -Corrected problem where an incorrect html filename was generated for
3111 external calls to Tidy.pm module. Fixed incorrect html title when
3112 Tidy.pm is called with IO::Scalar or IO::Array source.
3114 -Output file permissions are now set as follows. An output script file
3115 gets the same permission as the input file, except that owner
3116 read/write permission is added (otherwise, perltidy could not be
3117 rerun). Html output files use system defaults. Previously chmod 0755
3118 was used in all cases. Thanks to Mark Olesen for bringing this up.
3120 -Missing semicolons will not be added in multi-line blocks of type
3121 sort, map, or grep. This brings perltidy into closer agreement
3122 with common practice. Of course, you can still put semicolons
3123 there if you like. Thanks to Simon Perreault for a discussion of this.
3125 -Most instances of extra semicolons are now deleted. This is
3126 particularly important if the -csc option is used. Thanks to Wolfgang
3127 Weisselberg for noting this. For example, the following line
3128 (produced by 'h2xs' :) has an extra semicolon which will now be
3131 BEGIN { plan tests => 1 };
3133 -New parameter -csce (--closing-side-comment-else-flag) can be used
3134 to control what text is appended to 'else' and 'elsif' blocks.
3135 Default is to just add leading 'if' text to an 'else'. See manual.
3137 -The -csc option now labels 'else' blocks with additinal information
3138 from the opening if statement and elsif statements, if space.
3139 Thanks to Wolfgang Weisselberg for suggesting this.
3141 -The -csc option will now remove any old closing side comments
3142 below the line interval threshold. Thanks to Wolfgang Weisselberg for
3145 -The abbreviation feature, which was broken in the previous version,
3146 is now fixed. Thanks to Michael Cartmell for noting this.
3148 -Vertical alignment is now done for '||=' .. somehow this was
3153 -This version uses modules for the first time, and a standard perl
3154 Makefile.PL has been supplied. However, perltidy may still be
3155 installed as a single script, without modules. See INSTALL for
3158 -The man page 'perl2web' has been merged back into the main 'perltidy'
3159 man page to simplify installation. So you may remove that man page
3160 if you have an older installation.
3162 -Added patch from Axel Rose for MacPerl. The patch prompts the user
3163 for command line arguments before calling the module
3164 Perl::Tidy::perltidy.
3166 -Corrected bug with '-bar' which was introduced in the previous
3167 version. A closing block brace was being indented. Thanks to
3168 Alexandros M Manoussakis for reporting this.
3170 -New parameter '--entab-leading-whitespace=n', or '-et=n', has been
3171 added for those who prefer tabs. This behaves different from the
3172 existing '-t' parameter; see updated man page. Suggested by Mark
3175 -New parameter '--perl-syntax-check-flags=s' or '-pcsf=s' can be
3176 used to change the flags passed to perltidy in a syntax check.
3177 See updated man page. Suggested by Mark Olesen.
3179 -New parameter '--output-path=s' or '-opath=s' will cause output
3180 files to be placed in directory s. See updated man page. Thanks for
3181 Mark Olesen for suggesting this.
3183 -New parameter --dump-profile (or -dpro) will dump to
3184 standard output information about the search for a
3185 configuration file, the name of whatever configuration file
3186 is selected, and its contents. This should help debugging
3187 config files, especially on different Windows systems.
3189 -The -w parameter now notes possible errors of the form:
3191 $comment = s/^\s*(\S+)\..*/$1/; # trim whitespace
3193 -Corrections added for a leading ':' and for leaving a leading 'tcsh'
3194 line untouched. Mark Olesen reported that lines of this form were
3195 accepted by perl but not by perltidy:
3197 : # use -*- perl -*-
3198 eval 'exec perl -wS $0 "$@"' # shell should exec 'perl'
3199 unless 1; # but Perl should skip this one
3201 Perl will silently swallow a leading colon on line 1 of a
3202 script, and now perltidy will do likewise. For example,
3203 this is a valid script, provided that it is the first line,
3206 : print "Hello World\n";
3208 Also, perltidy will now mark a first line with leading ':' followed by
3209 '#' as type SYSTEM (just as a #! line), not to be formatted.
3211 -List formatting improved for certain lists with special
3212 initial terms, such as occur with 'printf', 'sprintf',
3213 'push', 'pack', 'join', 'chmod'. The special initial term is
3214 now placed on a line by itself. For example, perltidy -gnu
3218 "C4", hex($SourceAddr[0]),
3219 hex($SourceAddr[1]), hex($SourceAddr[2]),
3225 hex($SourceAddr[0]), hex($SourceAddr[1]),
3226 hex($SourceAddr[2]), hex($SourceAddr[3]));
3230 @{$$self{states}}, '64', '66', '68',
3231 '70', '72', '74', '76',
3232 '78', '80', '82', '84',
3233 '86', '88', '90', '92',
3234 '94', '96', '98', '100',
3241 '64', '66', '68', '70', '72', '74', '76',
3242 '78', '80', '82', '84', '86', '88', '90',
3243 '92', '94', '96', '98', '100', '102', '104'
3246 -Lists of complex items, such as matricies, are now detected
3247 and displayed with just one item per row:
3250 $this->{'CURRENT'}{'gfx'}{'MatrixSkew'} = Text::PDF::API::Matrix->new(
3251 [ 1, tan( deg2rad($a) ), 0 ], [ tan( deg2rad($b) ), 1, 0 ],
3256 $this->{'CURRENT'}{'gfx'}{'MatrixSkew'} = Text::PDF::API::Matrix->new(
3257 [ 1, tan( deg2rad($a) ), 0 ],
3258 [ tan( deg2rad($b) ), 1, 0 ],
3262 -The perl syntax check will be turned off for now when input is from
3263 standard input or standard output. The reason is that this requires
3264 temporary files, which has produced far too many problems during
3265 Windows testing. For example, the POSIX module under Windows XP/2000
3266 creates temporary names in the root directory, to which only the
3267 administrator should have permission to write.
3269 -Merged patch sent by Yves Orton to handle appropriate
3270 configuration file locations for different Windows varieties
3271 (2000, NT, Me, XP, 95, 98).
3273 -Added patch to properly handle a for/foreach loop without
3274 parens around a list represented as a qw. I didn't know this
3275 was possible until Wolfgang Weisselberg pointed it out:
3277 foreach my $key qw\Uno Due Tres Quadro\ {
3281 But Perl will give a syntax error without the $ variable; ie this will
3284 foreach qw\Uno Due Tres Quadro\ {
3288 -Merged Windows version detection code sent by Yves Orton. Perltidy
3289 now automatically turns off syntax checking for Win 9x/ME versions,
3290 and this has solved a lot of robustness problems. These systems
3291 cannot reliably handle backtick operators. See man page for
3294 -Merged VMS filename handling patch sent by Michael Cartmell. (Invalid
3295 output filenames were being created in some cases).
3297 -Numerous minor improvements have been made for -lp style indentation.
3299 -Long C-style 'for' expressions will be broken after each ';'.
3301 'perltidy -gnu' gives:
3304 for ($status = $db->seq($key, $value, R_CURSOR()) ; $status == 0
3305 and $key eq $origkey ; $status = $db->seq($key, $value, R_NEXT()))
3308 for ($status = $db->seq($key, $value, R_CURSOR()) ;
3309 $status == 0 and $key eq $origkey ;
3310 $status = $db->seq($key, $value, R_NEXT()))
3312 -For the -lp option, a single long term within parens
3313 (without commas) now has better alignment. For example,
3317 $self->throw("Must specify a known host, not $location,"
3318 . " possible values ("
3319 . join (",", sort keys %hosts) . ")");
3322 $self->throw("Must specify a known host, not $location,"
3323 . " possible values ("
3324 . join (",", sort keys %hosts) . ")");
3328 -This version is about 20 percent faster than the previous
3329 version as a result of optimization work. The largest gain
3330 came from switching to a dispatch hash table in the
3333 -perltidy -html will check to see if HTML::Entities is
3334 installed, and if so, it will use it to encode unsafe
3337 -Added flag -oext=ext to change the output file extension to
3338 be different from the default ('tdy' or 'html'). For
3341 perltidy -html -oext=htm filename
3343 will produce filename.htm
3345 -Added flag -cscw to issue warnings if a closing side comment would replace
3346 an existing, different side comments. See the man page for details.
3347 Thanks to Peter Masiar for helpful discussions.
3349 -Corrected tokenization error of signed hex/octal/binary numbers. For
3350 example, the first hex number below would have been parsed correctly
3351 but the second one was not:
3352 if ( ( $tmp >= 0x80_00_00 ) || ( $tmp < -0x80_00_00 ) ) { }
3354 -'**=' was incorrectly tokenized as '**' and '='. This only
3355 caused a problem with the -extrude opton.
3357 -Corrected a divide by zero when -extrude option is used
3359 -The flag -w will now contain all errors reported by 'perl -c' on the
3360 input file, but otherwise they are not reported. The reason is that
3361 perl will report lots of problems and syntax errors which are not of
3362 interest when only a small snippet is being formatted (such as missing
3363 modules and unknown bare words). Perltidy will always report all
3364 significant syntax errors that it finds, such as unbalanced braces,
3365 unless the -q (quiet) flag is set.
3367 -Merged modifications created by Hugh Myers into perltidy.
3368 These include a 'streamhandle' routine which allows perltidy
3369 as a module to operate on input and output arrays and strings
3370 in addition to files. Documentation and new packaging as a
3371 module should be ready early next year; This is an elegant,
3372 powerful update; many thanks to Hugh for contributing it.
3376 -added a tentative patch which tries to keep any existing breakpoints
3377 at lines with leading keywords map,sort,eval,grep. The idea is to
3378 improve formatting of sequences of list operations, as in a schwartzian
3382 my @sorted = map { $_->[0] }
3383 sort { $a->[1] <=> $b->[1] }
3384 map { [ $_, rand ] } @list;
3388 map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, rand ] } @list;
3391 my @sorted = map { $_->[0] }
3392 sort { $a->[1] <=> $b->[1] }
3393 map { [ $_, rand ] } @list;
3395 The new alignment is not as nice as the input, but this is an improvement.
3396 Thanks to Yves Orton for this suggestion.
3398 -modified indentation logic so that a line with leading opening paren,
3399 brace, or square bracket will never have less indentation than the
3400 line with the corresponding opening token. Here's a simple example:
3404 -text => "New Document",
3405 -command => \&new_document
3411 Note how the closing ');' is lined up with the first line, even
3412 though it closes a paren in the 'pack' line. That seems wrong.
3416 -text => "New Document",
3417 -command => \&new_document
3423 This seems nicer: you can up-arrow with an editor and arrive at the
3424 opening 'pack' line.
3426 -corrected minor glitch in which cuddled else (-ce) did not get applied
3427 to an 'unless' block, which should look like this:
3435 Thanks to Jeremy Mates for reporting this.
3437 -The man page has been reorganized to parameters easier to find.
3439 -Added check for multiple definitions of same subroutine. It is easy
3440 to introduce this problem when cutting and pasting. Perl does not
3441 complain about it, but it can lead to disaster.
3443 -The command -pro=filename or -profile=filename may be used to specify a
3444 configuration file which will override the default name of .perltidyrc.
3445 There must not be a space on either side of the '=' sign. I needed
3446 this to be able to easily test perltidy with a variety of different
3447 configuration files.
3449 -Side comment alignment has been improved somewhat across frequent level
3450 changes, as in short if/else blocks. Thanks to Wolfgang Weisselberg
3451 for pointing out this problem. For example:
3454 if ( ref $self ) { # Called as a method
3457 else { # Regular procedure call
3463 if ( ref $self ) { # Called as a method
3466 else { # Regular procedure call
3471 -New command -ssc (--static-side-comment) and related command allows
3472 side comments to be spaced close to preceding character. This is
3473 useful for displaying commented code as side comments.
3475 -New command -csc (--closing-side-comment) and several related
3476 commands allow comments to be added to (and deleted from) any or all
3477 closing block braces. This can be useful if you have to maintain large
3478 programs, especially those that you didn't write. See updated man page.
3479 Thanks to Peter Masiar for this suggestion. For a simple example:
3484 if ( !defined( $_[0] ) ) {
3485 print("Hello, World\n");
3488 print( $_[0], "\n" );
3492 This added '## end sub foo' to the closing brace.
3493 To remove it, perltidy -ncsc.
3495 -New commands -ola, for outdenting labels, and -okw, for outdenting
3496 selected control keywords, were implemented. See the perltidy man
3497 page for details. Thanks to Peter Masiar for this suggestion.
3499 -Hanging side comment change: a comment will not be considered to be a
3500 hanging side comment if there is no leading whitespace on the line.
3501 This should improve the reliability of identifying hanging side comments.
3502 Thanks to Peter Masiar for this suggestion.
3504 -Two new commands for outdenting, -olq (outdent-long-quotes) and -olc
3505 (outdent-long-comments), have been added. The original -oll
3506 (outdent-long-lines) remains, and now is an abbreviation for -olq and -olc.
3507 The new default is just -olq. This was necessary to avoid inconsistency with
3508 the new static block comment option.
3510 -Static block comments: to provide a way to display commented code
3511 better, the convention is used that comments with a leading '##' should
3512 not be formatted as usual. Please see '-sbc' (or '--static-block-comment')
3513 for documentation. It can be deactivated with with -nsbc, but
3514 should not normally be necessary. Thanks to Peter Masiar for this
3517 -Two changes were made to help show structure of complex lists:
3518 (1) breakpoints are forced after every ',' in a list where any of
3519 the list items spans multiple lines, and
3520 (2) List items which span multiple lines now get continuation indentation.
3522 The following example illustrates both of these points. Many thanks to
3523 Wolfgang Weisselberg for this snippet and a discussion of it; this is a
3524 significant formatting improvement. Note how it is easier to see the call
3525 parameters in the NEW version:
3528 assert( __LINE__, ( not defined $check )
3531 or $check eq "old", "Error in parameters",
3532 defined $old_new ? ( ref $old_new ? ref $old_new : $old_new ) : "undef",
3533 defined $db_new ? ( ref $db_new ? ref $db_new : $db_new ) : "undef",
3534 defined $old_db ? ( ref $old_db ? ref $old_db : $old_db ) : "undef" );
3539 ( not defined $check )
3543 "Error in parameters",
3544 defined $old_new ? ( ref $old_new ? ref $old_new : $old_new ) : "undef",
3545 defined $db_new ? ( ref $db_new ? ref $db_new : $db_new ) : "undef",
3546 defined $old_db ? ( ref $old_db ? ref $old_db : $old_db ) : "undef"
3549 Another example shows how this helps displaying lists:
3552 %{ $self->{COMPONENTS} } = (
3554 { type => 'name', adj => 'yes', font => 'Helvetica', 'index' => 0 },
3556 { type => 'road', adj => 'yes', font => 'Helvetica', 'index' => 2 },
3559 The structure is clearer with the added indentation:
3562 %{ $self->{COMPONENTS} } = (
3564 { type => 'name', adj => 'yes', font => 'Helvetica', 'index' => 0 },
3566 { type => 'road', adj => 'yes', font => 'Helvetica', 'index' => 2 },
3569 -The structure of nested logical expressions is now displayed better.
3570 Thanks to Wolfgang Weisselberg for helpful discussions. For example,
3571 note how the status of the final 'or' is displayed in the following:
3575 and null( $op->sibling )
3576 and $op->ppaddr eq "pp_null"
3577 and class($op) eq "UNOP"
3578 and ( ( $op->first->ppaddr =~ /^pp_(and|or)$/
3579 and $op->first->first->sibling->ppaddr eq "pp_lineseq" )
3580 or ( $op->first->ppaddr eq "pp_lineseq"
3581 and not null $op->first->first->sibling
3582 and $op->first->first->sibling->ppaddr eq "pp_unstack" ) ) );
3587 and null( $op->sibling )
3588 and $op->ppaddr eq "pp_null"
3589 and class($op) eq "UNOP"
3592 $op->first->ppaddr =~ /^pp_(and|or)$/
3593 and $op->first->first->sibling->ppaddr eq "pp_lineseq"
3595 or ( $op->first->ppaddr eq "pp_lineseq"
3596 and not null $op->first->first->sibling
3597 and $op->first->first->sibling->ppaddr eq "pp_unstack" )
3601 -A break will always be put before a list item containing a comma-arrow.
3602 This will improve formatting of mixed lists of this form:
3606 'text', 225, 20, -text => 'A Simple Plot',
3614 -text => 'A Simple Plot',
3619 -For convenience, the command -dac (--delete-all-comments) now also
3620 deletes pod. Likewise, -tac (--tee-all-comments) now also sends pod
3621 to a '.TEE' file. Complete control over the treatment of pod and
3622 comments is still possible, as described in the updated help message
3625 -The logic which breaks open 'containers' has been rewritten to be completely
3626 symmetric in the following sense: if a line break is placed after an opening
3627 {, [, or (, then a break will be placed before the corresponding closing
3628 token. Thus, a container either remains closed or is completely cracked
3631 -Improved indentation of parenthesized lists. For example,
3636 atan2( $GPSTempCompLong - $GPSLongitude,
3637 $GPSLatitude - $GPSTempCompLat ) * 180 / 3.14159265 );
3640 $GPSCompCourse = int(
3642 $GPSTempCompLong - $GPSLongitude,
3643 $GPSLatitude - $GPSTempCompLat
3644 ) * 180 / 3.14159265
3647 Further improvements will be made in future releases.
3649 -Some improvements were made in formatting small lists.
3651 -Correspondence between Input and Output line numbers reported in a
3652 .LOG file should now be exact. They were sometimes off due to the size
3653 of intermediate buffers.
3655 -Corrected minor tokenization error in which a ';' in a foreach loop
3656 control was tokenized as a statement termination, which forced a
3669 foreach ( $i = 0 ; $i <= 10 ; $i += 2 ) {
3673 -Corrected a problem with reading config files, in which quote marks were not
3674 stripped. As a result, something like -wba="&& . || " would have the leading
3675 quote attached to the && and not work correctly. A workaround for older
3676 versions is to place a space around all tokens within the quotes, like this:
3679 -Removed any existing space between a label and its ':'
3682 This was necessary because the label and its colon are a single token.
3684 -Corrected tokenization error for the following (highly non-recommended)
3686 $user = @vars[1] / 100;
3688 -Resolved cause of a difference between perltidy under perl v5.6.1 and
3689 5.005_03; the problem was different behavior of \G regex position
3694 -Corrected a bug in which a break was not being made after a full-line
3695 comment within a short eval/sort/map/grep block. A flag was not being
3696 zeroed. The syntax error check catches this. Here is a snippet which
3697 illustrates the bug:
3700 #open Socket to Dispatcher
3701 $sock = &OpenSocket;
3704 The formatter mistakenly thought that it had found the following
3707 eval {#open Socket to Dispatcher$sock = &OpenSocket; };
3709 The patch fixes this. Many thanks to Henry Story for reporting this bug.
3711 -Changes were made to help diagnose and resolve problems in a
3713 (1) processing of command parameters has been into two separate
3714 batches so that any errors in a .perltidyrc file can be localized.
3715 (2) commands --help, --version, and as many of the --dump-xxx
3716 commands are handled immediately, without any command line processing
3718 (3) Perltidy will ignore any commands in the .perltidyrc file which
3719 cause immediate exit. These are: -h -v -ddf -dln -dop -dsn -dtt
3720 -dwls -dwrs -ss. Thanks to Wolfgang Weisselberg for helpful
3721 suggestions regarding these updates.
3723 -Syntax check has been reinstated as default for MSWin32 systems. This
3724 way Windows 2000 users will get syntax check by default, which seems
3725 like a better idea, since the number of Win 95/98 systems will be
3726 decreasing over time. Documentation revised to warn Windows 95/98
3727 users about the problem with empty '&1'. Too bad these systems
3728 all report themselves as MSWin32.
3732 -Fixed tokenization error in which a method call of the form
3736 got a space before the '::' like this:
3740 Thanks to David Holden for reporting this.
3742 -Added -html control over pod text, using a new abbreviation 'pd'. See
3743 updated perl2web man page. The default is to use the color of a comment,
3744 but italicized. Old .css style sheets will need a new line for
3745 .pd to use this. The old color was the color of a string, and there
3748 -.css lines are now printed in sorted order.
3750 -Fixed interpolation problem where html files had '$input_file' as title
3751 instead of actual input file name. Thanks to Simon Perreault for finding
3752 this and sending a patch, and also to Tobias Weber.
3754 -Breaks will now have the ':' placed at the start of a line,
3755 one per line by default because this shows logical structure
3756 more clearly. This coding has been completely redone. Some
3757 examples of new ?/: formatting:
3760 wantarray ? map( $dir::cwd->lookup($_)->path, @_ ) :
3761 $dir::cwd->lookup( $_[0] )->path;
3765 ? map( $dir::cwd->lookup($_)->path, @_ )
3766 : $dir::cwd->lookup( $_[0] )->path;
3772 } : { a => 6, b => 8 };
3780 : { a => 6, b => 8 };
3783 $self->note($self->{skip} ? "Hunk #$self->{hunk} ignored at 1.\n" :
3784 "Hunk #$self->{hunk} failed--$@");
3787 $self->note($self->{skip}
3788 ? "Hunk #$self->{hunk} ignored at 1.\n"
3789 : "Hunk #$self->{hunk} failed--$@");
3793 $opts{"t"} ? 'title' :
3794 $opts{"s"} ? 'subject' : $opts{"a"} ? 'author' : 'title';
3798 $opts{"t"} ? 'title'
3799 : $opts{"s"} ? 'subject'
3800 : $opts{"a"} ? 'author'
3803 You can use -wba=':' to recover the previous default which placed ':'
3804 at the end of a line. Thanks to Michael Cartmell for helpful
3805 discussions and examples.
3807 -Tokenizer updated to do syntax checking for matched ?/: pairs. Also,
3808 the tokenizer now outputs a unique serial number for every balanced
3809 pair of brace types and ?/: pairs. This greatly simplifies the
3812 -Long lines with repeated 'and', 'or', '&&', '||' will now have
3813 one such item per line. For example:
3816 if ( $opt_d || $opt_m || $opt_p || $opt_t || $opt_x
3817 || ( -e $archive && $opt_r ) )
3819 ( $pAr, $pNames ) = readAr($archive);
3828 || ( -e $archive && $opt_r ) )
3830 ( $pAr, $pNames ) = readAr($archive);
3834 if ( $vp->{X0} + 4 <= $x && $vp->{X0} + $vp->{W} - 4 >= $x
3835 && $vp->{Y0} + 4 <= $y && $vp->{Y0} + $vp->{H} - 4 >= $y )
3838 if ( $vp->{X0} + 4 <= $x
3839 && $vp->{X0} + $vp->{W} - 4 >= $x
3840 && $vp->{Y0} + 4 <= $y
3841 && $vp->{Y0} + $vp->{H} - 4 >= $y )
3843 -Long lines with multiple concatenated tokens will have concatenated
3844 terms (see below) placed one per line, except for short items. For
3849 "Device type:" . $ib->family . " ID:" . $ib->serial . " CRC:"
3850 . $ib->crc . ": " . $ib->model() . "\n";
3853 $report .= "Device type:"
3854 . $ib->family . " ID:"
3855 . $ib->serial . " CRC:"
3857 . $ib->crc . ": " . "\n";
3859 NOTE: at present 'short' means 8 characters or less. There is a
3860 tentative flag to change this (-scl), but it is undocumented and
3861 is likely to be changed or removed later, so only use it for testing.
3862 In the above example, the tokens " ID:", " CRC:", and "\n" are below
3865 -If a line which is short enough to fit on a single line was
3866 nevertheless broken in the input file at a 'good' location (see below),
3867 perltidy will try to retain a break. For example, the following line
3868 will be formatted as:
3871 or die "Cannot open $file ($!)";
3873 if it was broken in the input file, and like this if not:
3875 open SUM, "<$file" or die "Cannot open $file ($!)";
3877 GOOD: 'good' location means before 'and','or','if','unless','&&','||'
3879 The reason perltidy does not just always break at these points is that if
3880 there are multiple, similar statements, this would preclude alignment. So
3881 rather than check for this, perltidy just tries to follow the input style,
3882 in the hopes that the author made a good choice. Here is an example where
3883 we might not want to break before each 'if':
3885 ($Locale, @Locale) = ($English, @English) if (@English > @Locale);
3886 ($Locale, @Locale) = ($German, @German) if (@German > @Locale);
3887 ($Locale, @Locale) = ($French, @French) if (@French > @Locale);
3888 ($Locale, @Locale) = ($Spanish, @Spanish) if (@Spanish > @Locale);
3890 -Added wildcard file expansion for systems with shells which lack this.
3891 Now 'perltidy *.pl' should work under MSDOS/Windows. Thanks to Hugh Myers
3892 for suggesting this. This uses builtin glob() for now; I may change that.
3894 -Added new flag -sbl which, if specified, overrides the value of -bl
3895 for opening sub braces. This allows formatting of this type:
3901 if (!defined($_[0])) {
3902 print("Hello, World\n");
3908 Requested by Don Alexander.
3910 -Fixed minor parsing error which prevented a space after a $$ variable
3911 (pid) in some cases. Thanks to Michael Cartmell for noting this.
3916 -Improved line break choices 'and' and 'or' to display logic better.
3920 exists $self->{'build_dir'} and push @e,
3921 "Unwrapped into directory $self->{'build_dir'}";
3924 exists $self->{'build_dir'}
3925 and push @e, "Unwrapped into directory $self->{'build_dir'}";
3927 -Fixed error of multiple use of abbreviatioin '-dsc'. -dsc remains
3928 abbreviation for delete-side-comments; -dsm is new abbreviation for
3931 -Corrected and updated 'usage' help routine. Thanks to Slaven Rezic for
3934 -The default for Windows is, for now, not to do a 'perl -c' syntax
3935 check (but -syn will activate it). This is because of problems with
3936 command.com. James Freeman sent me a patch which tries to get around
3937 the problems, and it works in many cases, but testing revealed several
3938 issues that still need to be resolved. So for now, the default is no
3939 syntax check for Windows.
3941 -I added a -T flag when doing perl -c syntax check.
3942 This is because I test it on a large number of scripts from sources
3943 unknown, and who knows what might be hidden in initialization blocks?
3944 Also, deactivated the syntax check if perltidy is run as root. As a
3945 benign example, running the previous version of perltidy on the
3946 following file would cause it to disappear:
3949 print "Bye, bye baby!\n";
3953 The new version will not let that happen.
3955 -I am contemplating (but have not yet implemented) making '-lp' the
3956 default indentation, because it is stable now and may be closer to how
3957 perl is commonly formatted. This could be in the next release. The
3958 reason that '-lp' was not the original default is that the coding for
3959 it was complex and not ready for the initial release of perltidy. If
3960 anyone has any strong feelings about this, I'd like to hear. The
3961 current default could always be recovered with the '-nlp' flag.
3966 - sub definition names are now specially colored, red by default.
3967 The letter 'm' is used to identify them.
3968 - keyword 'sub' now has color of other keywords.
3969 - restored html keyword color to __END__ and __DATA__, which was
3970 accidentally removed in the previous version.
3972 -A new -se (--standard-error-output) flag has been implemented and
3973 documented which causes all errors to be written to standard output
3974 instead of a .ERR file.
3976 -A new -w (--warning-output) flag has been implemented and documented
3977 which causes perltidy to output certain non-critical messages to the
3978 error output file, .ERR. These include complaints about pod usage,
3979 for example. The default is to not include these.
3981 NOTE: This replaces an undocumented -w=0 or --warning-level flag
3982 which was tentatively introduced in the previous version to avoid some
3983 unwanted messages. The new default is the same as the old -w=0, so
3984 that is no longer needed.
3986 -Improved syntax checking and corrected tokenization of functions such
3987 as rand, srand, sqrt, ... These can accept either an operator or a term
3988 to their right. This has been corrected.
3990 -Corrected tokenization of semicolon: testing of the previous update showed
3991 that the semicolon in the following statement was being mis-tokenized. That
3992 did no harm, other than adding an extra blank space, but has been corrected.
3994 for (sort {strcoll($a,$b);} keys %investments) {
3998 -New syntax check: after wasting 5 minutes trying to resolve a syntax
3999 error in which I had an extra terminal ';' in a complex for (;;) statement,
4000 I spent a few more minutes adding a check for this in perltidy so it won't
4003 -The behavior of --break-before-subs (-bbs) and --break-before-blocks
4004 (-bbb) has been modified. Also, a new control parameter,
4005 --long-block-line-count=n (-lbl=n) has been introduced to give more
4006 control on -bbb. This was previously a hardwired value. The reason
4007 for the change is to reduce the number of unwanted blank lines that
4008 perltidy introduces, and make it less erratic. It's annoying to remove
4009 an unwanted blank line and have perltidy put it back. The goal is to
4010 be able to sprinkle a few blank lines in that dense script you
4011 inherited from Bubba. I did a lot of experimenting with different
4012 schemes for introducing blank lines before and after code blocks, and
4013 decided that there is no really good way to do it. But I think the new
4014 scheme is an improvement. You can always deactivate this with -nbbb.
4015 I've been meaning to work on this; thanks to Erik Thaysen for bringing
4018 -The .LOG file is seldom needed, and I get tired of deleting them, so
4019 they will now only be automatically saved if perltidy thinks that it
4020 made an error, which is almost never. You can still force the logfile
4021 to be saved with -log or -g.
4023 -Improved method for computing number of columns in a table. The old
4024 method always tried for an even number. The new method allows odd
4025 numbers when it is obvious that a list is not a hash initialization
4029 $name, $xsargs, $parobjs, $optypes,
4030 $hasp2child, $pmcode, $hdrcode, $inplacecode,
4031 $globalnew, $callcopy
4036 $name, $xsargs, $parobjs, $optypes, $hasp2child,
4037 $pmcode, $hdrcode, $inplacecode, $globalnew, $callcopy
4041 -I fiddled with the list threshold adjustment, and some small lists
4042 look better now. Here is the change for one of the lists in test file
4046 ("in", "in", "pt", "pt", "pc", "pi", "mm", "mm", "cm", "cm", "\\hsize", "%",
4047 "\\vsize", "%", "\\textwidth", "%", "\\textheight", "%");
4051 "in", "in", "pt", "pt", "pc", "pi",
4052 "mm", "mm", "cm", "cm", "\\hsize", "%",
4053 "\\vsize", "%", "\\textwidth", "%", "\\textheight", "%"
4056 -Improved -lp formatting at '=' sign. A break was always being added after
4057 the '=' sign in a statement such as this, (to be sure there was enough room
4058 for the parameters):
4063 $biblionumber, $constraint,
4067 The updated version doesn't do this unless the space is really needed:
4069 new: my $fee = CalcReserveFee(
4071 $biblionumber, $constraint,
4075 -I updated the tokenizer to allow $#+ and $#-, which seem to be new to
4076 Perl 5.6. Some experimenting with a recent version of Perl indicated
4077 that it allows these non-alphanumeric '$#' array maximum index
4078 variables: $#: $#- $#+ so I updated the parser accordingly. Only $#:
4079 seems to be valid in older versions of Perl.
4081 -Fixed a rare formatting problem with -lp (and -gnu) which caused
4082 excessive indentation.
4084 -Many additional syntax checks have been added.
4086 -Revised method for testing here-doc target strings; the following
4087 was causing trouble with a regex test because of the '*' characters:
4091 Perl seems to allow almost anything to be a here doc target, so an
4092 exact string comparison is now used.
4094 -Made update to allow underscores in binary numbers, like '0b1100_0000'.
4096 -Corrected problem with scanning certain module names; a blank space was
4097 being inserted after 'warnings' in the following:
4098 use warnings::register;
4099 The problem was that warnings (and a couple of other key modules) were
4100 being tokenized as keywords. They should have just been identifiers.
4102 -Corrected tokenization of indirect objects after sort, system, and exec,
4103 after testing produced an incorrect error message for the following
4105 print sort $sortsubref @list;
4107 -Corrected minor problem where a line after a format had unwanted
4108 extra continuation indentation.
4110 -Delete-block-comments (and -dac) now retain any leading hash-bang line
4112 -Update for -lp (and -gnu) to not align the leading '=' of a list
4113 with a previous '=', since this interferes with alignment of parameters.
4115 old: my $hireDay = new Date;
4122 new: my $hireDay = new Date;
4129 -Modifications made to display tables more compactly when possible,
4130 without adding lines. For example,
4132 '1', "I", '2', "II", '3', "III", '4', "IV",
4133 '5', "V", '6', "VI", '7', "VII", '8', "VIII",
4136 '1', "I", '2', "II", '3', "III",
4137 '4', "IV", '5', "V", '6', "VI",
4138 '7', "VII", '8', "VIII", '9', "IX"
4140 -Corrected minor bug in which -pt=2 did not keep the right paren tight
4141 around a '++' or '--' token, like this:
4143 for ($i = 0 ; $i < length $key ; $i++ )
4145 The formatting for this should be, and now is:
4147 for ($i = 0 ; $i < length $key ; $i++)
4149 Thanks to Erik Thaysen for noting this.
4151 -Discovered a new bug involving here-docs during testing! See BUGS.html.
4153 -Finally fixed parsing of subroutine attributes (A Perl 5.6 feature).
4154 However, the attributes and prototypes must still be on the same line
4159 -Corrected minor, uncommon bug found during routine testing, in which a
4160 blank got inserted between a function name and its opening paren after
4161 a file test operator, but only in the case that the function had not
4162 been previously seen. Perl uses the existence (or lack thereof) of
4163 the blank to guess if it is a function call. That is,
4164 if (-l pid_filename()) {
4166 if (-l pid_filename ()) {
4167 which is a syntax error if pid_filename has not been seen by perl.
4169 -If the AutoLoader module is used, perltidy will continue formatting
4170 code after seeing an __END__ line. Use -nlal to deactivate this feature.
4171 Likewise, if the SelfLoader module is used, perltidy will continue
4172 formatting code after seeing a __DATA__ line. Use -nlsl to
4173 deactivate this feature. Thanks to Slaven Rezic for this suggestion.
4175 -pod text after __END__ and __DATA__ is now identified by perltidy
4176 so that -dp works correctly. Thanks to Slaven Rezic for this suggestion.
4178 -The first $VERSION line which might be eval'd by MakeMaker
4179 is now passed through unchanged. Use -npvl to deactivate this feature.
4180 Thanks to Manfred Winter for this suggestion.
4182 -Improved indentation of nested parenthesized expressions. Tests have
4183 given favorable results. Thanks to Wolfgang Weisselberg for helpful
4188 -Fixed a very rare problem in which an unwanted semicolon was inserted
4189 due to misidentification of anonymous hash reference curly as a code
4190 block curly. (No instances of this have been reported; I discovered it
4191 during testing). A workaround for older versions of perltidy is to use
4194 -Added -icb (-indent-closing-brace) parameter to indent a brace which
4195 terminates a code block to the same level as the previous line.
4196 Suggested by Andrew Cutler. For example,
4205 -Rewrote error message triggered by an unknown bareword in a print or
4206 printf filehandle position, and added flag -w=0 to prevent issuing this
4207 error message. Suggested by Byron Jones.
4209 -Added modification to align a one-line 'if' block with similar
4210 following 'elsif' one-line blocks, like this:
4211 if ( $something eq "simple" ) { &handle_simple }
4212 elsif ( $something eq "hard" ) { &handle_hard }
4213 (Suggested by Wolfgang Weisselberg).
4217 -Eliminated all constants with leading underscores because perl 5.005_03
4218 does not support that. For example, _SPACES changed to XX_SPACES.
4219 Thanks to kromJx for this update.
4223 -the directory of test files has been moved to a separate distribution
4224 file because it is getting large but is of little interest to most users.
4225 For the current distribution:
4226 perltidy-20010701.tgz contains the source and docs for perltidy
4227 perltidy-20010701-test.tgz contains the test files
4229 -fixed bug where temporary file perltidy.TMPI was not being deleted
4230 when input was from stdin.
4232 -adjusted line break logic to not break after closing brace of an
4233 eval block (suggested by Boris Zentner).
4235 -added flag -gnu (--gnu-style) to give an approximation to the GNU
4236 style as sometimes applied to perl. The programming style in GNU
4237 'automake' was used as a guide in setting the parameters; these
4238 parameters will probably be adjusted over time.
4240 -an empty code block now has one space for emphasis:
4241 if ( $cmd eq "bg_untested" ) {} # old
4242 if ( $cmd eq "bg_untested" ) { } # new
4243 If this bothers anyone, we could create a parameter.
4245 -the -bt (--brace-tightness) parameter has been split into two
4246 parameters to give more control. -bt now applies only to non-BLOCK
4247 braces, while a new parameter -bbt (block-brace-tightness) applies to
4248 curly braces which contain code BLOCKS. The default value is -bbt=0.
4250 -added flag -icp (--indent-closing-paren) which leaves a statement
4251 termination of the form );, };, or ]; indented with the same
4252 indentation as the previous line. For example,
4254 @month_of_year = ( # default, or -nicp
4255 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
4259 @month_of_year = ( # -icp
4260 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
4264 -Vertical alignment updated to synchronize with tokens &&, ||,
4265 and, or, if, unless. Allowable space before forcing
4266 resynchronization has been increased. (Suggested by Wolfgang
4269 -html corrected to use -nohtml-bold-xxxxxxx or -nhbx to negate bold,
4270 and likewise -nohtml-italic-xxxxxxx or -nhbi to negate italic. There
4271 was no way to negate these previously. html documentation updated and
4272 corrected. (Suggested by Wolfgang Weisselberg).
4274 -Some modifications have been made which improve the -lp formatting in
4277 -Perltidy now retains or creates a blank line after an =cut to keep
4278 podchecker happy (Suggested by Manfred H. Winter). This appears to be
4279 a glitch in podchecker, but it was annoying.
4283 -Added -bli flag to give continuation indentation to braces, like this
4287 extra_indentation();
4290 -Corrected an error with the tab (-t) option which caused the last line
4291 of a multi-line quote to receive a leading tab. This error was in
4292 version 2001 06 08 but not 2001 04 06. If you formatted a script
4293 with -t with this version, please check it by running once with the
4294 -chk flag and perltidy will scan for this possible error.
4296 -Corrected an invalid pattern (\R should have been just R), changed
4297 $^W =1 to BEGIN {$^W=1} to use warnings in compile phase, and corrected
4298 several unnecessary 'my' declarations. Many thanks to Wolfgang Weisselberg,
4299 2001-06-12, for catching these errors.
4301 -A '-bar' flag has been added to require braces to always be on the
4302 right, even for multi-line if and foreach statements. For example,
4303 the default formatting of a long if statement would be:
4305 if ($bigwasteofspace1 && $bigwasteofspace2
4306 || $bigwasteofspace3 && $bigwasteofspace4)
4311 With -bar, the formatting is:
4313 if ($bigwasteofspace1 && $bigwasteofspace2
4314 || $bigwasteofspace3 && $bigwasteofspace4) {
4317 Suggested by Eli Fidler 2001-06-11.
4319 -Uploaded perltidy to sourceforge cvs 2001-06-10.
4321 -An '-lp' flag (--line-up-parentheses) has been added which causes lists
4322 to be indented with extra indentation in the manner sometimes
4323 associated with emacs or the GNU suggestions. Thanks to Ian Stuart for
4324 this suggestion and for extensive help in testing it.
4326 -Subroutine call parameter lists are now formatted as other lists.
4327 This should improve formatting of tables being passed via subroutine
4328 calls. This will also cause full indentation ('-i=n, default n= 4) of
4329 continued parameter list lines rather than just the number of spaces
4330 given with -ci=n, default n=2.
4332 -Added support for hanging side comments. Perltidy identifies a hanging
4333 side comment as a comment immediately following a line with a side
4334 comment or another hanging side comment. This should work in most
4335 cases. It can be deactivated with --no-hanging-side-comments (-nhsc).
4336 The manual has been updated to discuss this. Suggested by Brad
4337 Eisenberg some time ago, and finally implemented.
4341 -fixed problem with parsing command parameters containing quoted
4342 strings in .perltidyrc files. (Reported by Roger Espel Llima 2001-06-07).
4344 -added two command line flags, --want-break-after and
4345 --want-break-before, which allow changing whether perltidy
4346 breaks lines before or after any operators. Please see the revised
4347 man pages for details.
4349 -added system-wide configuration file capability.
4350 If perltidy does not find a .perltidyrc command line file in
4351 the current directory, nor in the home directory, it now looks
4352 for '/usr/local/etc/perltidyrc' and then for '/etc/perltidyrc'.
4353 (Suggested by Roger Espel Llima 2001-05-31).
4355 -fixed problem in which spaces were trimmed from lines of a multi-line
4356 quote. (Reported by Roger Espel Llima 2001-05-30). This is an
4357 uncommon situation, but serious, because it could conceivably change
4358 the proper function of a script.
4360 -fixed problem in which a semicolon was incorrectly added within
4361 an anonymous hash. (Reported by A.C. Yardley, 2001-5-23).
4362 (You would know if this happened, because perl would give a syntax
4363 error for the resulting script).
4365 -fixed problem in which an incorrect error message was produced
4366 after a version number on a 'use' line, like this ( Reported
4367 by Andres Kroonmaa, 2001-5-14):
4369 use CGI 2.42 qw(fatalsToBrowser);
4371 Other than the extraneous error message, this bug was harmless.
4375 -fixed serious bug in which the last line of some multi-line quotes or
4376 patterns was given continuation indentation spaces. This may make
4377 a pattern incorrect unless it uses the /x modifier. To find
4378 instances of this error in scripts which have been formatted with
4379 earlier versions of perltidy, run with the -chk flag, which has
4380 been added for this purpose (SLH, 2001-04-05).
4382 ** So, please check previously formatted scripts by running with -chk
4385 -continuation indentation has been reprogrammed to be hierarchical,
4386 which improves deeply nested structures.
4388 -fixed problem with undefined value in list formatting (reported by Michael
4391 -Switched to graphical display of nesting in .LOG files. If an
4392 old format string was "(1 [0 {2", the new string is "{{(". This
4393 is easier to read and also shows the order of nesting.
4395 -added outdenting of cuddled paren structures, like ")->pack(".
4397 -added line break and outdenting of ')->' so that instead of
4400 -text => "perltidy",
4401 -relief => 'ridge')->pack;
4403 the current default is:
4406 -text => "perltidy",
4410 (requested by Michael Langner 2001-03-31; in the future this could
4411 be controlled by a command-line parameter).
4413 -revised list indentation logic, so that lists following an assignment
4414 operator get one full indentation level, rather than just continuation
4415 indentation. Also corrected some minor glitches in the continuation
4418 -Fixed problem with unwanted continuation indentation after a blank line
4419 (reported by Erik Thaysen 2001-03-28):
4421 -minor update to avoid stranding a single '(' on one line
4425 -corrected serious error tokenizing filehandles, in which a sub call
4426 after a print or printf, like this:
4427 print usage() and exit;
4429 print usage () and exit;
4430 Unfortunately, this converts 'usage' to a filehandle. To fix this, rerun
4431 perltidy; it will look for this situation and issue a warning.
4433 -fixed another cuddled-else formatting bug (Reported by Craig Bourne)
4435 -added several diagnostic --dump routines
4437 -added token-level whitespace controls (suggested by Hans Ecke)
4441 -added support for special variables of the form ${^WANT_BITS}
4443 -space added between scalar and left paren in 'for' and 'foreach' loops,
4444 (suggestion by Michael Cartmell):
4446 for $i( 1 .. 20 ) # old
4447 for $i ( 1 .. 20 ) # new
4449 -html now outputs cascading style sheets (thanks to suggestion from
4452 -flags -o and -st now work with -html
4454 -added missing -html documentation for comments (noted by Alex Izvorski)
4456 -support for VMS added (thanks to Michael Cartmell for code patches and
4459 -v-strings implemented (noted by Hans Ecke and Michael Cartmell; extensive
4460 testing by Michael Cartmell)
4462 -fixed problem where operand may be empty at line 3970
4463 (\b should be just b in lines 3970, 3973) (Thanks to Erik Thaysen,
4464 Keith Marshall for bug reports)
4466 -fixed -ce bug (cuddled else), where lines like '} else {' were indented
4467 (Thanks to Shawn Stepper and Rick Measham for reporting this)
4471 -fixed undefined value in line 153 (only worked with -I set)
4472 (Thanks to Mike Stok, Phantom of the Opcodes, Ian Ehrenwald, and others)
4474 -fixed undefined value in line 1069 (filehandle problem with perl versions <
4475 5.6) (Thanks to Yuri Leikind, Mike Stok, Michael Holve, Jeff Kolber)
4479 -Initial announcement at freshmeat.net; started Change Log
4480 (Unfortunately this version was DOA, but it was fixed the next day)