3 - Corrected problem introduced by using a chomp on scalar references, RT #77978
5 - Added support for Perl 5.14 package block syntax, RT #78114.
7 - A convergence test is made if three or more iterations are requested with
8 the -it=n parameter to avoid wasting computer time. Several hundred Mb of
9 code gleaned from the internet were searched with the results that:
10 - It is unusual for two iterations to be required unless a major
11 style change is being made.
12 - Only one case has been found where three iterations were required.
13 - No cases requiring four iterations have been found with this version.
14 For the previous version several cases where found the results could
15 oscillate between two semi-stable states. This version corrects this.
17 So if it is important that the code be converged it is okay to set -it=4
18 with this version and it will probably stop after the second iteration.
20 - Improved ability to identify and retain good line break points in the
21 input stream, such as at commas and equals. You can always tell
22 perltidy to ignore old breakpoints with -iob.
24 - Fixed glitch in which a terminal closing hash brace followed by semicolon
25 was not outdented back to the leading line depth like other closing
26 tokens. Thanks to Keith Neargarder for noting this.
29 my ( $pre, $post ) = @{
31 "pp_anonlist" => [ "[", "]" ],
32 "pp_anonhash" => [ "{", "}" ]
37 my ( $pre, $post ) = @{
39 "pp_anonlist" => [ "[", "]" ],
40 "pp_anonhash" => [ "{", "}" ]
44 - Removed extra indentation given to trailing 'if' and 'unless' clauses
45 without parentheses because this occasionally produced undesirable
46 results. This only applies where parens are not used after the if or
51 unless my ( $who, $actions ) =
52 $clause =~ /^($who_re)((?:$action_re)+)$/o;
56 unless my ( $who, $actions ) =
57 $clause =~ /^($who_re)((?:$action_re)+)$/o;
60 - Updated perltidy to handle all quote modifiers defined for perl 5 version 16.
62 - Side comment text in perltidyrc configuration files must now begin with
63 at least one space before the #. Thus:
66 -l=78 # Max line width is 78 cols
68 -l=78# Max line width is 78 cols
70 This is probably true of almost all existing perltidyrc files,
71 but if you get an error message about bad parameters
72 involving a '#' the first time you run this version, please check the side
73 comments in your perltidyrc file, and add a space before the # if necessary.
74 You can quickly see the contents your perltidyrc file, if any, with the
79 The reason for this change is that some parameters naturally involve
80 the # symbol, and this can get interpreted as a side comment unless the
81 parameter is quoted. For example, to define -sphb=# it used to be necessary
84 to keep the # from becomming part of a comment. This was causing
85 trouble for new users. Now it can also be written without quotes:
88 - Fixed bug in processing some .perltidyrc files containing parameters with
89 an opening brace character, '{'. For example the following was
90 incorrectly processed:
91 --static-block-comment-prefix="^#{2,}[^\s#]"
94 - Added flag -boa (--break-at-old-attribute-breakpoints) which retains
95 any existing line breaks at attribute separation ':'. This is now the
96 default, use -nboa to deactivate. Thanks to Daphne Phister for the patch.
97 For example, given the following code, the line breaks at the ':'s will be
103 : Get('Name' => 'foo') : Set('Name');
105 whereas the previous version would have output a single line. If
106 the attributes are on a single line then they will remain on a single line.
108 - Added new flags --blank-lines-before-subs=n (-blbs=n) and
109 --blank-lines-before-packages=n (-blbp=n) to put n blank lines before
110 subs and packages. The old flag -bbs is now equivalent to -blbs=1 -blbp=1.
111 and -nbbs is equivalent to -blbs=0 -blbp=0. Requested by M. Schwern and
114 - Added feature -nsak='*' meaning no space between any keyword and opening
115 paren. This avoids listing entering a long list of keywords. Requested
118 - Added option to delete a backup of original file with in-place-modify (-b)
119 if there were no errors. This can be requested with the flag -bext='/'.
120 See documentation for details. Requested by M. Schwern and others.
122 - Fixed bug where the module postfilter parameter was not applied when -b
123 flag was used. This was discovered during testing.
125 - Fixed in-place-modify (-b) to work with symbolic links to source files.
126 Thanks to Ted Johnson.
128 - Fixed bug where the Perl::Tidy module did not allow -b to be used
131 - No extra blank line is added before a comment which follows
132 a short line ending in an opening token, for example like this:
136 # unless we follow a blank or comment line
137 $last_line_leading_type !~ /^[#b]$/
142 # unless we follow a blank or comment line
143 $last_line_leading_type !~ /^[#b]$/
146 The blank is not needed for readability in these cases because there
147 already is already space above the comment. If a blank already
148 exists there it will not be removed, so this change should not
149 change code which has previously been formatted with perltidy.
150 Thanks to R.W.Stauner.
152 - Likewise, no extra blank line is added above a comment consisting of a
153 single #, since nothing is gained in readability.
155 - Fixed error in which a blank line was removed after a #>>> directive.
156 Thanks to Ricky Morse.
158 - Unnecessary semicolons after given/when/default blocks are now removed.
160 - Fixed bug where an unwanted blank line could be added before
161 pod text in __DATA__ or __END__ section. Thanks to jidani.
163 - Changed exit flags from 1 to 0 to indicate success for -help, -version,
164 and all -dump commands. Also added -? as another way to dump the help.
165 Requested by Keith Neargarder.
167 - Fixed bug where .ERR and .LOG files were not written except for -it=2 or more
169 - Fixed bug where trailing blank lines at the end of a file were dropped when
172 - Fixed bug where a line occasionally ended with an extra space. This reduces
173 rhe number of instances where a second iteration gives a result different
176 - Updated documentation to note that the Tidy.pm module <stderr> parameter may
177 not be a reference to SCALAR or ARRAY; it must be a file.
179 - Syntax check with perl now work when the Tidy.pm module is processing
180 references to arrays and strings. Thanks to Charles Alderman.
182 - Zero-length files are no longer processed due to concerns for data loss
183 due to side effects in some scenarios.
185 - block labels, if any, are now included in closing side comment text
186 when the -csc flag is used. Suggested by Aaron. For example,
187 the label L102 in the following block is now included in the -csc text:
189 L102: for my $i ( 1 .. 10 ) {
191 } ## end L102: for my $i ( 1 .. 10 )
194 - added new flag -it=n or --iterations=n
195 This flag causes perltidy to do n complete iterations.
196 For most purposes the default of n=1 should be satisfactory. However n=2
197 can be useful when a major style change is being made, or when code is being
198 beautified on check-in to a source code control system. The run time will be
199 approximately proportional to n, and it should seldom be necessary to use a
200 value greater than n=2. Thanks to Jonathan Swartz
202 - A configuration file pathname begins with three dots, e.g.
203 ".../.perltidyrc", indicates that the file should be searched for starting
204 in the current directory and working upwards. This makes it easier to have
205 multiple projects each with their own .perltidyrc in their root directories.
206 Thanks to Jonathan Swartz for this patch.
208 - Added flag --notidy which disables all formatting and causes the input to be
209 copied unchanged. This can be useful in conjunction with hierarchical
210 F<.perltidyrc> files to prevent unwanted tidying.
211 Thanks to Jonathan Swartz for this patch.
213 - Added prefilters and postfilters in the call to the Tidy.pm module.
214 Prefilters and postfilters. The prefilter is a code reference that
215 will be applied to the source before tidying, and the postfilter
216 is a code reference to the result before outputting.
218 Thanks to Jonathan Swartz for this patch. He writes:
219 This is useful for all manner of customizations. For example, I use
220 it to convert the 'method' keyword to 'sub' so that perltidy will work for
221 Method::Signature::Simple code:
223 Perl::Tidy::perltidy(
224 prefilter => sub { $_ = $_[0]; s/^method (.*)/sub $1 \#__METHOD/gm; return $_ },
225 postfilter => sub { $_ = $_[0]; s/^sub (.*?)\s* \#__METHOD/method $1/gm; return $_ }
228 - The starting indentation level of sections of code entabbed with -et=n
229 is correctly guessed if it was also produced with the same -et=n flag. This
230 keeps the indentation stable on repeated formatting passes within an editor.
231 Thanks to Sam Kington and Glenn.
233 - Functions with prototype '&' had a space between the function and opening
234 peren. This space now only occurs if the flag --space-function-paren (-sfp)
235 is set. Thanks to Zrajm Akfohg.
237 - Patch to never put spaces around a bare word in braces beginning with ^ as in:
238 my $before = ${^PREMATCH};
239 even if requested with the -bt=0 flag because any spaces cause a syntax error in perl.
240 Thanks to Fabrice Dulanoy.
243 - Allow configuration file to be 'perltidy.ini' for Windows systems.
244 i.e. C:\Documents and Settings\User\perltidy.ini
245 and added documentation for setting configuation file under Windows in man
246 page. Thanks to Stuart Clark.
248 - Corrected problem of unwanted semicolons in hash ref within given/when code.
249 Thanks to Nelo Onyiah.
251 - added new flag -cscb or --closing-side-comments-balanced
252 When using closing-side-comments, and the closing-side-comment-maximum-text
253 limit is exceeded, then the comment text must be truncated. Previous
254 versions of perltidy terminate with three dots, and this can still be
255 achieved with -ncscb:
259 } ## end foreach my $foo (sort { $b cmp $a ...
261 However this causes a problem with older editors which cannot recognize
262 comments or are not configured to doso because they cannot "bounce" around in
263 the text correctly. The B<-cscb> flag tries to help them by
264 appending appropriate terminal balancing structure:
268 } ## end foreach my $foo (sort { $b cmp $a ... })
270 Since there is much to be gained and little to be lost by doing this,
271 the default is B<-cscb>. Use B<-ncscb> if you do not want this.
273 Thanks to Daniel Becker for suggesting this option.
275 - After an isolated closing eval block the continuation indentation will be
276 removed so that the braces line up more like other blocks. Thanks to Yves Orton.
295 -A new flag -asbl (or --opening-anonymous-sub-brace-on-new-line) has
296 been added to put the opening brace of anonymous sub's on a new line,
297 as in the following snippet:
305 This was not possible before because the -sbl flag only applies to named
306 subs. Thanks to Benjamin Krupp.
308 -Fix tokenization bug with the following snippet
309 print 'hi' if { x => 1, }->{x};
310 which resulted in a semicolon being added after the comma. The workaround
311 was to use -nasc, but this is no longer necessary. Thanks to Brian Duggan.
313 -Fixed problem in which an incorrect error message could be triggered
314 by the (unusual) combination of parameters -lp -i=0 -l=2 -ci=0 for
315 example. Thanks to Richard Jelinek.
317 -A new flag --keep-old-blank-lines=n has been added to
318 give more control over the treatment of old blank lines in
319 a script. The manual has been revised to discuss the new
320 flag and clarify the treatment of old blank lines. Thanks
324 -Improved support for perl 5.10: New quote modifier 'p', new block type UNITCHECK,
325 new keyword break, improved formatting of given/when.
327 -Corrected tokenization bug of something like $var{-q}.
329 -Numerous minor formatting improvements.
331 -Corrected list of operators controlled by -baao -bbao to include
332 . : ? && || and or err xor
334 -Corrected very minor error in log file involving incorrect comment
335 regarding need for upper case of labels.
337 -Fixed problem where perltidy could run for a very long time
338 when given certain non-perl text files.
340 -Line breaks in un-parenthesized lists now try to follow
341 line breaks in the input file rather than trying to fill
342 lines. This usually works better, but if this causes
343 trouble you can use -iob to ignore any old line breaks.
344 Example for the following input snippet:
347 "conformability (Not the same dimension)\n",
348 "\t", $have, " is ", text_unit($hu), "\n",
349 "\t", $want, " is ", text_unit($wu), "\n",
353 print "conformability (Not the same dimension)\n", "\t", $have, " is ",
354 text_unit($hu), "\n", "\t", $want, " is ", text_unit($wu), "\n",;
357 print "conformability (Not the same dimension)\n",
358 "\t", $have, " is ", text_unit($hu), "\n",
359 "\t", $want, " is ", text_unit($wu), "\n",
363 -Added -fpsc option (--fixed-position-side-comment). Thanks to Ueli Hugenschmidt.
364 For example -fpsc=40 tells perltidy to put side comments in column 40
367 -Added -bbao and -baao options (--break-before-all-operators and
368 --break-after-all-operators) to simplify command lines and configuration
369 files. These define an initial preference for breaking at operators which can
370 be modified with -wba and -wbb flags. For example to break before all operators
371 except an = one could use --bbao -wba='=' rather than listing every
372 single perl operator (except =) on a -wbb flag.
374 -Added -kis option (--keep-interior-semicolons). Use the B<-kis> flag
375 to prevent breaking at a semicolon if there was no break there in the
376 input file. To illustrate, consider the following input lines:
378 dbmclose(%verb_delim); undef %verb_delim;
379 dbmclose(%expanded); undef %expanded;
380 dbmclose(%global); undef %global;
382 Normally these would be broken into six lines, but
385 dbmclose(%verb_delim); undef %verb_delim;
386 dbmclose(%expanded); undef %expanded;
387 dbmclose(%global); undef %global;
389 -Improved formatting of complex ternary statements, with indentation
390 of nested statements.
392 return defined( $cw->{Selected} )
394 ? @{ $cw->{Selected} }
399 return defined( $cw->{Selected} )
401 ? @{ $cw->{Selected} }
405 -Text following un-parenthesized if/unless/while/until statements get a
406 full level of indentation. Suggested by Jeff Armstorng and others.
408 return $ship->chargeWeapons("phaser-canon")
409 if $encounter->description eq 'klingon'
410 and $ship->firepower >= $encounter->firepower
411 and $location->status ne 'neutral';
413 return $ship->chargeWeapons("phaser-canon")
414 if $encounter->description eq 'klingon'
415 and $ship->firepower >= $encounter->firepower
416 and $location->status ne 'neutral';
419 -Fixed bug where #line directives were being indented. Thanks to
423 -Fixed problem where an extra blank line was added after an =cut when either
424 (a) the =cut started (not stopped) a POD section, or (b) -mbl > 1.
425 Thanks to J. Robert Ray and Bill Moseley.
428 -ole (--output-line-ending) and -ple (--preserve-line-endings) should
429 now work on all systems rather than just unix systems. Thanks to Dan
432 -Fixed problem of a warning issued for multiple subs for BEGIN subs
433 and other control subs. Thanks to Heiko Eissfeldt.
435 -Fixed problem where no space was introduced between a keyword or
436 bareword and a colon, such as:
438 ( ref($result) eq 'HASH' && !%$result ) ? undef: $result;
442 -Added a utility program 'break_long_quotes.pl' to the examples directory of
443 the distribution. It breaks long quoted strings into a chain of concatenated
444 sub strings no longer than a selected length. Suggested by Michael Renner as
445 a perltidy feature but was judged to be best done in a separate program.
447 -Updated docs to remove extra < and >= from list of tokens
448 after which breaks are made by default. Thanks to Bob Kleemann.
450 -Removed improper uses of $_ to avoid conflicts with external calls, giving
451 error message similar to:
452 Modification of a read-only value attempted at
453 /usr/share/perl5/Perl/Tidy.pm line 6907.
454 Thanks to Michael Renner.
456 -Fixed problem when errorfile was not a plain filename or filehandle
457 in a call to Tidy.pm. The call
458 perltidy(source => \$input, destination => \$output, errorfile => \$err);
459 gave the following error message:
460 Not a GLOB reference at /usr/share/perl5/Perl/Tidy.pm line 3827.
461 Thanks to Michael Renner and Phillipe Bruhat.
463 -Fixed problem where -sot would not stack an opening token followed by
464 a side comment. Thanks to Jens Schicke.
466 -improved breakpoints in complex math and other long statements. Example:
469 log($n) + 0.577215664901532 + ( 1 / ( 2 * $n ) ) -
470 ( 1 / ( 12 * ( $n**2 ) ) ) + ( 1 / ( 120 * ( $n**4 ) ) );
473 log($n) + 0.577215664901532 +
475 ( 1 / ( 12 * ( $n**2 ) ) ) +
476 ( 1 / ( 120 * ( $n**4 ) ) );
478 -more robust vertical alignment of complex terminal else blocks and ternary
482 -Eliminated bug where a here-doc invoked through an 'e' modifier on a pattern
483 replacement text was not recognized. The tokenizer now recursively scans
484 replacement text (but does not reformat it).
486 -improved vertical alignment of terminal else blocks and ternary statements.
487 Thanks to Chris for the suggestion.
490 if ( IsBitmap() ) { return GetBitmap(); }
491 elsif ( IsFiles() ) { return GetFiles(); }
492 else { return GetText(); }
495 if ( IsBitmap() ) { return GetBitmap(); }
496 elsif ( IsFiles() ) { return GetFiles(); }
497 else { return GetText(); }
502 : $opts{"s"} ? 'subject'
503 : $opts{"a"} ? 'author'
509 : $opts{"s"} ? 'subject'
510 : $opts{"a"} ? 'author'
513 -improved indentation of try/catch blocks and other externally defined
514 functions accepting a block argument. Thanks to jae.
516 -Added support for Perl 5.10 features say and smartmatch.
518 -Added flag -pbp (--perl-best-practices) as an abbreviation for parameters
519 suggested in Damian Conway's "Perl Best Practices". -pbp is the same as:
521 -l=78 -i=4 -ci=4 -st -se -vt=2 -cti=0 -pt=1 -bt=1 -sbt=1 -bbt=1 -nsfs -nolq
522 -wbb="% + - * / x != == >= <= =~ !~ < > | & >= < =
523 **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
525 Please note that the -st here restricts input to standard input; use
526 -nst if necessary to override.
528 -Eliminated some needless breaks at equals signs in -lp indentation.
532 Math::Complex->make(LEFT + $x * (RIGHT - LEFT) / SIZE,
533 TOP + $y * (BOTTOM - TOP) / SIZE);
535 $c = Math::Complex->make(LEFT + $x * (RIGHT - LEFT) / SIZE,
536 TOP + $y * (BOTTOM - TOP) / SIZE);
538 A break at an equals is sometimes useful for preventing complex statements
539 from hitting the line length limit. The decision to do this was
540 over-eager in some cases and has been improved. Thanks to Royce Reece.
542 -qw quotes contained in braces, square brackets, and parens are being
543 treated more like those containers as far as stacking of tokens. Also
544 stack of closing tokens ending ');' will outdent to where the ');' would
545 have outdented if the closing stack is matched with a similar opening stack.
547 OLD: perltidy -soc -sct
548 __PACKAGE__->load_components(
554 NEW: perltidy -soc -sct
555 __PACKAGE__->load_components( qw(
559 Thanks to Aran Deltac
561 -Eliminated some undesirable or marginally desirable vertical alignments.
562 These include terminal colons, opening braces, and equals, and particularly
563 when just two lines would be aligned.
566 my $accurate_timestamps = $Stamps{lnk};
570 my $accurate_timestamps = $Stamps{lnk};
573 -Corrected a problem with -mangle in which a space would be removed
574 between a keyword and variable beginning with ::.
577 -Attribute argument lists are now correctly treated as quoted strings
578 and not formatted. This is the most important update in this version.
579 Thanks to Borris Zentner, Greg Ferguson, Steve Kirkup.
581 -Updated to recognize the defined or operator, //, to be released in Perl 10.
582 Thanks to Sebastien Aperghis-Tramoni.
584 -A useful utility perltidyrc_dump.pl is included in the examples section. It
585 will read any perltidyrc file and write it back out in a standard format
586 (though comments are lost).
588 -Added option to have perltidy read and return a hash with the contents of a
589 perltidyrc file. This may be used by Leif Eriksen's tidyview code. This
590 feature is used by the demonstration program 'perltidyrc_dump.pl' in the
593 -Improved error checking in perltidyrc files. Unknown bare words were not
596 -The --dump-options parameter now dumps parameters in the format required by a
599 -V-Strings with underscores are now recognized.
600 For example: $v = v1.2_3;
602 -cti=3 option added which gives one extra indentation level to closing
603 tokens always. This provides more predictable closing token placement
604 than cti=2. If you are using cti=2 you might want to try cti=3.
606 -To identify all left-adjusted comments as static block comments, use C<-sbcp='^#'>.
608 -New parameters -fs, -fsb, -fse added to allow sections of code between #<<<
609 and #>>> to be passed through verbatim. This is enabled by default and turned
610 off by -nfs. Flags -fsb and -fse allow other beginning and ending markers.
611 Thanks to Wolfgang Werner and Marion Berryman for suggesting this.
613 -added flag -skp to put a space between all Perl keywords and following paren.
614 The default is to only do this for certain keywords. Suggested by
617 -added flag -sfp to put a space between a function name and following paren.
618 The default is not to do this. Suggested by H.Merijn Brand.
620 -Added patch to avoid breaking GetOpt::Long::Configure set by calling program.
621 Thanks to Philippe Bruhat.
623 -An error was fixed in which certain parameters in a .perltidyrc file given
624 without the equals sign were not recognized. That is,
625 '--brace-tightness 0' gave an error but '--brace-tightness=0' worked
626 ok. Thanks to Zac Hansen.
628 -An error preventing the -nwrs flag from working was corrected. Thanks to
631 -Corrected some alignment problems with entab option.
633 -A bug with the combination of -lp and -extrude was fixed (though this
634 combination doesn't really make sense). The bug was that a line with
635 a single zero would be dropped. Thanks to Cameron Hayne.
637 -Updated Windows detection code to avoid an undefined variable.
638 Thanks to Joe Yates and Russ Jones.
640 -Improved formatting for short trailing statements following a closing paren.
641 Thanks to Joe Matarazzo.
643 -The handling of the -icb (indent closing block braces) flag has been changed
644 slightly to provide more consistent and predictable formatting of complex
645 structures. Instead of giving a closing block brace the indentation of the
646 previous line, it is now given one extra indentation level. The two methods
647 give the same result if the previous line was a complete statement, as in this
656 The change also fixes a problem with empty blocks such as:
666 -A problem with -icb was fixed in which a closing brace was misplaced when
667 it followed a quote which spanned multiple lines.
669 -Some improved breakpoints for -wba='&& || and or'
671 -Fixed problem with misaligned cuddled else in complex statements
672 when the -bar flag was also used. Thanks to Alex and Royce Reese.
674 -Corrected documentation to show that --outdent-long-comments is the default.
677 -New flag -otr (opening-token-right) is similar to -bar (braces-always-right)
678 but applies to non-structural opening tokens.
680 -new flags -sot (stack-opening-token), -sct (stack-closing-token).
684 -The default has been changed to not do syntax checking with perl.
685 Use -syn if you want it. Perltidy is very robust now, and the -syn
686 flag now causes more problems than it's worth because of BEGIN blocks
687 (which get executed with perl -c). For example, perltidy will never
688 return when trying to beautify this code if -syn is used:
690 BEGIN { 1 while { }; }
692 Although this is an obvious error, perltidy is often run on untested
693 code which is more likely to have this sort of problem. A more subtle
696 BEGIN { use FindBin; }
698 which may hang on some systems using -syn if a shared file system is
701 -Changed style -gnu to use -cti=1 instead of -cti=2 (see next item).
702 In most cases it looks better. To recover the previous format, use
705 -Added flags -cti=n for finer control of closing token indentation.
706 -cti = 0 no extra indentation (default; same as -nicp)
707 -cti = 1 enough indentation so that the closing token
708 aligns with its opening token.
709 -cti = 2 one extra indentation level if the line has the form
710 ); ]; or }; (same as -icp).
712 The new option -cti=1 works well with -lp:
716 # perltidy -lp -cti=1
718 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
719 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
722 # perltidy -lp -cti=2
724 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
725 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
727 This is backwards compatible with -icp. See revised manual for
728 details. Suggested by Mike Pennington.
730 -Added flag '--preserve-line-endings' or '-ple' to cause the output
731 line ending to be the same as in the input file, for unix, dos,
732 or mac line endings. Only works under unix. Suggested by
735 -Added flag '--output-line-ending=s' or '-ole=s' where s=dos or win,
736 unix, or mac. Only works under unix.
738 -Files with Mac line endings should now be handled properly under unix
739 and dos without being passed through a converter.
741 -You may now include 'and', 'or', and 'xor' in the list following
742 '--want-break-after' to get line breaks after those keywords rather than
743 before them. Suggested by Rainer Hochschild.
745 -Corrected problem with command line option for -vtc=n and -vt=n. The
746 equals sign was being eaten up by the Windows shell so perltidy didn't
750 -Corrected cause of warning message with recent versions of Perl:
751 "Possible precedence problem on bitwise & operator at ..."
754 -fixed bug with -html with '=for pod2html' sections, in which code/pod
755 output order was incorrect. Thanks to Tassilo von Parseval.
757 -fixed bug when the -html flag is used, in which the following error
758 message, plus others, appear:
759 did not see <body> in pod2html output
760 This was caused by a change in the format of html output by pod2html
761 VERSION 1.04 (included with perl 5.8). Thanks to Tassilo von Parseval.
763 -Fixed bug where an __END__ statement would be mistaken for a label
764 if it is immediately followed by a line with a leading colon. Thanks
767 -Implemented guessing logic for brace types when it is ambiguous. This
768 has been on the TODO list a long time. Thanks to Boris Zentner for
771 -Long options may now be negated either as '--nolong-option'
772 or '--no-long-option'. Thanks to Philip Newton for the suggestion.
774 -added flag --html-entities or -hent which controls the use of
775 Html::Entities for html formatting. Use --nohtml-entities or -nhent to
776 prevent the use of Html::Entities to encode special symbols. The
777 default is -hent. Html::Entities when formatting perl text to escape
778 special symbols. This may or may not be the right thing to do,
779 depending on browser/language combinations. Thanks to Burak Gursoy for
782 -Bareword strings with leading '-', like, '-foo' now count as 1 token
783 for horizontal tightness. This way $a{'-foo'}, $a{foo}, and $a{-foo}
784 are now all treated similarly. Thus, by default, OLD: $a{ -foo } will
785 now be NEW: $a{-foo}. Suggested by Mark Olesen.
787 -added 2 new flags to control spaces between keywords and opening parens:
788 -sak=s or --space-after-keyword=s, and
789 -nsak=s or --nospace-after-keyword=s, where 's' is a list of keywords.
791 The new default list of keywords which get a space is:
793 "my local our and or eq ne if else elsif until unless while for foreach
794 return switch case given when"
796 Use -sak=s and -nsak=s to add and remove keywords from this list,
799 Explanation: Stephen Hildrey noted that perltidy was being inconsistent
800 in placing spaces between keywords and opening parens, and sent a patch
801 to give user control over this. The above list was selected as being
802 a reasonable default keyword list. Previously, perltidy
803 had a hardwired list which also included these keywords:
805 push pop shift unshift join split die
807 but did not have 'our'. Example: if you prefer to make perltidy behave
808 exactly as before, you can include the following two lines in your
811 -sak="push pop local shift unshift join split die"
814 -Corrected html error in .toc file when -frm -html is used (extra ");
815 browsers were tolerant of it.
817 -Improved alignment of chains of binary and ?/: operators. Example:
831 -improved breakpoint choices involving '->'
833 -Corrected tokenization of things like ${#} or ${©}. For example,
834 ${©} is valid, but ${© } is a syntax error.
836 -Corrected minor tokenization errors with indirect object notation.
837 For example, 'new A::()' works now.
839 -Minor tokenization improvements; all perl code distributed with perl 5.8
840 seems to be parsed correctly except for one instance (lextest.t)
844 -Implemented scalar attributes. Thanks to Sean Tobin for noting this.
846 -Fixed glitch introduced in previous release where -pre option
847 was not outputting a leading html <pre> tag.
849 -Numerous minor improvements in vertical alignment, including the following:
851 -Improved alignment of opening braces in many cases. Needed for improved
852 switch/case formatting, and also suggested by Mark Olesen for sort/map/grep
853 formatting. For example:
858 sort { $a->[1] <=> $b->[1] }
859 map { [ $_, -M ] } @filenames;
864 sort { $a->[1] <=> $b->[1] }
865 map { [ $_, -M ] } @filenames;
867 -Eliminated alignments across unrelated statements. Example:
869 $borrowerinfo->configure( -state => 'disabled' );
870 $borrowerinfo->grid( -col => 1, -row => 0, -sticky => 'w' );
873 $borrowerinfo->configure( -state => 'disabled' );
874 $borrowerinfo->grid( -col => 1, -row => 0, -sticky => 'w' );
876 Thanks to Mark Olesen for suggesting this.
878 -Improved alignement of '='s in certain cases.
879 Thanks to Norbert Gruener for sending an example.
881 -Outdent-long-comments (-olc) has been re-instated as a default, since
882 it works much better now. Use -nolc if you want to prevent it.
884 -Added check for 'perltidy file.pl -o file.pl', which causes file.pl
885 to be lost. (The -b option should be used instead). Thanks to mreister
886 for reporting this problem.
889 -Switch/case or given/when syntax is now recognized. Its vertical alignment
890 is not great yet, but it parses ok. The words 'switch', 'case', 'given',
891 and 'when' are now treated as keywords. If this causes trouble with older
892 code, we could introduce a switch to deactivate it. Thanks to Stan Brown
893 and Jochen Schneider for recommending this.
895 -Corrected error parsing sub attributes with call parameters.
896 Thanks to Marc Kerr for catching this.
898 -Sub prototypes no longer need to be on the same line as sub names.
900 -a new flag -frm or --frames will cause html output to be in a
901 frame, with table of contents in the left panel and formatted source
902 in the right panel. Try 'perltidy -html -frm somemodule.pm' for example.
904 -The new default for -html formatting is to pass the pod through Pod::Html.
905 The result is syntax colored code within your pod documents. This can be
906 deactivated with -npod. Thanks to those who have written to discuss this,
907 particularly Mark Olesen and Hugh Myers.
909 -the -olc (--outdent-long-comments) option works much better. It now outdents
910 groups of consecutive comments together, and by just the amount needed to
911 avoid having any one line exceeding the maximum line length.
913 -block comments are now trimmed of trailing whitespace.
915 -if a directory specified with -opath does not exist, it will be created.
917 -a table of contents to packages and subs is output when -html is used.
918 Use -ntoc to prevent this.
920 -fixed an unusual bug in which a 'for' statement following a 'format'
921 statement was not correctly tokenized. Thanks to Boris Zentner for
924 -Tidy.pm is no longer dependent on modules IO::Scalar and IO::ScalarArray.
925 There were some speed issues. Suggested by Joerg Walter.
927 -The treatment of quoted wildcards (file globs) is now system-independent.
932 would match box.pl, box.pm, brinx.pm under any operating system. Of
933 course, anything unquoted will be subject to expansion by any shell.
935 -default color for keywords under -html changed from
936 SaddleBrown (#8B4513) to magenta4 (#8B008B).
938 -fixed an arg parsing glitch in which something like:
940 would trigger the help message and exit, rather than operate on the
944 -New option '-b' or '--backup-and-modify-in-place' will cause perltidy to
945 overwrite the original file with the tidied output file. The original
946 file will be saved with a '.bak' extension (which can be changed with
947 -bext=s). Thanks to Rudi Farkas for the suggestion.
949 -An index to all subs is included at the top of -html output, unless
950 only the <pre> section is written.
952 -Anchor lines of the form <a name="mysub"></a> are now inserted at key points
953 in html output, such as before sub definitions, for the convenience of
954 postprocessing scripts. Suggested by Howard Owen.
956 -The cuddled-else (-ce) flag now also makes cuddled continues, like
959 while ( ( $pack, $file, $line ) = caller( $i++ ) ) {
965 Suggested by Simon Perreault.
967 -Fixed bug in which an extra blank line was added before an =head or
968 similar pod line after an __END__ or __DATA__ line each time
969 perltidy was run. Also, an extra blank was being added after
970 a terminal =cut. Thanks to Mike Birdsall for reporting this.
973 -Fixed bug in which space was inserted in a hyphenated hash key:
974 my $val = $myhash{USER-NAME};
976 my $val = $myhash{USER -NAME};
977 Thanks to an anonymous bug reporter at sourceforge.
979 -Fixed problem with the '-io' ('--indent-only') where all lines
980 were double spaced. Thanks to Nick Andrew for reporting this bug.
982 -Fixed tokenization error in which something like '-e1' was
985 -Corrected a rare problem involving older perl versions, in which
986 a line break before a bareword caused problems with 'use strict'.
987 Thanks to Wolfgang Weisselberg for noting this.
989 -More syntax error checking added.
991 -Outdenting labels (-ola) has been made the default, in order to follow the
992 perlstyle guidelines better. It's probably a good idea in general, but
993 if you do not want this, use -nola in your .perltidyrc file.
995 -Updated rules for padding logical expressions to include more cases.
996 Thanks to Wolfgang Weisselberg for helpful discussions.
998 -Added new flag -osbc (--outdent-static-block-comments) which will
999 outdent static block comments by 2 spaces (or whatever -ci equals).
1000 Requested by Jon Robison.
1003 -Corrected a bug, introduced in the previous release, in which some
1004 closing side comments (-csc) could have incorrect text. This is
1005 annoying but will be correct the next time perltidy is run with -csc.
1007 -Implemented XHTML patch submitted by Ville Skyttä.
1009 -Fixed bug where whitespace was being removed between 'Bar' and '()'
1010 in a use statement like:
1014 Thanks to Ville Skyttä for reporting this.
1016 -Whenever possible, if a logical expression is broken with leading
1017 '&&', '||', 'and', or 'or', then the leading line will be padded
1018 with additional space to produce alignment. This has been on the
1019 todo list for a long time; thanks to Frank Steinhauer for reminding
1020 me to do it. Notice the first line after the open parens here:
1024 !param("rules.to.$linecount")
1025 && !param("rules.from.$linecount")
1026 && !param("rules.subject.$linecount")
1028 param("rules.fieldname.$linecount")
1029 && param("rules.fieldval.$linecount")
1031 && !param("rules.size.$linecount")
1032 && !param("rules.custom.$linecount")
1037 !param("rules.to.$linecount")
1038 && !param("rules.from.$linecount")
1039 && !param("rules.subject.$linecount")
1041 param("rules.fieldname.$linecount")
1042 && param("rules.fieldval.$linecount")
1044 && !param("rules.size.$linecount")
1045 && !param("rules.custom.$linecount")
1049 -Corrected a mistokenization of variables for a package with a name
1050 equal to a perl keyword. For example:
1054 sub qx{print "Hello from my::qx\n";}
1056 In this case, the leading 'my' was mistokenized as a keyword, and a
1057 space was being place between 'my' and '::'. This has been
1058 corrected. Thanks to Martin Sluka for discovering this.
1060 -A new flag -bol (--break-at-old-logic-breakpoints)
1061 has been added to control whether containers with logical expressions
1062 should be broken open. This is the default.
1064 -A new flag -bok (--break-at-old-keyword-breakpoints)
1065 has been added to follow breaks at old keywords which return lists,
1066 such as sort and map. This is the default.
1068 -A new flag -bot (--break-at-old-trinary-breakpoints) has been added to
1069 follow breaks at trinary (conditional) operators. This is the default.
1071 -A new flag -cab=n has been added to control breaks at commas after
1072 '=>' tokens. The default is n=1, meaning break unless this breaks
1073 open an existing on-line container.
1075 -A new flag -boc has been added to allow existing list formatting
1076 to be retained. (--break-at-old-comma-breakpoints). See updated manual.
1078 -A new flag -iob (--ignore-old-breakpoints) has been added to
1079 prevent the locations of old breakpoints from influencing the output
1082 -Corrected problem where nested parentheses were not getting full
1083 indentation. This has been on the todo list for some time; thanks
1084 to Axel Rose for a snippet demonstrating this issue.
1086 OLD: inner list is not indented
1090 $ret->name, $user->username, $user->host,
1091 $user->server->name, $user->nick, "H"
1099 $ret->name, $user->username, $user->host,
1100 $user->server->name, $user->nick, "H"
1104 -Code cleaned up by removing the following unused, undocumented flags.
1105 They should not be in any .perltidyrc files because they were just
1106 experimental flags which were never documented. Most of them placed
1107 artificial limits on spaces, and Wolfgang Weisselberg convinced me that
1108 most of them they do more harm than good by causing unexpected results.
1110 --maximum-continuation-indentation (-mci)
1111 --maximum-whitespace-columns
1112 --maximum-space-to-comment (-xsc)
1113 --big-space-jump (-bsj)
1115 -Pod file 'perltidy.pod' has been appended to the script 'perltidy', and
1116 Tidy.pod has been append to the module 'Tidy.pm'. Older MakeMaker's
1117 were having trouble.
1119 -A new flag -isbc has been added for more control on comments. This flag
1120 has the effect that if there is no leading space on the line, then the
1121 comment will not be indented, and otherwise it may be. If both -ibc and
1122 -isbc are set, then -isbc takes priority. Thanks to Frank Steinhauer
1123 for suggesting this.
1125 -A new document 'stylekey.pod' has been created to quickly guide new users
1126 through the maze of perltidy style parameters. An html version is
1127 on the perltidy web page. Take a look! It should be very helpful.
1129 -Parameters for controlling 'vertical tightness' have been added:
1130 -vt and -vtc are the main controls, but finer control is provided
1131 with -pvt, -pcvt, -bvt, -bcvt, -sbvt, -sbcvt. Block brace vertical
1132 tightness controls have also been added.
1133 See updated manual and also see 'stylekey.pod'. Simple examples:
1135 # perltidy -lp -vt=1 -vtc=1
1136 @month_of_year = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
1137 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
1139 # perltidy -lp -vt=1 -vtc=0
1140 @month_of_year = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
1141 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
1144 -Lists which do not format well in uniform columns are now better
1145 identified and formated.
1148 return $c->create( 'polygon', $x, $y, $x + $ruler_info{'size'},
1149 $y + $ruler_info{'size'}, $x - $ruler_info{'size'},
1150 $y + $ruler_info{'size'} );
1155 $x + $ruler_info{'size'},
1156 $y + $ruler_info{'size'},
1157 $x - $ruler_info{'size'},
1158 $y + $ruler_info{'size'}
1162 radlablist($f1, pad('Initial', $p), $b->{Init}->get_panel_ref, 'None ',
1163 'None', 'Default', 'Default', 'Simple', 'Simple');
1167 $b->{Init}->get_panel_ref,
1168 'None ', 'None', 'Default', 'Default', 'Simple', 'Simple');
1170 -Corrected problem where an incorrect html filename was generated for
1171 external calls to Tidy.pm module. Fixed incorrect html title when
1172 Tidy.pm is called with IO::Scalar or IO::Array source.
1174 -Output file permissons are now set as follows. An output script file
1175 gets the same permission as the input file, except that owner
1176 read/write permission is added (otherwise, perltidy could not be
1177 rerun). Html output files use system defaults. Previously chmod 0755
1178 was used in all cases. Thanks to Mark Olesen for bringing this up.
1180 -Missing semicolons will not be added in multi-line blocks of type
1181 sort, map, or grep. This brings perltidy into closer agreement
1182 with common practice. Of course, you can still put semicolons
1183 there if you like. Thanks to Simon Perreault for a discussion of this.
1185 -Most instances of extra semicolons are now deleted. This is
1186 particularly important if the -csc option is used. Thanks to Wolfgang
1187 Weisselberg for noting this. For example, the following line
1188 (produced by 'h2xs' :) has an extra semicolon which will now be
1191 BEGIN { plan tests => 1 };
1193 -New parameter -csce (--closing-side-comment-else-flag) can be used
1194 to control what text is appended to 'else' and 'elsif' blocks.
1195 Default is to just add leading 'if' text to an 'else'. See manual.
1197 -The -csc option now labels 'else' blocks with additinal information
1198 from the opening if statement and elsif statements, if space.
1199 Thanks to Wolfgang Weisselberg for suggesting this.
1201 -The -csc option will now remove any old closing side comments
1202 below the line interval threshold. Thanks to Wolfgang Weisselberg for
1205 -The abbreviation feature, which was broken in the previous version,
1206 is now fixed. Thanks to Michael Cartmell for noting this.
1208 -Vertical alignment is now done for '||=' .. somehow this was
1212 -This version uses modules for the first time, and a standard perl
1213 Makefile.PL has been supplied. However, perltidy may still be
1214 installed as a single script, without modules. See INSTALL for
1217 -The man page 'perl2web' has been merged back into the main 'perltidy'
1218 man page to simplify installation. So you may remove that man page
1219 if you have an older installation.
1221 -Added patch from Axel Rose for MacPerl. The patch prompts the user
1222 for command line arguments before calling the module
1223 Perl::Tidy::perltidy.
1225 -Corrected bug with '-bar' which was introduced in the previous
1226 version. A closing block brace was being indented. Thanks to
1227 Alexandros M Manoussakis for reporting this.
1229 -New parameter '--entab-leading-whitespace=n', or '-et=n', has been
1230 added for those who prefer tabs. This behaves different from the
1231 existing '-t' parameter; see updated man page. Suggested by Mark
1234 -New parameter '--perl-syntax-check-flags=s' or '-pcsf=s' can be
1235 used to change the flags passed to perltidy in a syntax check.
1236 See updated man page. Suggested by Mark Olesen.
1238 -New parameter '--output-path=s' or '-opath=s' will cause output
1239 files to be placed in directory s. See updated man page. Thanks for
1240 Mark Olesen for suggesting this.
1242 -New parameter --dump-profile (or -dpro) will dump to
1243 standard output information about the search for a
1244 configuration file, the name of whatever configuration file
1245 is selected, and its contents. This should help debugging
1246 config files, especially on different Windows systems.
1248 -The -w parameter now notes possible errors of the form:
1250 $comment = s/^\s*(\S+)\..*/$1/; # trim whitespace
1252 -Corrections added for a leading ':' and for leaving a leading 'tcsh'
1253 line untouched. Mark Olesen reported that lines of this form were
1254 accepted by perl but not by perltidy:
1256 : # use -*- perl -*-
1257 eval 'exec perl -wS $0 "$@"' # shell should exec 'perl'
1258 unless 1; # but Perl should skip this one
1260 Perl will silently swallow a leading colon on line 1 of a
1261 script, and now perltidy will do likewise. For example,
1262 this is a valid script, provided that it is the first line,
1265 : print "Hello World\n";
1267 Also, perltidy will now mark a first line with leading ':' followed by
1268 '#' as type SYSTEM (just as a #! line), not to be formatted.
1270 -List formatting improved for certain lists with special
1271 initial terms, such as occur with 'printf', 'sprintf',
1272 'push', 'pack', 'join', 'chmod'. The special initial term is
1273 now placed on a line by itself. For example, perltidy -gnu
1277 "C4", hex($SourceAddr[0]),
1278 hex($SourceAddr[1]), hex($SourceAddr[2]),
1284 hex($SourceAddr[0]), hex($SourceAddr[1]),
1285 hex($SourceAddr[2]), hex($SourceAddr[3]));
1289 @{$$self{states}}, '64', '66', '68',
1290 '70', '72', '74', '76',
1291 '78', '80', '82', '84',
1292 '86', '88', '90', '92',
1293 '94', '96', '98', '100',
1300 '64', '66', '68', '70', '72', '74', '76',
1301 '78', '80', '82', '84', '86', '88', '90',
1302 '92', '94', '96', '98', '100', '102', '104'
1305 -Lists of complex items, such as matricies, are now detected
1306 and displayed with just one item per row:
1309 $this->{'CURRENT'}{'gfx'}{'MatrixSkew'} = Text::PDF::API::Matrix->new(
1310 [ 1, tan( deg2rad($a) ), 0 ], [ tan( deg2rad($b) ), 1, 0 ],
1315 $this->{'CURRENT'}{'gfx'}{'MatrixSkew'} = Text::PDF::API::Matrix->new(
1316 [ 1, tan( deg2rad($a) ), 0 ],
1317 [ tan( deg2rad($b) ), 1, 0 ],
1321 -The perl syntax check will be turned off for now when input is from
1322 standard input or standard output. The reason is that this requires
1323 temporary files, which has produced far too many problems during
1324 Windows testing. For example, the POSIX module under Windows XP/2000
1325 creates temporary names in the root directory, to which only the
1326 administrator should have permission to write.
1328 -Merged patch sent by Yves Orton to handle appropriate
1329 configuration file locations for different Windows varieties
1330 (2000, NT, Me, XP, 95, 98).
1332 -Added patch to properly handle a for/foreach loop without
1333 parens around a list represented as a qw. I didn't know this
1334 was possible until Wolfgang Weisselberg pointed it out:
1336 foreach my $key qw\Uno Due Tres Quadro\ {
1340 But Perl will give a syntax error without the $ variable; ie this will
1343 foreach qw\Uno Due Tres Quadro\ {
1347 -Merged Windows version detection code sent by Yves Orton. Perltidy
1348 now automatically turns off syntax checking for Win 9x/ME versions,
1349 and this has solved a lot of robustness problems. These systems
1350 cannot reliably handle backtick operators. See man page for
1353 -Merged VMS filename handling patch sent by Michael Cartmell. (Invalid
1354 output filenames were being created in some cases).
1356 -Numerous minor improvements have been made for -lp style indentation.
1358 -Long C-style 'for' expressions will be broken after each ';'.
1360 'perltidy -gnu' gives:
1363 for ($status = $db->seq($key, $value, R_CURSOR()) ; $status == 0
1364 and $key eq $origkey ; $status = $db->seq($key, $value, R_NEXT()))
1367 for ($status = $db->seq($key, $value, R_CURSOR()) ;
1368 $status == 0 and $key eq $origkey ;
1369 $status = $db->seq($key, $value, R_NEXT()))
1371 -For the -lp option, a single long term within parens
1372 (without commas) now has better alignment. For example,
1376 $self->throw("Must specify a known host, not $location,"
1377 . " possible values ("
1378 . join (",", sort keys %hosts) . ")");
1381 $self->throw("Must specify a known host, not $location,"
1382 . " possible values ("
1383 . join (",", sort keys %hosts) . ")");
1386 -This version is about 20 percent faster than the previous
1387 version as a result of optimization work. The largest gain
1388 came from switching to a dispatch hash table in the
1391 -perltidy -html will check to see if HTML::Entities is
1392 installed, and if so, it will use it to encode unsafe
1395 -Added flag -oext=ext to change the output file extension to
1396 be different from the default ('tdy' or 'html'). For
1399 perltidy -html -oext=htm filename
1401 will produce filename.htm
1403 -Added flag -cscw to issue warnings if a closing side comment would replace
1404 an existing, different side comments. See the man page for details.
1405 Thanks to Peter Masiar for helpful discussions.
1407 -Corrected tokenization error of signed hex/octal/binary numbers. For
1408 example, the first hex number below would have been parsed correctly
1409 but the second one was not:
1410 if ( ( $tmp >= 0x80_00_00 ) || ( $tmp < -0x80_00_00 ) ) { }
1412 -'**=' was incorrectly tokenized as '**' and '='. This only
1413 caused a problem with the -extrude opton.
1415 -Corrected a divide by zero when -extrude option is used
1417 -The flag -w will now contain all errors reported by 'perl -c' on the
1418 input file, but otherwise they are not reported. The reason is that
1419 perl will report lots of problems and syntax errors which are not of
1420 interest when only a small snippet is being formatted (such as missing
1421 modules and unknown bare words). Perltidy will always report all
1422 significant syntax errors that it finds, such as unbalanced braces,
1423 unless the -q (quiet) flag is set.
1425 -Merged modifications created by Hugh Myers into perltidy.
1426 These include a 'streamhandle' routine which allows perltidy
1427 as a module to operate on input and output arrays and strings
1428 in addition to files. Documentation and new packaging as a
1429 module should be ready early next year; This is an elegant,
1430 powerful update; many thanks to Hugh for contributing it.
1433 -added a tentative patch which tries to keep any existing breakpoints
1434 at lines with leading keywords map,sort,eval,grep. The idea is to
1435 improve formatting of sequences of list operations, as in a schwartzian
1439 my @sorted = map { $_->[0] }
1440 sort { $a->[1] <=> $b->[1] }
1441 map { [ $_, rand ] } @list;
1445 map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, rand ] } @list;
1448 my @sorted = map { $_->[0] }
1449 sort { $a->[1] <=> $b->[1] }
1450 map { [ $_, rand ] } @list;
1452 The new alignment is not as nice as the input, but this is an improvement.
1453 Thanks to Yves Orton for this suggestion.
1455 -modified indentation logic so that a line with leading opening paren,
1456 brace, or square bracket will never have less indentation than the
1457 line with the corresponding opening token. Here's a simple example:
1461 -text => "New Document",
1462 -command => \&new_document
1468 Note how the closing ');' is lined up with the first line, even
1469 though it closes a paren in the 'pack' line. That seems wrong.
1473 -text => "New Document",
1474 -command => \&new_document
1480 This seems nicer: you can up-arrow with an editor and arrive at the
1481 opening 'pack' line.
1483 -corrected minor glitch in which cuddled else (-ce) did not get applied
1484 to an 'unless' block, which should look like this:
1492 Thanks to Jeremy Mates for reporting this.
1494 -The man page has been reorganized to parameters easier to find.
1496 -Added check for multiple definitions of same subroutine. It is easy
1497 to introduce this problem when cutting and pasting. Perl does not
1498 complain about it, but it can lead to disaster.
1500 -The command -pro=filename or -profile=filename may be used to specify a
1501 configuration file which will override the default name of .perltidyrc.
1502 There must not be a space on either side of the '=' sign. I needed
1503 this to be able to easily test perltidy with a variety of different
1504 configuration files.
1506 -Side comment alignment has been improved somewhat across frequent level
1507 changes, as in short if/else blocks. Thanks to Wolfgang Weisselberg
1508 for pointing out this problem. For example:
1511 if ( ref $self ) { # Called as a method
1514 else { # Regular procedure call
1520 if ( ref $self ) { # Called as a method
1523 else { # Regular procedure call
1528 -New command -ssc (--static-side-comment) and related command allows
1529 side comments to be spaced close to preceding character. This is
1530 useful for displaying commented code as side comments.
1532 -New command -csc (--closing-side-comment) and several related
1533 commands allow comments to be added to (and deleted from) any or all
1534 closing block braces. This can be useful if you have to maintain large
1535 programs, especially those that you didn't write. See updated man page.
1536 Thanks to Peter Masiar for this suggestion. For a simple example:
1541 if ( !defined( $_[0] ) ) {
1542 print("Hello, World\n");
1545 print( $_[0], "\n" );
1549 This added '## end sub foo' to the closing brace.
1550 To remove it, perltidy -ncsc.
1552 -New commands -ola, for outdenting labels, and -okw, for outdenting
1553 selected control keywords, were implemented. See the perltidy man
1554 page for details. Thanks to Peter Masiar for this suggestion.
1556 -Hanging side comment change: a comment will not be considered to be a
1557 hanging side comment if there is no leading whitespace on the line.
1558 This should improve the reliability of identifying hanging side comments.
1559 Thanks to Peter Masiar for this suggestion.
1561 -Two new commands for outdenting, -olq (outdent-long-quotes) and -olc
1562 (outdent-long-comments), have been added. The original -oll
1563 (outdent-long-lines) remains, and now is an abbreviation for -olq and -olc.
1564 The new default is just -olq. This was necessary to avoid inconsistency with
1565 the new static block comment option.
1567 -Static block comments: to provide a way to display commented code
1568 better, the convention is used that comments with a leading '##' should
1569 not be formatted as usual. Please see '-sbc' (or '--static-block-comment')
1570 for documentation. It can be deactivated with with -nsbc, but
1571 should not normally be necessary. Thanks to Peter Masiar for this
1574 -Two changes were made to help show structure of complex lists:
1575 (1) breakpoints are forced after every ',' in a list where any of
1576 the list items spans multiple lines, and
1577 (2) List items which span multiple lines now get continuation indentation.
1579 The following example illustrates both of these points. Many thanks to
1580 Wolfgang Weisselberg for this snippet and a discussion of it; this is a
1581 significant formatting improvement. Note how it is easier to see the call
1582 parameters in the NEW version:
1585 assert( __LINE__, ( not defined $check )
1588 or $check eq "old", "Error in parameters",
1589 defined $old_new ? ( ref $old_new ? ref $old_new : $old_new ) : "undef",
1590 defined $db_new ? ( ref $db_new ? ref $db_new : $db_new ) : "undef",
1591 defined $old_db ? ( ref $old_db ? ref $old_db : $old_db ) : "undef" );
1596 ( not defined $check )
1600 "Error in parameters",
1601 defined $old_new ? ( ref $old_new ? ref $old_new : $old_new ) : "undef",
1602 defined $db_new ? ( ref $db_new ? ref $db_new : $db_new ) : "undef",
1603 defined $old_db ? ( ref $old_db ? ref $old_db : $old_db ) : "undef"
1606 Another example shows how this helps displaying lists:
1609 %{ $self->{COMPONENTS} } = (
1611 { type => 'name', adj => 'yes', font => 'Helvetica', 'index' => 0 },
1613 { type => 'road', adj => 'yes', font => 'Helvetica', 'index' => 2 },
1616 The structure is clearer with the added indentation:
1619 %{ $self->{COMPONENTS} } = (
1621 { type => 'name', adj => 'yes', font => 'Helvetica', 'index' => 0 },
1623 { type => 'road', adj => 'yes', font => 'Helvetica', 'index' => 2 },
1626 -The structure of nested logical expressions is now displayed better.
1627 Thanks to Wolfgang Weisselberg for helpful discussions. For example,
1628 note how the status of the final 'or' is displayed in the following:
1632 and null( $op->sibling )
1633 and $op->ppaddr eq "pp_null"
1634 and class($op) eq "UNOP"
1635 and ( ( $op->first->ppaddr =~ /^pp_(and|or)$/
1636 and $op->first->first->sibling->ppaddr eq "pp_lineseq" )
1637 or ( $op->first->ppaddr eq "pp_lineseq"
1638 and not null $op->first->first->sibling
1639 and $op->first->first->sibling->ppaddr eq "pp_unstack" ) ) );
1644 and null( $op->sibling )
1645 and $op->ppaddr eq "pp_null"
1646 and class($op) eq "UNOP"
1649 $op->first->ppaddr =~ /^pp_(and|or)$/
1650 and $op->first->first->sibling->ppaddr eq "pp_lineseq"
1652 or ( $op->first->ppaddr eq "pp_lineseq"
1653 and not null $op->first->first->sibling
1654 and $op->first->first->sibling->ppaddr eq "pp_unstack" )
1658 -A break will always be put before a list item containing a comma-arrow.
1659 This will improve formatting of mixed lists of this form:
1663 'text', 225, 20, -text => 'A Simple Plot',
1671 -text => 'A Simple Plot',
1676 -For convenience, the command -dac (--delete-all-comments) now also
1677 deletes pod. Likewise, -tac (--tee-all-comments) now also sends pod
1678 to a '.TEE' file. Complete control over the treatment of pod and
1679 comments is still possible, as described in the updated help message
1682 -The logic which breaks open 'containers' has been rewritten to be completely
1683 symmetric in the following sense: if a line break is placed after an opening
1684 {, [, or (, then a break will be placed before the corresponding closing
1685 token. Thus, a container either remains closed or is completely cracked
1688 -Improved indentation of parenthesized lists. For example,
1693 atan2( $GPSTempCompLong - $GPSLongitude,
1694 $GPSLatitude - $GPSTempCompLat ) * 180 / 3.14159265 );
1697 $GPSCompCourse = int(
1699 $GPSTempCompLong - $GPSLongitude,
1700 $GPSLatitude - $GPSTempCompLat
1701 ) * 180 / 3.14159265
1704 Further improvements will be made in future releases.
1706 -Some improvements were made in formatting small lists.
1708 -Correspondence between Input and Output line numbers reported in a
1709 .LOG file should now be exact. They were sometimes off due to the size
1710 of intermediate buffers.
1712 -Corrected minor tokenization error in which a ';' in a foreach loop
1713 control was tokenized as a statement termination, which forced a
1726 foreach ( $i = 0 ; $i <= 10 ; $i += 2 ) {
1730 -Corrected a problem with reading config files, in which quote marks were not
1731 stripped. As a result, something like -wba="&& . || " would have the leading
1732 quote attached to the && and not work correctly. A workaround for older
1733 versions is to place a space around all tokens within the quotes, like this:
1736 -Removed any existing space between a label and its ':'
1739 This was necessary because the label and its colon are a single token.
1741 -Corrected tokenization error for the following (highly non-recommended)
1743 $user = @vars[1] / 100;
1745 -Resolved cause of a difference between perltidy under perl v5.6.1 and
1746 5.005_03; the problem was different behavior of \G regex position
1750 -Corrected a bug in which a break was not being made after a full-line
1751 comment within a short eval/sort/map/grep block. A flag was not being
1752 zeroed. The syntax error check catches this. Here is a snippet which
1753 illustrates the bug:
1756 #open Socket to Dispatcher
1757 $sock = &OpenSocket;
1760 The formatter mistakenly thought that it had found the following
1763 eval {#open Socket to Dispatcher$sock = &OpenSocket; };
1765 The patch fixes this. Many thanks to Henry Story for reporting this bug.
1767 -Changes were made to help diagnose and resolve problems in a
1769 (1) processing of command parameters has been into two separate
1770 batches so that any errors in a .perltidyrc file can be localized.
1771 (2) commands --help, --version, and as many of the --dump-xxx
1772 commands are handled immediately, without any command line processing
1774 (3) Perltidy will ignore any commands in the .perltidyrc file which
1775 cause immediate exit. These are: -h -v -ddf -dln -dop -dsn -dtt
1776 -dwls -dwrs -ss. Thanks to Wolfgang Weisselberg for helpful
1777 suggestions regarding these updates.
1779 -Syntax check has been reinstated as default for MSWin32 systems. This
1780 way Windows 2000 users will get syntax check by default, which seems
1781 like a better idea, since the number of Win 95/98 systems will be
1782 decreasing over time. Documentation revised to warn Windows 95/98
1783 users about the problem with empty '&1'. Too bad these systems
1784 all report themselves as MSWin32.
1787 -Fixed tokenization error in which a method call of the form
1791 got a space before the '::' like this:
1795 Thanks to David Holden for reporting this.
1797 -Added -html control over pod text, using a new abbreviation 'pd'. See
1798 updated perl2web man page. The default is to use the color of a comment,
1799 but italicized. Old .css style sheets will need a new line for
1800 .pd to use this. The old color was the color of a string, and there
1803 -.css lines are now printed in sorted order.
1805 -Fixed interpolation problem where html files had '$input_file' as title
1806 instead of actual input file name. Thanks to Simon Perreault for finding
1807 this and sending a patch, and also to Tobias Weber.
1809 -Breaks will now have the ':' placed at the start of a line,
1810 one per line by default because this shows logical structure
1811 more clearly. This coding has been completely redone. Some
1812 examples of new ?/: formatting:
1815 wantarray ? map( $dir::cwd->lookup($_)->path, @_ ) :
1816 $dir::cwd->lookup( $_[0] )->path;
1820 ? map( $dir::cwd->lookup($_)->path, @_ )
1821 : $dir::cwd->lookup( $_[0] )->path;
1827 } : { a => 6, b => 8 };
1835 : { a => 6, b => 8 };
1838 $self->note($self->{skip} ? "Hunk #$self->{hunk} ignored at 1.\n" :
1839 "Hunk #$self->{hunk} failed--$@");
1842 $self->note($self->{skip}
1843 ? "Hunk #$self->{hunk} ignored at 1.\n"
1844 : "Hunk #$self->{hunk} failed--$@");
1848 $opts{"t"} ? 'title' :
1849 $opts{"s"} ? 'subject' : $opts{"a"} ? 'author' : 'title';
1853 $opts{"t"} ? 'title'
1854 : $opts{"s"} ? 'subject'
1855 : $opts{"a"} ? 'author'
1858 You can use -wba=':' to recover the previous default which placed ':'
1859 at the end of a line. Thanks to Michael Cartmell for helpful
1860 discussions and examples.
1862 -Tokenizer updated to do syntax checking for matched ?/: pairs. Also,
1863 the tokenizer now outputs a unique serial number for every balanced
1864 pair of brace types and ?/: pairs. This greatly simplifies the
1867 -Long lines with repeated 'and', 'or', '&&', '||' will now have
1868 one such item per line. For example:
1871 if ( $opt_d || $opt_m || $opt_p || $opt_t || $opt_x
1872 || ( -e $archive && $opt_r ) )
1874 ( $pAr, $pNames ) = readAr($archive);
1883 || ( -e $archive && $opt_r ) )
1885 ( $pAr, $pNames ) = readAr($archive);
1889 if ( $vp->{X0} + 4 <= $x && $vp->{X0} + $vp->{W} - 4 >= $x
1890 && $vp->{Y0} + 4 <= $y && $vp->{Y0} + $vp->{H} - 4 >= $y )
1893 if ( $vp->{X0} + 4 <= $x
1894 && $vp->{X0} + $vp->{W} - 4 >= $x
1895 && $vp->{Y0} + 4 <= $y
1896 && $vp->{Y0} + $vp->{H} - 4 >= $y )
1898 -Long lines with multiple concatenated tokens will have concatenated
1899 terms (see below) placed one per line, except for short items. For
1904 "Device type:" . $ib->family . " ID:" . $ib->serial . " CRC:"
1905 . $ib->crc . ": " . $ib->model() . "\n";
1908 $report .= "Device type:"
1909 . $ib->family . " ID:"
1910 . $ib->serial . " CRC:"
1912 . $ib->crc . ": " . "\n";
1914 NOTE: at present 'short' means 8 characters or less. There is a
1915 tentative flag to change this (-scl), but it is undocumented and
1916 is likely to be changed or removed later, so only use it for testing.
1917 In the above example, the tokens " ID:", " CRC:", and "\n" are below
1920 -If a line which is short enough to fit on a single line was
1921 nevertheless broken in the input file at a 'good' location (see below),
1922 perltidy will try to retain a break. For example, the following line
1923 will be formatted as:
1926 or die "Cannot open $file ($!)";
1928 if it was broken in the input file, and like this if not:
1930 open SUM, "<$file" or die "Cannot open $file ($!)";
1932 GOOD: 'good' location means before 'and','or','if','unless','&&','||'
1934 The reason perltidy does not just always break at these points is that if
1935 there are multiple, similar statements, this would preclude alignment. So
1936 rather than check for this, perltidy just tries to follow the input style,
1937 in the hopes that the author made a good choice. Here is an example where
1938 we might not want to break before each 'if':
1940 ($Locale, @Locale) = ($English, @English) if (@English > @Locale);
1941 ($Locale, @Locale) = ($German, @German) if (@German > @Locale);
1942 ($Locale, @Locale) = ($French, @French) if (@French > @Locale);
1943 ($Locale, @Locale) = ($Spanish, @Spanish) if (@Spanish > @Locale);
1945 -Added wildcard file expansion for systems with shells which lack this.
1946 Now 'perltidy *.pl' should work under MSDOS/Windows. Thanks to Hugh Myers
1947 for suggesting this. This uses builtin glob() for now; I may change that.
1949 -Added new flag -sbl which, if specified, overrides the value of -bl
1950 for opening sub braces. This allows formatting of this type:
1956 if (!defined($_[0])) {
1957 print("Hello, World\n");
1963 Requested by Don Alexander.
1965 -Fixed minor parsing error which prevented a space after a $$ variable
1966 (pid) in some cases. Thanks to Michael Cartmell for noting this.
1971 -Improved line break choices 'and' and 'or' to display logic better.
1975 exists $self->{'build_dir'} and push @e,
1976 "Unwrapped into directory $self->{'build_dir'}";
1979 exists $self->{'build_dir'}
1980 and push @e, "Unwrapped into directory $self->{'build_dir'}";
1982 -Fixed error of multiple use of abbreviatioin '-dsc'. -dsc remains
1983 abbreviation for delete-side-comments; -dsm is new abbreviation for
1986 -Corrected and updated 'usage' help routine. Thanks to Slaven Rezic for
1989 -The default for Windows is, for now, not to do a 'perl -c' syntax
1990 check (but -syn will activate it). This is because of problems with
1991 command.com. James Freeman sent me a patch which tries to get around
1992 the problems, and it works in many cases, but testing revealed several
1993 issues that still need to be resolved. So for now, the default is no
1994 syntax check for Windows.
1996 -I added a -T flag when doing perl -c syntax check.
1997 This is because I test it on a large number of scripts from sources
1998 unknown, and who knows what might be hidden in initialization blocks?
1999 Also, deactivated the syntax check if perltidy is run as root. As a
2000 benign example, running the previous version of perltidy on the
2001 following file would cause it to disappear:
2004 print "Bye, bye baby!\n";
2008 The new version will not let that happen.
2010 -I am contemplating (but have not yet implemented) making '-lp' the
2011 default indentation, because it is stable now and may be closer to how
2012 perl is commonly formatted. This could be in the next release. The
2013 reason that '-lp' was not the original default is that the coding for
2014 it was complex and not ready for the initial release of perltidy. If
2015 anyone has any strong feelings about this, I'd like to hear. The
2016 current default could always be recovered with the '-nlp' flag.
2020 - sub definition names are now specially colored, red by default.
2021 The letter 'm' is used to identify them.
2022 - keyword 'sub' now has color of other keywords.
2023 - restored html keyword color to __END__ and __DATA__, which was
2024 accidentally removed in the previous version.
2026 -A new -se (--standard-error-output) flag has been implemented and
2027 documented which causes all errors to be written to standard output
2028 instead of a .ERR file.
2030 -A new -w (--warning-output) flag has been implemented and documented
2031 which causes perltidy to output certain non-critical messages to the
2032 error output file, .ERR. These include complaints about pod usage,
2033 for example. The default is to not include these.
2035 NOTE: This replaces an undocumented -w=0 or --warning-level flag
2036 which was tentatively introduced in the previous version to avoid some
2037 unwanted messages. The new default is the same as the old -w=0, so
2038 that is no longer needed.
2040 -Improved syntax checking and corrected tokenization of functions such
2041 as rand, srand, sqrt, ... These can accept either an operator or a term
2042 to their right. This has been corrected.
2044 -Corrected tokenization of semicolon: testing of the previous update showed
2045 that the semicolon in the following statement was being mis-tokenized. That
2046 did no harm, other than adding an extra blank space, but has been corrected.
2048 for (sort {strcoll($a,$b);} keys %investments) {
2052 -New syntax check: after wasting 5 minutes trying to resolve a syntax
2053 error in which I had an extra terminal ';' in a complex for (;;) statement,
2054 I spent a few more minutes adding a check for this in perltidy so it won't
2057 -The behavior of --break-before-subs (-bbs) and --break-before-blocks
2058 (-bbb) has been modified. Also, a new control parameter,
2059 --long-block-line-count=n (-lbl=n) has been introduced to give more
2060 control on -bbb. This was previously a hardwired value. The reason
2061 for the change is to reduce the number of unwanted blank lines that
2062 perltidy introduces, and make it less erratic. It's annoying to remove
2063 an unwanted blank line and have perltidy put it back. The goal is to
2064 be able to sprinkle a few blank lines in that dense script you
2065 inherited from Bubba. I did a lot of experimenting with different
2066 schemes for introducing blank lines before and after code blocks, and
2067 decided that there is no really good way to do it. But I think the new
2068 scheme is an improvement. You can always deactivate this with -nbbb.
2069 I've been meaning to work on this; thanks to Erik Thaysen for bringing
2072 -The .LOG file is seldom needed, and I get tired of deleting them, so
2073 they will now only be automatically saved if perltidy thinks that it
2074 made an error, which is almost never. You can still force the logfile
2075 to be saved with -log or -g.
2077 -Improved method for computing number of columns in a table. The old
2078 method always tried for an even number. The new method allows odd
2079 numbers when it is obvious that a list is not a hash initialization
2083 $name, $xsargs, $parobjs, $optypes,
2084 $hasp2child, $pmcode, $hdrcode, $inplacecode,
2085 $globalnew, $callcopy
2090 $name, $xsargs, $parobjs, $optypes, $hasp2child,
2091 $pmcode, $hdrcode, $inplacecode, $globalnew, $callcopy
2095 -I fiddled with the list threshold adjustment, and some small lists
2096 look better now. Here is the change for one of the lists in test file
2100 ("in", "in", "pt", "pt", "pc", "pi", "mm", "mm", "cm", "cm", "\\hsize", "%",
2101 "\\vsize", "%", "\\textwidth", "%", "\\textheight", "%");
2105 "in", "in", "pt", "pt", "pc", "pi",
2106 "mm", "mm", "cm", "cm", "\\hsize", "%",
2107 "\\vsize", "%", "\\textwidth", "%", "\\textheight", "%"
2110 -Improved -lp formatting at '=' sign. A break was always being added after
2111 the '=' sign in a statement such as this, (to be sure there was enough room
2112 for the parameters):
2117 $biblionumber, $constraint,
2121 The updated version doesn't do this unless the space is really needed:
2123 new: my $fee = CalcReserveFee(
2125 $biblionumber, $constraint,
2129 -I updated the tokenizer to allow $#+ and $#-, which seem to be new to
2130 Perl 5.6. Some experimenting with a recent version of Perl indicated
2131 that it allows these non-alphanumeric '$#' array maximum index
2132 varaibles: $#: $#- $#+ so I updated the parser accordingly. Only $#:
2133 seems to be valid in older versions of Perl.
2135 -Fixed a rare formatting problem with -lp (and -gnu) which caused
2136 excessive indentation.
2138 -Many additional syntax checks have been added.
2140 -Revised method for testing here-doc target strings; the following
2141 was causing trouble with a regex test because of the '*' characters:
2145 Perl seems to allow almost anything to be a here doc target, so an
2146 exact string comparison is now used.
2148 -Made update to allow underscores in binary numbers, like '0b1100_0000'.
2150 -Corrected problem with scanning certain module names; a blank space was
2151 being inserted after 'warnings' in the following:
2152 use warnings::register;
2153 The problem was that warnings (and a couple of other key modules) were
2154 being tokenized as keywords. They should have just been identifiers.
2156 -Corrected tokenization of indirect objects after sort, system, and exec,
2157 after testing produced an incorrect error message for the following
2159 print sort $sortsubref @list;
2161 -Corrected minor problem where a line after a format had unwanted
2162 extra continuation indentation.
2164 -Delete-block-comments (and -dac) now retain any leading hash-bang line
2166 -Update for -lp (and -gnu) to not align the leading '=' of a list
2167 with a previous '=', since this interferes with alignment of parameters.
2169 old: my $hireDay = new Date;
2176 new: my $hireDay = new Date;
2183 -Modifications made to display tables more compactly when possible,
2184 without adding lines. For example,
2186 '1', "I", '2', "II", '3', "III", '4', "IV",
2187 '5', "V", '6', "VI", '7', "VII", '8', "VIII",
2190 '1', "I", '2', "II", '3', "III",
2191 '4', "IV", '5', "V", '6', "VI",
2192 '7', "VII", '8', "VIII", '9', "IX"
2194 -Corrected minor bug in which -pt=2 did not keep the right paren tight
2195 around a '++' or '--' token, like this:
2197 for ($i = 0 ; $i < length $key ; $i++ )
2199 The formatting for this should be, and now is:
2201 for ($i = 0 ; $i < length $key ; $i++)
2203 Thanks to Erik Thaysen for noting this.
2205 -Discovered a new bug involving here-docs during testing! See BUGS.html.
2207 -Finally fixed parsing of subroutine attributes (A Perl 5.6 feature).
2208 However, the attributes and prototypes must still be on the same line
2212 -Corrected minor, uncommon bug found during routine testing, in which a
2213 blank got inserted between a function name and its opening paren after
2214 a file test operator, but only in the case that the function had not
2215 been previously seen. Perl uses the existance (or lack thereof) of
2216 the blank to guess if it is a function call. That is,
2217 if (-l pid_filename()) {
2219 if (-l pid_filename ()) {
2220 which is a syntax error if pid_filename has not been seen by perl.
2222 -If the AutoLoader module is used, perltidy will continue formatting
2223 code after seeing an __END__ line. Use -nlal to deactivate this feature.
2224 Likewise, if the SelfLoader module is used, perltidy will continue
2225 formatting code after seeing a __DATA__ line. Use -nlsl to
2226 deactivate this feature. Thanks to Slaven Rezic for this suggestion.
2228 -pod text after __END__ and __DATA__ is now identified by perltidy
2229 so that -dp works correctly. Thanks to Slaven Rezic for this suggestion.
2231 -The first $VERSION line which might be eval'd by MakeMaker
2232 is now passed through unchanged. Use -npvl to deactivate this feature.
2233 Thanks to Manfred Winter for this suggestion.
2235 -Improved indentation of nested parenthesized expressions. Tests have
2236 given favorable results. Thanks to Wolfgang Weisselberg for helpful
2240 -Fixed a very rare problem in which an unwanted semicolon was inserted
2241 due to misidentification of anonymous hash reference curly as a code
2242 block curly. (No instances of this have been reported; I discovered it
2243 during testing). A workaround for older versions of perltidy is to use
2246 -Added -icb (-indent-closing-brace) parameter to indent a brace which
2247 terminates a code block to the same level as the previous line.
2248 Suggested by Andrew Cutler. For example,
2257 -Rewrote error message triggered by an unknown bareword in a print or
2258 printf filehandle position, and added flag -w=0 to prevent issuing this
2259 error message. Suggested by Byron Jones.
2261 -Added modification to align a one-line 'if' block with similar
2262 following 'elsif' one-line blocks, like this:
2263 if ( $something eq "simple" ) { &handle_simple }
2264 elsif ( $something eq "hard" ) { &handle_hard }
2265 (Suggested by Wolfgang Weisselberg).
2268 -Eliminated all constants with leading underscores because perl 5.005_03
2269 does not support that. For example, _SPACES changed to XX_SPACES.
2270 Thanks to kromJx for this update.
2273 -the directory of test files has been moved to a separate distribution
2274 file because it is getting large but is of little interest to most users.
2275 For the current distribution:
2276 perltidy-20010701.tgz contains the source and docs for perltidy
2277 perltidy-20010701-test.tgz contains the test files
2279 -fixed bug where temporary file perltidy.TMPI was not being deleted
2280 when input was from stdin.
2282 -adjusted line break logic to not break after closing brace of an
2283 eval block (suggested by Boris Zentner).
2285 -added flag -gnu (--gnu-style) to give an approximation to the GNU
2286 style as sometimes applied to perl. The programming style in GNU
2287 'automake' was used as a guide in setting the parameters; these
2288 parameters will probably be adjusted over time.
2290 -an empty code block now has one space for emphasis:
2291 if ( $cmd eq "bg_untested" ) {} # old
2292 if ( $cmd eq "bg_untested" ) { } # new
2293 If this bothers anyone, we could create a parameter.
2295 -the -bt (--brace-tightness) parameter has been split into two
2296 parameters to give more control. -bt now applies only to non-BLOCK
2297 braces, while a new parameter -bbt (block-brace-tightness) applies to
2298 curly braces which contain code BLOCKS. The default value is -bbt=0.
2300 -added flag -icp (--indent-closing-paren) which leaves a statment
2301 termination of the form );, };, or ]; indented with the same
2302 indentation as the previous line. For example,
2304 @month_of_year = ( # default, or -nicp
2305 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
2309 @month_of_year = ( # -icp
2310 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
2314 -Vertical alignment updated to synchronize with tokens &&, ||,
2315 and, or, if, unless. Allowable space before forcing
2316 resynchronization has been increased. (Suggested by Wolfgang
2319 -html corrected to use -nohtml-bold-xxxxxxx or -nhbx to negate bold,
2320 and likewise -nohtml-italic-xxxxxxx or -nhbi to negate italic. There
2321 was no way to negate these previously. html documentation updated and
2322 corrected. (Suggested by Wolfgang Weisselberg).
2324 -Some modifications have been made which improve the -lp formatting in
2327 -Perltidy now retains or creates a blank line after an =cut to keep
2328 podchecker happy (Suggested by Manfred H. Winter). This appears to be
2329 a glitch in podchecker, but it was annoying.
2332 -Added -bli flag to give continuation indentation to braces, like this
2336 extra_indentation();
2339 -Corrected an error with the tab (-t) option which caused the last line
2340 of a multi-line quote to receive a leading tab. This error was in
2341 version 2001 06 08 but not 2001 04 06. If you formatted a script
2342 with -t with this version, please check it by running once with the
2343 -chk flag and perltidy will scan for this possible error.
2345 -Corrected an invalid pattern (\R should have been just R), changed
2346 $^W =1 to BEGIN {$^W=1} to use warnings in compile phase, and corrected
2347 several unnecessary 'my' declarations. Many thanks to Wolfgang Weisselberg,
2348 2001-06-12, for catching these errors.
2350 -A '-bar' flag has been added to require braces to always be on the
2351 right, even for multi-line if and foreach statements. For example,
2352 the default formatting of a long if statement would be:
2354 if ($bigwasteofspace1 && $bigwasteofspace2
2355 || $bigwasteofspace3 && $bigwasteofspace4)
2360 With -bar, the formatting is:
2362 if ($bigwasteofspace1 && $bigwasteofspace2
2363 || $bigwasteofspace3 && $bigwasteofspace4) {
2366 Suggested by Eli Fidler 2001-06-11.
2368 -Uploaded perltidy to sourceforge cvs 2001-06-10.
2370 -An '-lp' flag (--line-up-parentheses) has been added which causes lists
2371 to be indented with extra indentation in the manner sometimes
2372 associated with emacs or the GNU suggestions. Thanks to Ian Stuart for
2373 this suggestion and for extensive help in testing it.
2375 -Subroutine call parameter lists are now formatted as other lists.
2376 This should improve formatting of tables being passed via subroutine
2377 calls. This will also cause full indentation ('-i=n, default n= 4) of
2378 continued parameter list lines rather than just the number of spaces
2379 given with -ci=n, default n=2.
2381 -Added support for hanging side comments. Perltidy identifies a hanging
2382 side comment as a comment immediately following a line with a side
2383 comment or another hanging side comment. This should work in most
2384 cases. It can be deactivated with --no-hanging-side-comments (-nhsc).
2385 The manual has been updated to discuss this. Suggested by Brad
2386 Eisenberg some time ago, and finally implemented.
2389 -fixed problem with parsing command parameters containing quoted
2390 strings in .perltidyrc files. (Reported by Roger Espel Llima 2001-06-07).
2392 -added two command line flags, --want-break-after and
2393 --want-break-before, which allow changing whether perltidy
2394 breaks lines before or after any operators. Please see the revised
2395 man pages for details.
2397 -added system-wide configuration file capability.
2398 If perltidy does not find a .perltidyrc command line file in
2399 the current directory, nor in the home directory, it now looks
2400 for '/usr/local/etc/perltidyrc' and then for '/etc/perltidyrc'.
2401 (Suggested by Roger Espel Llima 2001-05-31).
2403 -fixed problem in which spaces were trimmed from lines of a multi-line
2404 quote. (Reported by Roger Espel Llima 2001-05-30). This is an
2405 uncommon situation, but serious, because it could conceivably change
2406 the proper function of a script.
2408 -fixed problem in which a semicolon was incorrectly added within
2409 an anonymous hash. (Reported by A.C. Yardley, 2001-5-23).
2410 (You would know if this happened, because perl would give a syntax
2411 error for the resulting script).
2413 -fixed problem in which an incorrect error message was produced
2414 after a version number on a 'use' line, like this ( Reported
2415 by Andres Kroonmaa, 2001-5-14):
2417 use CGI 2.42 qw(fatalsToBrowser);
2419 Other than the extraneous error message, this bug was harmless.
2422 -fixed serious bug in which the last line of some multi-line quotes or
2423 patterns was given continuation indentation spaces. This may make
2424 a pattern incorrect unless it uses the /x modifier. To find
2425 instances of this error in scripts which have been formatted with
2426 earlier versions of perltidy, run with the -chk flag, which has
2427 been added for this purpose (SLH, 2001-04-05).
2429 ** So, please check previously formatted scripts by running with -chk
2432 -continuation indentation has been reprogrammed to be hierarchical,
2433 which improves deeply nested structures.
2435 -fixed problem with undefined value in list formatting (reported by Michael
2438 -Switched to graphical display of nesting in .LOG files. If an
2439 old format string was "(1 [0 {2", the new string is "{{(". This
2440 is easier to read and also shows the order of nesting.
2442 -added outdenting of cuddled paren structures, like ")->pack(".
2444 -added line break and outdenting of ')->' so that instead of
2447 -text => "perltidy",
2448 -relief => 'ridge')->pack;
2450 the current default is:
2453 -text => "perltidy",
2457 (requested by Michael Langner 2001-03-31; in the future this could
2458 be controlled by a command-line parameter).
2460 -revised list indentation logic, so that lists following an assignment
2461 operator get one full indentation level, rather than just continuation
2462 indentation. Also corrected some minor glitches in the continuation
2465 -Fixed problem with unwanted continuation indentation after a blank line
2466 (reported by Erik Thaysen 2001-03-28):
2468 -minor update to avoid stranding a single '(' on one line
2471 -corrected serious error tokenizing filehandles, in which a sub call
2472 after a print or printf, like this:
2473 print usage() and exit;
2475 print usage () and exit;
2476 Unfortunately, this converts 'usage' to a filehandle. To fix this, rerun
2477 perltidy; it will look for this situation and issue a warning.
2479 -fixed another cuddled-else formatting bug (Reported by Craig Bourne)
2481 -added several diagnostic --dump routines
2483 -added token-level whitespace controls (suggested by Hans Ecke)
2486 -added support for special variables of the form ${^WANT_BITS}
2488 -space added between scalar and left paren in 'for' and 'foreach' loops,
2489 (suggestion by Michael Cartmell):
2491 for $i( 1 .. 20 ) # old
2492 for $i ( 1 .. 20 ) # new
2494 -html now outputs cascading style sheets (thanks to suggestion from
2497 -flags -o and -st now work with -html
2499 -added missing -html documentation for comments (noted by Alex Izvorski)
2501 -support for VMS added (thanks to Michael Cartmell for code patches and
2504 -v-strings implemented (noted by Hans Ecke and Michael Cartmell; extensive
2505 testing by Michael Cartmell)
2507 -fixed problem where operand may be empty at line 3970
2508 (\b should be just b in lines 3970, 3973) (Thanks to Erik Thaysen,
2509 Keith Marshall for bug reports)
2511 -fixed -ce bug (cuddled else), where lines like '} else {' were indented
2512 (Thanks to Shawn Stepper and Rick Measham for reporting this)
2515 -fixed undefined value in line 153 (only worked with -I set)
2516 (Thanks to Mike Stok, Phantom of the Opcodes, Ian Ehrenwald, and others)
2518 -fixed undefined value in line 1069 (filehandle problem with perl versions <
2519 5.6) (Thanks to Yuri Leikind, Mike Stok, Michael Holve, Jeff Kolber)
2522 -Initial announcement at freshmeat.net; started Change Log
2523 (Unfortunately this version was DOA, but it was fixed the next day)