Perltidy Change Log
You can help Perltidy evolve into a better program. If you
have hit a bug, unusual behavior, annoyance, or have a
suggested improvement, please send a note to perltidy at
users.sourceforge.net.
2002 11 30
-Implemented scalar attributes. Thanks to Sean Tobin for noting this.
-Fixed glitch introduced in previous release where -pre option
was not outputting a leading html <pre> tag.
-Numerous minor improvements in vertical alignment, including the following:
-Improved alignment of opening braces in many cases. Needed for improved
switch/case formatting, and also suggested by Mark Olesen for sort/map/grep
formatting. For example:
OLD:
@modified =
map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [ $_, -M ] } @filenames;
NEW:
@modified =
map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [ $_, -M ] } @filenames;
-Eliminated alignments across unrelated statements. Example:
OLD:
$borrowerinfo->configure( -state => 'disabled' );
$borrowerinfo->grid( -col => 1, -row => 0, -sticky => 'w' );
NEW:
$borrowerinfo->configure( -state => 'disabled' );
$borrowerinfo->grid( -col => 1, -row => 0, -sticky => 'w' );
Thanks to Mark Olesen for suggesting this.
-Improved alignement of '='s in certain cases.
Thanks to Norbert Gruener for sending an example.
-Outdent-long-comments (-olc) has been re-instated as a default, since
it works much better now. Use -nolc if you want to prevent it.
-Added check for 'perltidy file.pl -o file.pl', which causes file.pl
to be lost. (The -b option should be used instead). Thanks to mreister
for reporting this problem.
2002 11 06
-Switch/case or given/when syntax is now recognized. Its vertical alignment
is not great yet, but it parses ok. The words 'switch', 'case', 'given',
and 'when' are now treated as keywords. If this causes trouble with older
code, we could introduce a switch to deactivate it. Thanks to Stan Brown
and Jochen Schneider for recommending this.
-Corrected error parsing sub attributes with call parameters.
Thanks to Marc Kerr for catching this.
-Sub prototypes no longer need to be on the same line as sub names.
-a new flag -frm or --frames will cause html output to be in a
frame, with table of contents in the left panel and formatted source
in the right panel. Try 'perltidy -html -frm somemodule.pm' for example.
-The new default for -html formatting is to pass the pod through Pod::Html.
The result is syntax colored code within your pod documents. This can be
deactivated with -npod. Thanks to those who have written to discuss this,
particularly Mark Olesen and Hugh Myers.
-the -olc (--outdent-long-comments) option works much better. It now outdents
groups of consecutive comments together, and by just the amount needed to
avoid having any one line exceeding the maximum line length.
-block comments are now trimmed of trailing whitespace.
-if a directory specified with -opath does not exist, it will be created.
-a table of contents to packages and subs is output when -html is used.
Use -ntoc to prevent this.
-fixed an unusual bug in which a 'for' statement following a 'format'
statement was not correctly tokenized. Thanks to Boris Zentner for
catching this.
-Tidy.pm is no longer dependent on modules IO::Scalar and IO::ScalarArray.
There were some speed issues. Suggested by Joerg Walter.
-The treatment of quoted wildcards (file globs) is now system-independent.
For example
perltidy 'b*x.p[lm]'
would match box.pl, box.pm, brinx.pm under any operating system. Of
course, anything unquoted will be subject to expansion by any shell.
-default color for keywords under -html changed from
SaddleBrown (#8B4513) to magenta4 (#8B008B).
-fixed an arg parsing glitch in which something like:
perltidy quick-help
would trigger the help message and exit, rather than operate on the
file 'quick-help'.
2002 09 22
-New option '-b' or '--backup-and-modify-in-place' will cause perltidy to
overwrite the original file with the tidied output file. The original
file will be saved with a '.bak' extension (which can be changed with
-bext=s). Thanks to Rudi Farkas for the suggestion.
-An index to all subs is included at the top of -html output, unless
only the <pre> section is written.
-Anchor lines of the form <a name="mysub"></a> are now inserted at key points
in html output, such as before sub definitions, for the convenience of
postprocessing scripts. Suggested by Howard Owen.
-The cuddled-else (-ce) flag now also makes cuddled continues, like
this:
while ( ( $pack, $file, $line ) = caller( $i++ ) ) {
# bla bla
} continue {
$prevpack = $pack;
}
Suggested by Simon Perreault.
-Fixed bug in which an extra blank line was added before an =head or
similar pod line after an __END__ or __DATA__ line each time
perltidy was run. Also, an extra blank was being added after
a terminal =cut. Thanks to Mike Birdsall for reporting this.
2002 08 26
-Fixed bug in which space was inserted in a hyphenated hash key:
my $val = $myhash{USER-NAME};
was converted to:
my $val = $myhash{USER -NAME};
Thanks to an anonymous bug reporter at sourceforge.
-Fixed problem with the '-io' ('--indent-only') where all lines
were double spaced. Thanks to Nick Andrew for reporting this bug.
-Fixed tokenization error in which something like '-e1' was
parsed as a number.
-Corrected a rare problem involving older perl versions, in which
a line break before a bareword caused problems with 'use strict'.
Thanks to Wolfgang Weisselberg for noting this.
-More syntax error checking added.
-Outdenting labels (-ola) has been made the default, in order to follow the
perlstyle guidelines better. It's probably a good idea in general, but
if you do not want this, use -nola in your .perltidyrc file.
-Updated rules for padding logical expressions to include more cases.
Thanks to Wolfgang Weisselberg for helpful discussions.
-Added new flag -osbc (--outdent-static-block-comments) which will
outdent static block comments by 2 spaces (or whatever -ci equals).
Requested by Jon Robison.
2002 04 25
-Corrected a bug, introduced in the previous release, in which some
closing side comments (-csc) could have incorrect text. This is
annoying but will be correct the next time perltidy is run with -csc.
-Implemented XHTML patch submitted by Ville Skyttä.
-Fixed bug where whitespace was being removed between 'Bar' and '()'
in a use statement like:
use Foo::Bar ();
Thanks to Ville Skyttä for reporting this.
-Whenever possible, if a logical expression is broken with leading
'&&', '||', 'and', or 'or', then the leading line will be padded
with additional space to produce alignment. This has been on the
todo list for a long time; thanks to Frank Steinhauer for reminding
me to do it. Notice the first line after the open parens here:
OLD: perltidy -lp
if (
!param("rules.to.$linecount")
&& !param("rules.from.$linecount")
&& !param("rules.subject.$linecount")
&& !(
param("rules.fieldname.$linecount")
&& param("rules.fieldval.$linecount")
)
&& !param("rules.size.$linecount")
&& !param("rules.custom.$linecount")
)
NEW: perltidy -lp
if (
!param("rules.to.$linecount")
&& !param("rules.from.$linecount")
&& !param("rules.subject.$linecount")
&& !(
param("rules.fieldname.$linecount")
&& param("rules.fieldval.$linecount")
)
&& !param("rules.size.$linecount")
&& !param("rules.custom.$linecount")
)
2002 04 16
-Corrected a mistokenization of variables for a package with a name
equal to a perl keyword. For example:
my::qx();
package my;
sub qx{print "Hello from my::qx\n";}
In this case, the leading 'my' was mistokenized as a keyword, and a
space was being place between 'my' and '::'. This has been
corrected. Thanks to Martin Sluka for discovering this.
-A new flag -bol (--break-at-old-logic-breakpoints)
has been added to control whether containers with logical expressions
should be broken open. This is the default.
-A new flag -bok (--break-at-old-keyword-breakpoints)
has been added to follow breaks at old keywords which return lists,
such as sort and map. This is the default.
-A new flag -bot (--break-at-old-trinary-breakpoints) has been added to
follow breaks at trinary (conditional) operators. This is the default.
-A new flag -cab=n has been added to control breaks at commas after
'=>' tokens. The default is n=1, meaning break unless this breaks
open an existing on-line container.
-A new flag -boc has been added to allow existing list formatting
to be retained. (--break-at-old-comma-breakpoints). See updated manual.
-A new flag -iob (--ignore-old-breakpoints) has been added to
prevent the locations of old breakpoints from influencing the output
format.
-Corrected problem where nested parentheses were not getting full
indentation. This has been on the todo list for some time; thanks
to Axel Rose for a snippet demonstrating this issue.
OLD: inner list is not indented
$this->sendnumeric(
$this->server,
(
$ret->name, $user->username, $user->host,
$user->server->name, $user->nick, "H"
),
);
NEW:
$this->sendnumeric(
$this->server,
(
$ret->name, $user->username, $user->host,
$user->server->name, $user->nick, "H"
),
);
-Code cleaned up by removing the following unused, undocumented flags.
They should not be in any .perltidyrc files because they were just
experimental flags which were never documented. Most of them placed
artificial limits on spaces, and Wolfgang Weisselberg convinced me that
most of them they do more harm than good by causing unexpected results.
--maximum-continuation-indentation (-mci)
--maximum-whitespace-columns
--maximum-space-to-comment (-xsc)
--big-space-jump (-bsj)
-Pod file 'perltidy.pod' has been appended to the script 'perltidy', and
Tidy.pod has been append to the module 'Tidy.pm'. Older MakeMaker's
were having trouble.
-A new flag -isbc has been added for more control on comments. This flag
has the effect that if there is no leading space on the line, then the
comment will not be indented, and otherwise it may be. If both -ibc and
-isbc are set, then -isbc takes priority. Thanks to Frank Steinhauer
for suggesting this.
-A new document 'stylekey.pod' has been created to quickly guide new users
through the maze of perltidy style parameters. An html version is
on the perltidy web page. Take a look! It should be very helpful.
-Parameters for controlling 'vertical tightness' have been added:
-vt and -vtc are the main controls, but finer control is provided
with -pvt, -pcvt, -bvt, -bcvt, -sbvt, -sbcvt. Block brace vertical
tightness controls have also been added.
See updated manual and also see 'stylekey.pod'. Simple examples:
# perltidy -lp -vt=1 -vtc=1
@month_of_year = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
# perltidy -lp -vt=1 -vtc=0
@month_of_year = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
);
-Lists which do not format well in uniform columns are now better
identified and formated.
OLD:
return $c->create( 'polygon', $x, $y, $x + $ruler_info{'size'},
$y + $ruler_info{'size'}, $x - $ruler_info{'size'},
$y + $ruler_info{'size'} );
NEW:
return $c->create(
'polygon', $x, $y,
$x + $ruler_info{'size'},
$y + $ruler_info{'size'},
$x - $ruler_info{'size'},
$y + $ruler_info{'size'}
);
OLD:
radlablist($f1, pad('Initial', $p), $b->{Init}->get_panel_ref, 'None ',
'None', 'Default', 'Default', 'Simple', 'Simple');
NEW:
radlablist($f1,
pad('Initial', $p),
$b->{Init}->get_panel_ref,
'None ', 'None', 'Default', 'Default', 'Simple', 'Simple');
-Corrected problem where an incorrect html filename was generated for
external calls to Tidy.pm module. Fixed incorrect html title when
Tidy.pm is called with IO::Scalar or IO::Array source.
-Output file permissons are now set as follows. An output script file
gets the same permission as the input file, except that owner
read/write permission is added (otherwise, perltidy could not be
rerun). Html output files use system defaults. Previously chmod 0755
was used in all cases. Thanks to Mark Olesen for bringing this up.
-Missing semicolons will not be added in multi-line blocks of type
sort, map, or grep. This brings perltidy into closer agreement
with common practice. Of course, you can still put semicolons
there if you like. Thanks to Simon Perreault for a discussion of this.
-Most instances of extra semicolons are now deleted. This is
particularly important if the -csc option is used. Thanks to Wolfgang
Weisselberg for noting this. For example, the following line
(produced by 'h2xs' :) has an extra semicolon which will now be
removed:
BEGIN { plan tests => 1 };
-New parameter -csce (--closing-side-comment-else-flag) can be used
to control what text is appended to 'else' and 'elsif' blocks.
Default is to just add leading 'if' text to an 'else'. See manual.
-The -csc option now labels 'else' blocks with additinal information
from the opening if statement and elsif statements, if space.
Thanks to Wolfgang Weisselberg for suggesting this.
-The -csc option will now remove any old closing side comments
below the line interval threshold. Thanks to Wolfgang Weisselberg for
suggesting this.
-The abbreviation feature, which was broken in the previous version,
is now fixed. Thanks to Michael Cartmell for noting this.
-Vertical alignment is now done for '||=' .. somehow this was
overlooked.
2002 02 25
-This version uses modules for the first time, and a standard perl
Makefile.PL has been supplied. However, perltidy may still be
installed as a single script, without modules. See INSTALL for
details.
-The man page 'perl2web' has been merged back into the main 'perltidy'
man page to simplify installation. So you may remove that man page
if you have an older installation.
-Added patch from Axel Rose for MacPerl. The patch prompts the user
for command line arguments before calling the module
Perl::Tidy::perltidy.
-Corrected bug with '-bar' which was introduced in the previous
version. A closing block brace was being indented. Thanks to
Alexandros M Manoussakis for reporting this.
-New parameter '--entab-leading-whitespace=n', or '-et=n', has been
added for those who prefer tabs. This behaves different from the
existing '-t' parameter; see updated man page. Suggested by Mark
Olesen.
-New parameter '--perl-syntax-check-flags=s' or '-pcsf=s' can be
used to change the flags passed to perltidy in a syntax check.
See updated man page. Suggested by Mark Olesen.
-New parameter '--output-path=s' or '-opath=s' will cause output
files to be placed in directory s. See updated man page. Thanks for
Mark Olesen for suggesting this.
-New parameter --dump-profile (or -dpro) will dump to
standard output information about the search for a
configuration file, the name of whatever configuration file
is selected, and its contents. This should help debugging
config files, especially on different Windows systems.
-The -w parameter now notes possible errors of the form:
$comment = s/^\s*(\S+)\..*/$1/; # trim whitespace
-Corrections added for a leading ':' and for leaving a leading 'tcsh'
line untouched. Mark Olesen reported that lines of this form were
accepted by perl but not by perltidy:
: # use -*- perl -*-
eval 'exec perl -wS $0 "$@"' # shell should exec 'perl'
unless 1; # but Perl should skip this one
Perl will silently swallow a leading colon on line 1 of a
script, and now perltidy will do likewise. For example,
this is a valid script, provided that it is the first line,
but not otherwise:
: print "Hello World\n";
Also, perltidy will now mark a first line with leading ':' followed by
'#' as type SYSTEM (just as a #! line), not to be formatted.
-List formatting improved for certain lists with special
initial terms, such as occur with 'printf', 'sprintf',
'push', 'pack', 'join', 'chmod'. The special initial term is
now placed on a line by itself. For example, perltidy -gnu
OLD:
$Addr = pack(
"C4", hex($SourceAddr[0]),
hex($SourceAddr[1]), hex($SourceAddr[2]),
hex($SourceAddr[3])
);
NEW:
$Addr = pack("C4",
hex($SourceAddr[0]), hex($SourceAddr[1]),
hex($SourceAddr[2]), hex($SourceAddr[3]));
OLD:
push (
@{$$self{states}}, '64', '66', '68',
'70', '72', '74', '76',
'78', '80', '82', '84',
'86', '88', '90', '92',
'94', '96', '98', '100',
'102', '104'
);
NEW:
push (
@{$$self{states}},
'64', '66', '68', '70', '72', '74', '76',
'78', '80', '82', '84', '86', '88', '90',
'92', '94', '96', '98', '100', '102', '104'
);
-Lists of complex items, such as matricies, are now detected
and displayed with just one item per row:
OLD:
$this->{'CURRENT'}{'gfx'}{'MatrixSkew'} = Text::PDF::API::Matrix->new(
[ 1, tan( deg2rad($a) ), 0 ], [ tan( deg2rad($b) ), 1, 0 ],
[ 0, 0, 1 ]
);
NEW:
$this->{'CURRENT'}{'gfx'}{'MatrixSkew'} = Text::PDF::API::Matrix->new(
[ 1, tan( deg2rad($a) ), 0 ],
[ tan( deg2rad($b) ), 1, 0 ],
[ 0, 0, 1 ]
);
-The perl syntax check will be turned off for now when input is from
standard input or standard output. The reason is that this requires
temporary files, which has produced far too many problems during
Windows testing. For example, the POSIX module under Windows XP/2000
creates temporary names in the root directory, to which only the
administrator should have permission to write.
-Merged patch sent by Yves Orton to handle appropriate
configuration file locations for different Windows varieties
(2000, NT, Me, XP, 95, 98).
-Added patch to properly handle a for/foreach loop without
parens around a list represented as a qw. I didn't know this
was possible until Wolfgang Weisselberg pointed it out:
foreach my $key qw\Uno Due Tres Quadro\ {
print "Set $key\n";
}
But Perl will give a syntax error without the $ variable; ie this will
not work:
foreach qw\Uno Due Tres Quadro\ {
print "Set $_\n";
}
-Merged Windows version detection code sent by Yves Orton. Perltidy
now automatically turns off syntax checking for Win 9x/ME versions,
and this has solved a lot of robustness problems. These systems
cannot reliably handle backtick operators. See man page for
details.
-Merged VMS filename handling patch sent by Michael Cartmell. (Invalid
output filenames were being created in some cases).
-Numerous minor improvements have been made for -lp style indentation.
-Long C-style 'for' expressions will be broken after each ';'.
'perltidy -gnu' gives:
OLD:
for ($status = $db->seq($key, $value, R_CURSOR()) ; $status == 0
and $key eq $origkey ; $status = $db->seq($key, $value, R_NEXT()))
NEW:
for ($status = $db->seq($key, $value, R_CURSOR()) ;
$status == 0 and $key eq $origkey ;
$status = $db->seq($key, $value, R_NEXT()))
-For the -lp option, a single long term within parens
(without commas) now has better alignment. For example,
perltidy -gnu
OLD:
$self->throw("Must specify a known host, not $location,"
. " possible values ("
. join (",", sort keys %hosts) . ")");
NEW:
$self->throw("Must specify a known host, not $location,"
. " possible values ("
. join (",", sort keys %hosts) . ")");
2001 12 31
-This version is about 20 percent faster than the previous
version as a result of optimization work. The largest gain
came from switching to a dispatch hash table in the
tokenizer.
-perltidy -html will check to see if HTML::Entities is
installed, and if so, it will use it to encode unsafe
characters.
-Added flag -oext=ext to change the output file extension to
be different from the default ('tdy' or 'html'). For
example:
perltidy -html -oext=htm filename
will produce filename.htm
-Added flag -cscw to issue warnings if a closing side comment would replace
an existing, different side comments. See the man page for details.
Thanks to Peter Masiar for helpful discussions.
-Corrected tokenization error of signed hex/octal/binary numbers. For
example, the first hex number below would have been parsed correctly
but the second one was not:
if ( ( $tmp >= 0x80_00_00 ) || ( $tmp < -0x80_00_00 ) ) { }
-'**=' was incorrectly tokenized as '**' and '='. This only
caused a problem with the -extrude opton.
-Corrected a divide by zero when -extrude option is used
-The flag -w will now contain all errors reported by 'perl -c' on the
input file, but otherwise they are not reported. The reason is that
perl will report lots of problems and syntax errors which are not of
interest when only a small snippet is being formatted (such as missing
modules and unknown bare words). Perltidy will always report all
significant syntax errors that it finds, such as unbalanced braces,
unless the -q (quiet) flag is set.
-Merged modifications created by Hugh Myers into perltidy.
These include a 'streamhandle' routine which allows perltidy
as a module to operate on input and output arrays and strings
in addition to files. Documentation and new packaging as a
module should be ready early next year; This is an elegant,
powerful update; many thanks to Hugh for contributing it.
2001 11 28
-added a tentative patch which tries to keep any existing breakpoints
at lines with leading keywords map,sort,eval,grep. The idea is to
improve formatting of sequences of list operations, as in a schwartzian
transform. Example:
INPUT:
my @sorted = map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [ $_, rand ] } @list;
OLD:
my @sorted =
map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, rand ] } @list;
NEW:
my @sorted = map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [ $_, rand ] } @list;
The new alignment is not as nice as the input, but this is an improvement.
Thanks to Yves Orton for this suggestion.
-modified indentation logic so that a line with leading opening paren,
brace, or square bracket will never have less indentation than the
line with the corresponding opening token. Here's a simple example:
OLD:
$mw->Button(
-text => "New Document",
-command => \&new_document
)->pack(
-side => 'bottom',
-anchor => 'e'
);
Note how the closing ');' is lined up with the first line, even
though it closes a paren in the 'pack' line. That seems wrong.
NEW:
$mw->Button(
-text => "New Document",
-command => \&new_document
)->pack(
-side => 'bottom',
-anchor => 'e'
);
This seems nicer: you can up-arrow with an editor and arrive at the
opening 'pack' line.
-corrected minor glitch in which cuddled else (-ce) did not get applied
to an 'unless' block, which should look like this:
unless ($test) {
} else {
}
Thanks to Jeremy Mates for reporting this.
-The man page has been reorganized to parameters easier to find.
-Added check for multiple definitions of same subroutine. It is easy
to introduce this problem when cutting and pasting. Perl does not
complain about it, but it can lead to disaster.
-The command -pro=filename or -profile=filename may be used to specify a
configuration file which will override the default name of .perltidyrc.
There must not be a space on either side of the '=' sign. I needed
this to be able to easily test perltidy with a variety of different
configuration files.
-Side comment alignment has been improved somewhat across frequent level
changes, as in short if/else blocks. Thanks to Wolfgang Weisselberg
for pointing out this problem. For example:
OLD:
if ( ref $self ) { # Called as a method
$format = shift;
}
else { # Regular procedure call
$format = $self;
undef $self;
}
NEW:
if ( ref $self ) { # Called as a method
$format = shift;
}
else { # Regular procedure call
$format = $self;
undef $self;
}
-New command -ssc (--static-side-comment) and related command allows
side comments to be spaced close to preceding character. This is
useful for displaying commented code as side comments.
-New command -csc (--closing-side-comment) and several related
commands allow comments to be added to (and deleted from) any or all
closing block braces. This can be useful if you have to maintain large
programs, especially those that you didn't write. See updated man page.
Thanks to Peter Masiar for this suggestion. For a simple example:
perltidy -csc
sub foo {
if ( !defined( $_[0] ) ) {
print("Hello, World\n");
}
else {
print( $_[0], "\n" );
}
} ## end sub foo
This added '## end sub foo' to the closing brace.
To remove it, perltidy -ncsc.
-New commands -ola, for outdenting labels, and -okw, for outdenting
selected control keywords, were implemented. See the perltidy man
page for details. Thanks to Peter Masiar for this suggestion.
-Hanging side comment change: a comment will not be considered to be a
hanging side comment if there is no leading whitespace on the line.
This should improve the reliability of identifying hanging side comments.
Thanks to Peter Masiar for this suggestion.
-Two new commands for outdenting, -olq (outdent-long-quotes) and -olc
(outdent-long-comments), have been added. The original -oll
(outdent-long-lines) remains, and now is an abbreviation for -olq and -olc.
The new default is just -olq. This was necessary to avoid inconsistency with
the new static block comment option.
-Static block comments: to provide a way to display commented code
better, the convention is used that comments with a leading '##' should
not be formatted as usual. Please see '-sbc' (or '--static-block-comment')
for documentation. It can be deactivated with with -nsbc, but
should not normally be necessary. Thanks to Peter Masiar for this
suggestion.
-Two changes were made to help show structure of complex lists:
(1) breakpoints are forced after every ',' in a list where any of
the list items spans multiple lines, and
(2) List items which span multiple lines now get continuation indentation.
The following example illustrates both of these points. Many thanks to
Wolfgang Weisselberg for this snippet and a discussion of it; this is a
significant formatting improvement. Note how it is easier to see the call
parameters in the NEW version:
OLD:
assert( __LINE__, ( not defined $check )
or ref $check
or $check eq "new"
or $check eq "old", "Error in parameters",
defined $old_new ? ( ref $old_new ? ref $old_new : $old_new ) : "undef",
defined $db_new ? ( ref $db_new ? ref $db_new : $db_new ) : "undef",
defined $old_db ? ( ref $old_db ? ref $old_db : $old_db ) : "undef" );
NEW:
assert(
__LINE__,
( not defined $check )
or ref $check
or $check eq "new"
or $check eq "old",
"Error in parameters",
defined $old_new ? ( ref $old_new ? ref $old_new : $old_new ) : "undef",
defined $db_new ? ( ref $db_new ? ref $db_new : $db_new ) : "undef",
defined $old_db ? ( ref $old_db ? ref $old_db : $old_db ) : "undef"
);
Another example shows how this helps displaying lists:
OLD:
%{ $self->{COMPONENTS} } = (
fname =>
{ type => 'name', adj => 'yes', font => 'Helvetica', 'index' => 0 },
street =>
{ type => 'road', adj => 'yes', font => 'Helvetica', 'index' => 2 },
);
The structure is clearer with the added indentation:
NEW:
%{ $self->{COMPONENTS} } = (
fname =>
{ type => 'name', adj => 'yes', font => 'Helvetica', 'index' => 0 },
street =>
{ type => 'road', adj => 'yes', font => 'Helvetica', 'index' => 2 },
);
-The structure of nested logical expressions is now displayed better.
Thanks to Wolfgang Weisselberg for helpful discussions. For example,
note how the status of the final 'or' is displayed in the following:
OLD:
return ( !null($op)
and null( $op->sibling )
and $op->ppaddr eq "pp_null"
and class($op) eq "UNOP"
and ( ( $op->first->ppaddr =~ /^pp_(and|or)$/
and $op->first->first->sibling->ppaddr eq "pp_lineseq" )
or ( $op->first->ppaddr eq "pp_lineseq"
and not null $op->first->first->sibling
and $op->first->first->sibling->ppaddr eq "pp_unstack" ) ) );
NEW:
return (
!null($op)
and null( $op->sibling )
and $op->ppaddr eq "pp_null"
and class($op) eq "UNOP"
and (
(
$op->first->ppaddr =~ /^pp_(and|or)$/
and $op->first->first->sibling->ppaddr eq "pp_lineseq"
)
or ( $op->first->ppaddr eq "pp_lineseq"
and not null $op->first->first->sibling
and $op->first->first->sibling->ppaddr eq "pp_unstack" )
)
);
-A break will always be put before a list item containing a comma-arrow.
This will improve formatting of mixed lists of this form:
OLD:
$c->create(
'text', 225, 20, -text => 'A Simple Plot',
-font => $font,
-fill => 'brown'
);
NEW:
$c->create(
'text', 225, 20,
-text => 'A Simple Plot',
-font => $font,
-fill => 'brown'
);
-For convenience, the command -dac (--delete-all-comments) now also
deletes pod. Likewise, -tac (--tee-all-comments) now also sends pod
to a '.TEE' file. Complete control over the treatment of pod and
comments is still possible, as described in the updated help message
and man page.
-The logic which breaks open 'containers' has been rewritten to be completely
symmetric in the following sense: if a line break is placed after an opening
{, [, or (, then a break will be placed before the corresponding closing
token. Thus, a container either remains closed or is completely cracked
open.
-Improved indentation of parenthesized lists. For example,
OLD:
$GPSCompCourse =
int(
atan2( $GPSTempCompLong - $GPSLongitude,
$GPSLatitude - $GPSTempCompLat ) * 180 / 3.14159265 );
NEW:
$GPSCompCourse = int(
atan2(
$GPSTempCompLong - $GPSLongitude,
$GPSLatitude - $GPSTempCompLat
) * 180 / 3.14159265
);
Further improvements will be made in future releases.
-Some improvements were made in formatting small lists.
-Correspondence between Input and Output line numbers reported in a
.LOG file should now be exact. They were sometimes off due to the size
of intermediate buffers.
-Corrected minor tokenization error in which a ';' in a foreach loop
control was tokenized as a statement termination, which forced a
line break:
OLD:
foreach ( $i = 0;
$i <= 10;
$i += 2
)
{
print "$i ";
}
NEW:
foreach ( $i = 0 ; $i <= 10 ; $i += 2 ) {
print "$i ";
}
-Corrected a problem with reading config files, in which quote marks were not
stripped. As a result, something like -wba="&& . || " would have the leading
quote attached to the && and not work correctly. A workaround for older
versions is to place a space around all tokens within the quotes, like this:
-wba=" && . || "
-Removed any existing space between a label and its ':'
OLD : { }
NEW: { }
This was necessary because the label and its colon are a single token.
-Corrected tokenization error for the following (highly non-recommended)
construct:
$user = @vars[1] / 100;
-Resolved cause of a difference between perltidy under perl v5.6.1 and
5.005_03; the problem was different behavior of \G regex position
marker(!)
2001 10 20
-Corrected a bug in which a break was not being made after a full-line
comment within a short eval/sort/map/grep block. A flag was not being
zeroed. The syntax error check catches this. Here is a snippet which
illustrates the bug:
eval {
#open Socket to Dispatcher
$sock = &OpenSocket;
};
The formatter mistakenly thought that it had found the following
one-line block:
eval {#open Socket to Dispatcher$sock = &OpenSocket; };
The patch fixes this. Many thanks to Henry Story for reporting this bug.
-Changes were made to help diagnose and resolve problems in a
.perltidyrc file:
(1) processing of command parameters has been into two separate
batches so that any errors in a .perltidyrc file can be localized.
(2) commands --help, --version, and as many of the --dump-xxx
commands are handled immediately, without any command line processing
at all.
(3) Perltidy will ignore any commands in the .perltidyrc file which
cause immediate exit. These are: -h -v -ddf -dln -dop -dsn -dtt
-dwls -dwrs -ss. Thanks to Wolfgang Weisselberg for helpful
suggestions regarding these updates.
-Syntax check has been reinstated as default for MSWin32 systems. This
way Windows 2000 users will get syntax check by default, which seems
like a better idea, since the number of Win 95/98 systems will be
decreasing over time. Documentation revised to warn Windows 95/98
users about the problem with empty '&1'. Too bad these systems
all report themselves as MSWin32.
2001 10 16
-Fixed tokenization error in which a method call of the form
Module::->new();
got a space before the '::' like this:
Module ::->new();
Thanks to David Holden for reporting this.
-Added -html control over pod text, using a new abbreviation 'pd'. See
updated perl2web man page. The default is to use the color of a comment,
but italicized. Old .css style sheets will need a new line for
.pd to use this. The old color was the color of a string, and there
was no control.
-.css lines are now printed in sorted order.
-Fixed interpolation problem where html files had '$input_file' as title
instead of actual input file name. Thanks to Simon Perreault for finding
this and sending a patch, and also to Tobias Weber.
-Breaks will now have the ':' placed at the start of a line,
one per line by default because this shows logical structure
more clearly. This coding has been completely redone. Some
examples of new ?/: formatting:
OLD:
wantarray ? map( $dir::cwd->lookup($_)->path, @_ ) :
$dir::cwd->lookup( $_[0] )->path;
NEW:
wantarray
? map( $dir::cwd->lookup($_)->path, @_ )
: $dir::cwd->lookup( $_[0] )->path;
OLD:
$a = ( $b > 0 ) ? {
a => 1,
b => 2
} : { a => 6, b => 8 };
NEW:
$a = ( $b > 0 )
? {
a => 1,
b => 2
}
: { a => 6, b => 8 };
OLD: (-gnu):
$self->note($self->{skip} ? "Hunk #$self->{hunk} ignored at 1.\n" :
"Hunk #$self->{hunk} failed--$@");
NEW: (-gnu):
$self->note($self->{skip}
? "Hunk #$self->{hunk} ignored at 1.\n"
: "Hunk #$self->{hunk} failed--$@");
OLD:
$which_search =
$opts{"t"} ? 'title' :
$opts{"s"} ? 'subject' : $opts{"a"} ? 'author' : 'title';
NEW:
$which_search =
$opts{"t"} ? 'title'
: $opts{"s"} ? 'subject'
: $opts{"a"} ? 'author'
: 'title';
You can use -wba=':' to recover the previous default which placed ':'
at the end of a line. Thanks to Michael Cartmell for helpful
discussions and examples.
-Tokenizer updated to do syntax checking for matched ?/: pairs. Also,
the tokenizer now outputs a unique serial number for every balanced
pair of brace types and ?/: pairs. This greatly simplifies the
formatter.
-Long lines with repeated 'and', 'or', '&&', '||' will now have
one such item per line. For example:
OLD:
if ( $opt_d || $opt_m || $opt_p || $opt_t || $opt_x
|| ( -e $archive && $opt_r ) )
{
( $pAr, $pNames ) = readAr($archive);
}
NEW:
if ( $opt_d
|| $opt_m
|| $opt_p
|| $opt_t
|| $opt_x
|| ( -e $archive && $opt_r ) )
{
( $pAr, $pNames ) = readAr($archive);
}
OLD:
if ( $vp->{X0} + 4 <= $x && $vp->{X0} + $vp->{W} - 4 >= $x
&& $vp->{Y0} + 4 <= $y && $vp->{Y0} + $vp->{H} - 4 >= $y )
NEW:
if ( $vp->{X0} + 4 <= $x
&& $vp->{X0} + $vp->{W} - 4 >= $x
&& $vp->{Y0} + 4 <= $y
&& $vp->{Y0} + $vp->{H} - 4 >= $y )
-Long lines with multiple concatenated tokens will have concatenated
terms (see below) placed one per line, except for short items. For
example:
OLD:
$report .=
"Device type:" . $ib->family . " ID:" . $ib->serial . " CRC:"
. $ib->crc . ": " . $ib->model() . "\n";
NEW:
$report .= "Device type:"
. $ib->family . " ID:"
. $ib->serial . " CRC:"
. $ib->model()
. $ib->crc . ": " . "\n";
NOTE: at present 'short' means 8 characters or less. There is a
tentative flag to change this (-scl), but it is undocumented and
is likely to be changed or removed later, so only use it for testing.
In the above example, the tokens " ID:", " CRC:", and "\n" are below
this limit.
-If a line which is short enough to fit on a single line was
nevertheless broken in the input file at a 'good' location (see below),
perltidy will try to retain a break. For example, the following line
will be formatted as:
open SUM, "<$file"
or die "Cannot open $file ($!)";
if it was broken in the input file, and like this if not:
open SUM, "<$file" or die "Cannot open $file ($!)";
GOOD: 'good' location means before 'and','or','if','unless','&&','||'
The reason perltidy does not just always break at these points is that if
there are multiple, similar statements, this would preclude alignment. So
rather than check for this, perltidy just tries to follow the input style,
in the hopes that the author made a good choice. Here is an example where
we might not want to break before each 'if':
($Locale, @Locale) = ($English, @English) if (@English > @Locale);
($Locale, @Locale) = ($German, @German) if (@German > @Locale);
($Locale, @Locale) = ($French, @French) if (@French > @Locale);
($Locale, @Locale) = ($Spanish, @Spanish) if (@Spanish > @Locale);
-Added wildcard file expansion for systems with shells which lack this.
Now 'perltidy *.pl' should work under MSDOS/Windows. Thanks to Hugh Myers
for suggesting this. This uses builtin glob() for now; I may change that.
-Added new flag -sbl which, if specified, overrides the value of -bl
for opening sub braces. This allows formatting of this type:
perltidy -sbl
sub foo
{
if (!defined($_[0])) {
print("Hello, World\n");
}
else {
print($_[0], "\n");
}
}
Requested by Don Alexander.
-Fixed minor parsing error which prevented a space after a $$ variable
(pid) in some cases. Thanks to Michael Cartmell for noting this.
For example,
old: $$< 700
new: $$ < 700
-Improved line break choices 'and' and 'or' to display logic better.
For example:
OLD:
exists $self->{'build_dir'} and push @e,
"Unwrapped into directory $self->{'build_dir'}";
NEW:
exists $self->{'build_dir'}
and push @e, "Unwrapped into directory $self->{'build_dir'}";
-Fixed error of multiple use of abbreviatioin '-dsc'. -dsc remains
abbreviation for delete-side-comments; -dsm is new abbreviation for
delete-semicolons.
-Corrected and updated 'usage' help routine. Thanks to Slaven Rezic for
noting an error.
-The default for Windows is, for now, not to do a 'perl -c' syntax
check (but -syn will activate it). This is because of problems with
command.com. James Freeman sent me a patch which tries to get around
the problems, and it works in many cases, but testing revealed several
issues that still need to be resolved. So for now, the default is no
syntax check for Windows.
-I added a -T flag when doing perl -c syntax check.
This is because I test it on a large number of scripts from sources
unknown, and who knows what might be hidden in initialization blocks?
Also, deactivated the syntax check if perltidy is run as root. As a
benign example, running the previous version of perltidy on the
following file would cause it to disappear:
BEGIN{
print "Bye, bye baby!\n";
unlink $0;
}
The new version will not let that happen.
-I am contemplating (but have not yet implemented) making '-lp' the
default indentation, because it is stable now and may be closer to how
perl is commonly formatted. This could be in the next release. The
reason that '-lp' was not the original default is that the coding for
it was complex and not ready for the initial release of perltidy. If
anyone has any strong feelings about this, I'd like to hear. The
current default could always be recovered with the '-nlp' flag.
2001 09 03
-html updates:
- sub definition names are now specially colored, red by default.
The letter 'm' is used to identify them.
- keyword 'sub' now has color of other keywords.
- restored html keyword color to __END__ and __DATA__, which was
accidentally removed in the previous version.
-A new -se (--standard-error-output) flag has been implemented and
documented which causes all errors to be written to standard output
instead of a .ERR file.
-A new -w (--warning-output) flag has been implemented and documented
which causes perltidy to output certain non-critical messages to the
error output file, .ERR. These include complaints about pod usage,
for example. The default is to not include these.
NOTE: This replaces an undocumented -w=0 or --warning-level flag
which was tentatively introduced in the previous version to avoid some
unwanted messages. The new default is the same as the old -w=0, so
that is no longer needed.
-Improved syntax checking and corrected tokenization of functions such
as rand, srand, sqrt, ... These can accept either an operator or a term
to their right. This has been corrected.
-Corrected tokenization of semicolon: testing of the previous update showed
that the semicolon in the following statement was being mis-tokenized. That
did no harm, other than adding an extra blank space, but has been corrected.
for (sort {strcoll($a,$b);} keys %investments) {
...
}
-New syntax check: after wasting 5 minutes trying to resolve a syntax
error in which I had an extra terminal ';' in a complex for (;;) statement,
I spent a few more minutes adding a check for this in perltidy so it won't
happen again.
-The behavior of --break-before-subs (-bbs) and --break-before-blocks
(-bbb) has been modified. Also, a new control parameter,
--long-block-line-count=n (-lbl=n) has been introduced to give more
control on -bbb. This was previously a hardwired value. The reason
for the change is to reduce the number of unwanted blank lines that
perltidy introduces, and make it less erratic. It's annoying to remove
an unwanted blank line and have perltidy put it back. The goal is to
be able to sprinkle a few blank lines in that dense script you
inherited from Bubba. I did a lot of experimenting with different
schemes for introducing blank lines before and after code blocks, and
decided that there is no really good way to do it. But I think the new
scheme is an improvement. You can always deactivate this with -nbbb.
I've been meaning to work on this; thanks to Erik Thaysen for bringing
it to my attention.
-The .LOG file is seldom needed, and I get tired of deleting them, so
they will now only be automatically saved if perltidy thinks that it
made an error, which is almost never. You can still force the logfile
to be saved with -log or -g.
-Improved method for computing number of columns in a table. The old
method always tried for an even number. The new method allows odd
numbers when it is obvious that a list is not a hash initialization
list.
old: my (
$name, $xsargs, $parobjs, $optypes,
$hasp2child, $pmcode, $hdrcode, $inplacecode,
$globalnew, $callcopy
)
= @_;
new: my (
$name, $xsargs, $parobjs, $optypes, $hasp2child,
$pmcode, $hdrcode, $inplacecode, $globalnew, $callcopy
)
= @_;
-I fiddled with the list threshold adjustment, and some small lists
look better now. Here is the change for one of the lists in test file
'sparse.t':
old:
%units =
("in", "in", "pt", "pt", "pc", "pi", "mm", "mm", "cm", "cm", "\\hsize", "%",
"\\vsize", "%", "\\textwidth", "%", "\\textheight", "%");
new:
%units = (
"in", "in", "pt", "pt", "pc", "pi",
"mm", "mm", "cm", "cm", "\\hsize", "%",
"\\vsize", "%", "\\textwidth", "%", "\\textheight", "%"
);
-Improved -lp formatting at '=' sign. A break was always being added after
the '=' sign in a statement such as this, (to be sure there was enough room
for the parameters):
old: my $fee =
CalcReserveFee(
$env, $borrnum,
$biblionumber, $constraint,
$bibitems
);
The updated version doesn't do this unless the space is really needed:
new: my $fee = CalcReserveFee(
$env, $borrnum,
$biblionumber, $constraint,
$bibitems
);
-I updated the tokenizer to allow $#+ and $#-, which seem to be new to
Perl 5.6. Some experimenting with a recent version of Perl indicated
that it allows these non-alphanumeric '$#' array maximum index
varaibles: $#: $#- $#+ so I updated the parser accordingly. Only $#:
seems to be valid in older versions of Perl.
-Fixed a rare formatting problem with -lp (and -gnu) which caused
excessive indentation.
-Many additional syntax checks have been added.
-Revised method for testing here-doc target strings; the following
was causing trouble with a regex test because of the '*' characters:
print <<"*EOF*";
bla bla
*EOF*
Perl seems to allow almost anything to be a here doc target, so an
exact string comparison is now used.
-Made update to allow underscores in binary numbers, like '0b1100_0000'.
-Corrected problem with scanning certain module names; a blank space was
being inserted after 'warnings' in the following:
use warnings::register;
The problem was that warnings (and a couple of other key modules) were
being tokenized as keywords. They should have just been identifiers.
-Corrected tokenization of indirect objects after sort, system, and exec,
after testing produced an incorrect error message for the following
line of code:
print sort $sortsubref @list;
-Corrected minor problem where a line after a format had unwanted
extra continuation indentation.
-Delete-block-comments (and -dac) now retain any leading hash-bang line
-Update for -lp (and -gnu) to not align the leading '=' of a list
with a previous '=', since this interferes with alignment of parameters.
old: my $hireDay = new Date;
my $self = {
firstName => undef,
lastName => undef,
hireDay => $hireDay
};
new: my $hireDay = new Date;
my $self = {
firstName => undef,
lastName => undef,
hireDay => $hireDay
};
-Modifications made to display tables more compactly when possible,
without adding lines. For example,
old:
'1', "I", '2', "II", '3', "III", '4', "IV",
'5', "V", '6', "VI", '7', "VII", '8', "VIII",
'9', "IX"
new:
'1', "I", '2', "II", '3', "III",
'4', "IV", '5', "V", '6', "VI",
'7', "VII", '8', "VIII", '9', "IX"
-Corrected minor bug in which -pt=2 did not keep the right paren tight
around a '++' or '--' token, like this:
for ($i = 0 ; $i < length $key ; $i++ )
The formatting for this should be, and now is:
for ($i = 0 ; $i < length $key ; $i++)
Thanks to Erik Thaysen for noting this.
-Discovered a new bug involving here-docs during testing! See BUGS.html.
-Finally fixed parsing of subroutine attributes (A Perl 5.6 feature).
However, the attributes and prototypes must still be on the same line
as the sub name.
2001 07 31
-Corrected minor, uncommon bug found during routine testing, in which a
blank got inserted between a function name and its opening paren after
a file test operator, but only in the case that the function had not
been previously seen. Perl uses the existance (or lack thereof) of
the blank to guess if it is a function call. That is,
if (-l pid_filename()) {
became
if (-l pid_filename ()) {
which is a syntax error if pid_filename has not been seen by perl.
-If the AutoLoader module is used, perltidy will continue formatting
code after seeing an __END__ line. Use -nlal to deactivate this feature.
Likewise, if the SelfLoader module is used, perltidy will continue
formatting code after seeing a __DATA__ line. Use -nlsl to
deactivate this feature. Thanks to Slaven Rezic for this suggestion.
-pod text after __END__ and __DATA__ is now identified by perltidy
so that -dp works correctly. Thanks to Slaven Rezic for this suggestion.
-The first $VERSION line which might be eval'd by MakeMaker
is now passed through unchanged. Use -npvl to deactivate this feature.
Thanks to Manfred Winter for this suggestion.
-Improved indentation of nested parenthesized expressions. Tests have
given favorable results. Thanks to Wolfgang Weisselberg for helpful
examples.
2001 07 23
-Fixed a very rare problem in which an unwanted semicolon was inserted
due to misidentification of anonymous hash reference curly as a code
block curly. (No instances of this have been reported; I discovered it
during testing). A workaround for older versions of perltidy is to use
-nasc.
-Added -icb (-indent-closing-brace) parameter to indent a brace which
terminates a code block to the same level as the previous line.
Suggested by Andrew Cutler. For example,
if ($task) {
yyy();
} # -icb
else {
zzz();
}
-Rewrote error message triggered by an unknown bareword in a print or
printf filehandle position, and added flag -w=0 to prevent issuing this
error message. Suggested by Byron Jones.
-Added modification to align a one-line 'if' block with similar
following 'elsif' one-line blocks, like this:
if ( $something eq "simple" ) { &handle_simple }
elsif ( $something eq "hard" ) { &handle_hard }
(Suggested by Wolfgang Weisselberg).
2001 07 02
-Eliminated all constants with leading underscores because perl 5.005_03
does not support that. For example, _SPACES changed to XX_SPACES.
Thanks to kromJx for this update.
2001 07 01
-the directory of test files has been moved to a separate distribution
file because it is getting large but is of little interest to most users.
For the current distribution:
perltidy-20010701.tgz contains the source and docs for perltidy
perltidy-20010701-test.tgz contains the test files
-fixed bug where temporary file perltidy.TMPI was not being deleted
when input was from stdin.
-adjusted line break logic to not break after closing brace of an
eval block (suggested by Boris Zentner).
-added flag -gnu (--gnu-style) to give an approximation to the GNU
style as sometimes applied to perl. The programming style in GNU
'automake' was used as a guide in setting the parameters; these
parameters will probably be adjusted over time.
-an empty code block now has one space for emphasis:
if ( $cmd eq "bg_untested" ) {} # old
if ( $cmd eq "bg_untested" ) { } # new
If this bothers anyone, we could create a parameter.
-the -bt (--brace-tightness) parameter has been split into two
parameters to give more control. -bt now applies only to non-BLOCK
braces, while a new parameter -bbt (block-brace-tightness) applies to
curly braces which contain code BLOCKS. The default value is -bbt=0.
-added flag -icp (--indent-closing-paren) which leaves a statment
termination of the form );, };, or ]; indented with the same
indentation as the previous line. For example,
@month_of_year = ( # default, or -nicp
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
'Nov', 'Dec'
);
@month_of_year = ( # -icp
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',
'Nov', 'Dec'
);
-Vertical alignment updated to synchronize with tokens &&, ||,
and, or, if, unless. Allowable space before forcing
resynchronization has been increased. (Suggested by Wolfgang
Weisselberg).
-html corrected to use -nohtml-bold-xxxxxxx or -nhbx to negate bold,
and likewise -nohtml-italic-xxxxxxx or -nhbi to negate italic. There
was no way to negate these previously. html documentation updated and
corrected. (Suggested by Wolfgang Weisselberg).
-Some modifications have been made which improve the -lp formatting in
a few cases.
-Perltidy now retains or creates a blank line after an =cut to keep
podchecker happy (Suggested by Manfred H. Winter). This appears to be
a glitch in podchecker, but it was annoying.
2001 06 17
-Added -bli flag to give continuation indentation to braces, like this
if ($bli_flag)
{
extra_indentation();
}
-Corrected an error with the tab (-t) option which caused the last line
of a multi-line quote to receive a leading tab. This error was in
version 2001 06 08 but not 2001 04 06. If you formatted a script
with -t with this version, please check it by running once with the
-chk flag and perltidy will scan for this possible error.
-Corrected an invalid pattern (\R should have been just R), changed
$^W =1 to BEGIN {$^W=1} to use warnings in compile phase, and corrected
several unnecessary 'my' declarations. Many thanks to Wolfgang Weisselberg,
2001-06-12, for catching these errors.
-A '-bar' flag has been added to require braces to always be on the
right, even for multi-line if and foreach statements. For example,
the default formatting of a long if statement would be:
if ($bigwasteofspace1 && $bigwasteofspace2
|| $bigwasteofspace3 && $bigwasteofspace4)
{
bigwastoftime();
}
With -bar, the formatting is:
if ($bigwasteofspace1 && $bigwasteofspace2
|| $bigwasteofspace3 && $bigwasteofspace4) {
bigwastoftime();
}
Suggested by Eli Fidler 2001-06-11.
-Uploaded perltidy to sourceforge cvs 2001-06-10.
-An '-lp' flag (--line-up-parentheses) has been added which causes lists
to be indented with extra indentation in the manner sometimes
associated with emacs or the GNU suggestions. Thanks to Ian Stuart for
this suggestion and for extensive help in testing it.
-Subroutine call parameter lists are now formatted as other lists.
This should improve formatting of tables being passed via subroutine
calls. This will also cause full indentation ('-i=n, default n= 4) of
continued parameter list lines rather than just the number of spaces
given with -ci=n, default n=2.
-Added support for hanging side comments. Perltidy identifies a hanging
side comment as a comment immediately following a line with a side
comment or another hanging side comment. This should work in most
cases. It can be deactivated with --no-hanging-side-comments (-nhsc).
The manual has been updated to discuss this. Suggested by Brad
Eisenberg some time ago, and finally implemented.
2001 06 08
-fixed problem with parsing command parameters containing quoted
strings in .perltidyrc files. (Reported by Roger Espel Llima 2001-06-07).
-added two command line flags, --want-break-after and
--want-break-before, which allow changing whether perltidy
breaks lines before or after any operators. Please see the revised
man pages for details.
-added system-wide configuration file capability.
If perltidy does not find a .perltidyrc command line file in
the current directory, nor in the home directory, it now looks
for '/usr/local/etc/perltidyrc' and then for '/etc/perltidyrc'.
(Suggested by Roger Espel Llima 2001-05-31).
-fixed problem in which spaces were trimmed from lines of a multi-line
quote. (Reported by Roger Espel Llima 2001-05-30). This is an
uncommon situation, but serious, because it could conceivably change
the proper function of a script.
-fixed problem in which a semicolon was incorrectly added within
an anonymous hash. (Reported by A.C. Yardley, 2001-5-23).
(You would know if this happened, because perl would give a syntax
error for the resulting script).
-fixed problem in which an incorrect error message was produced
after a version number on a 'use' line, like this ( Reported
by Andres Kroonmaa, 2001-5-14):
use CGI 2.42 qw(fatalsToBrowser);
Other than the extraneous error message, this bug was harmless.
2001 04 06
-fixed serious bug in which the last line of some multi-line quotes or
patterns was given continuation indentation spaces. This may make
a pattern incorrect unless it uses the /x modifier. To find
instances of this error in scripts which have been formatted with
earlier versions of perltidy, run with the -chk flag, which has
been added for this purpose (SLH, 2001-04-05).
** So, please check previously formatted scripts by running with -chk
at least once **
-continuation indentation has been reprogrammed to be hierarchical,
which improves deeply nested structures.
-fixed problem with undefined value in list formatting (reported by Michael
Langner 2001-04-05)
-Switched to graphical display of nesting in .LOG files. If an
old format string was "(1 [0 {2", the new string is "{{(". This
is easier to read and also shows the order of nesting.
-added outdenting of cuddled paren structures, like ")->pack(".
-added line break and outdenting of ')->' so that instead of
$mw->Label(
-text => "perltidy",
-relief => 'ridge')->pack;
the current default is:
$mw->Label(
-text => "perltidy",
-relief => 'ridge'
)->pack;
(requested by Michael Langner 2001-03-31; in the future this could
be controlled by a command-line parameter).
-revised list indentation logic, so that lists following an assignment
operator get one full indentation level, rather than just continuation
indentation. Also corrected some minor glitches in the continuation
indentation logic.
-Fixed problem with unwanted continuation indentation after a blank line
(reported by Erik Thaysen 2001-03-28):
-minor update to avoid stranding a single '(' on one line
2001 03 28:
-corrected serious error tokenizing filehandles, in which a sub call
after a print or printf, like this:
print usage() and exit;
became this:
print usage () and exit;
Unfortunately, this converts 'usage' to a filehandle. To fix this, rerun
perltidy; it will look for this situation and issue a warning.
-fixed another cuddled-else formatting bug (Reported by Craig Bourne)
-added several diagnostic --dump routines
-added token-level whitespace controls (suggested by Hans Ecke)
2001 03 23:
-added support for special variables of the form ${^WANT_BITS}
-space added between scalar and left paren in 'for' and 'foreach' loops,
(suggestion by Michael Cartmell):
for $i( 1 .. 20 ) # old
for $i ( 1 .. 20 ) # new
-html now outputs cascading style sheets (thanks to suggestion from
Hans Ecke)
-flags -o and -st now work with -html
-added missing -html documentation for comments (noted by Alex Izvorski)
-support for VMS added (thanks to Michael Cartmell for code patches and
testing)
-v-strings implemented (noted by Hans Ecke and Michael Cartmell; extensive
testing by Michael Cartmell)
-fixed problem where operand may be empty at line 3970
(\b should be just b in lines 3970, 3973) (Thanks to Erik Thaysen,
Keith Marshall for bug reports)
-fixed -ce bug (cuddled else), where lines like '} else {' were indented
(Thanks to Shawn Stepper and Rick Measham for reporting this)
2001 03 04:
-fixed undefined value in line 153 (only worked with -I set)
(Thanks to Mike Stok, Phantom of the Opcodes, Ian Ehrenwald, and others)
-fixed undefined value in line 1069 (filehandle problem with perl versions <
5.6) (Thanks to Yuri Leikind, Mike Stok, Michael Holve, Jeff Kolber)
2001 03 03:
-Initial announcement at freshmeat.net; started Change Log
(Unfortunately this version was DOA, but it was fixed the next day)