## 2017 05 21
- Fixed debian #862667: failure to check for perltidy.ERR deletion can lead
- to overwriting abritrary files by symlink attack. Perltidy was continuing
+ to overwriting arbitrary files by symlink attack. Perltidy was continuing
to write files after an unlink failure. Thanks to Don Armstrong
for a patch.
with --backup-and-modify-in-place. Thanks to Heinz Knutzen for this patch.
- Fixed minor formatting issue where one-line blocks for subs with signatures
- were unnecesarily broken
+ were unnecessarily broken
- RT #32905, patch to fix utf-8 error when output was STDOUT.
- Fixed RT #107832 and #106492, lack of vertical alignment of two lines
when -boc flag (break at old commas) is set. This bug was
- inadvertantly introduced in previous bug fix RT #98902.
+ inadvertently introduced in previous bug fix RT #98902.
- Some common extensions to Perl syntax are handled better.
In particular, the following snippet is now foratted cleanly:
- Fixed RT #96101; Closing brace of anonymous sub in a list was being
indented. For example, the closing brace of the anonymous sub below
will now be lined up with the word 'callback'. This problem
- occured if there was no comma after the closing brace of the anonymous sub.
+ occurred if there was no comma after the closing brace of the anonymous sub.
This update may cause minor changes to formatting of code with lists
of anonymous subs, especially TK code.
: undef;
-Text following un-parenthesized if/unless/while/until statements get a
- full level of indentation. Suggested by Jeff Armstorng and others.
+ full level of indentation. Suggested by Jeff Armstrong and others.
OLD:
return $ship->chargeWeapons("phaser-canon")
if $encounter->description eq 'klingon'
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
+ -Output file permissions 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
-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 $#:
+ variables: $#: $#- $#+ 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
flexibility, the following convention is used in all cases to decide if
a leading '.' should be used. If the extension C<ext> begins with
C<A-Z>, C<a-z>, or C<0-9>, then it will be appended to the filename with
-an intermediate '.' (or perhaps an '_' on VMS systems). Otherwise, it
+an intermediate '.' (or perhaps a '_' on VMS systems). Otherwise, it
will be appended directly.
For example, suppose the file is F<somefile.pl>. For C<-bext=old>, a '.' is
A Development VERSION is (Last Release).(Development Number)
The Development Number is a 2 digit number starting at 01 after a release is
-continually bumped along at significant points during developement.
+continually bumped along at significant points during development.
The VERSION reported by Perl::Tidy.pm is '$reported_VERSION'
What would you like to do?
<h2>2017 05 21</h2>
<pre><code>- Fixed debian #862667: failure to check for perltidy.ERR deletion can lead
- to overwriting abritrary files by symlink attack. Perltidy was continuing
+ to overwriting arbitrary files by symlink attack. Perltidy was continuing
to write files after an unlink failure. Thanks to Don Armstrong
for a patch.
with --backup-and-modify-in-place. Thanks to Heinz Knutzen for this patch.
- Fixed minor formatting issue where one-line blocks for subs with signatures
- were unnecesarily broken
+ were unnecessarily broken
- RT #32905, patch to fix utf-8 error when output was STDOUT.
- Fixed RT #107832 and #106492, lack of vertical alignment of two lines
when -boc flag (break at old commas) is set. This bug was
- inadvertantly introduced in previous bug fix RT #98902.
+ inadvertently introduced in previous bug fix RT #98902.
- Some common extensions to Perl syntax are handled better.
In particular, the following snippet is now foratted cleanly:
- Fixed RT #96101; Closing brace of anonymous sub in a list was being
indented. For example, the closing brace of the anonymous sub below
will now be lined up with the word 'callback'. This problem
- occured if there was no comma after the closing brace of the anonymous sub.
+ occurred if there was no comma after the closing brace of the anonymous sub.
This update may cause minor changes to formatting of code with lists
of anonymous subs, especially TK code.
: undef;
-Text following un-parenthesized if/unless/while/until statements get a
-full level of indentation. Suggested by Jeff Armstorng and others.
+full level of indentation. Suggested by Jeff Armstrong and others.
OLD:
return $ship->chargeWeapons("phaser-canon")
if $encounter->description eq 'klingon'
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
+-Output file permissions 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
-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 $#:
+variables: $#: $#- $#+ 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
<h2 id="Specifying-File-Extensions">Specifying File Extensions</h2>
-<p>Several parameters allow default file extensions to be overridden. For example, a backup file extension may be specified with <b>-bext=ext</b>, where <b>ext</b> is some new extension. In order to provides the user some flexibility, the following convention is used in all cases to decide if a leading '.' should be used. If the extension <code>ext</code> begins with <code>A-Z</code>, <code>a-z</code>, or <code>0-9</code>, then it will be appended to the filename with an intermediate '.' (or perhaps an '_' on VMS systems). Otherwise, it will be appended directly.</p>
+<p>Several parameters allow default file extensions to be overridden. For example, a backup file extension may be specified with <b>-bext=ext</b>, where <b>ext</b> is some new extension. In order to provides the user some flexibility, the following convention is used in all cases to decide if a leading '.' should be used. If the extension <code>ext</code> begins with <code>A-Z</code>, <code>a-z</code>, or <code>0-9</code>, then it will be appended to the filename with an intermediate '.' (or perhaps a '_' on VMS systems). Otherwise, it will be appended directly.</p>
<p>For example, suppose the file is <i>somefile.pl</i>. For <code>-bext=old</code>, a '.' is added to give <i>somefile.pl.old</i>. For <code>-bext=.old</code>, no additional '.' is added, so again the backup file is <i>somefile.pl.old</i>. For <code>-bext=~</code>, then no dot is added, and the backup file will be <i>somefile.pl~</i> .</p>
<pre><code> perltidy *.pl</code></pre>
-<p>and in this case, each of the output files will be have a name equal to the input file with the extension <i>.tdy</i> appended. If you decide that the formatting is acceptable, you will want to backup your originals and then remove the <i>.tdy</i> extensions from the reformatted files. There is an powerful perl script called <code>rename</code> that can be used for this purpose; if you don't have it, you can find it for example in <b>The Perl Cookbook</b>.</p>
+<p>and in this case, each of the output files will be have a name equal to the input file with the extension <i>.tdy</i> appended. If you decide that the formatting is acceptable, you will want to backup your originals and then remove the <i>.tdy</i> extensions from the reformatted files. There is a powerful perl script called <code>rename</code> that can be used for this purpose; if you don't have it, you can find it for example in <b>The Perl Cookbook</b>.</p>
<p>If you find that the formatting done by perltidy is usually acceptable, you may want to save some effort by letting perltidy do a simple backup of the original files and then reformat them in place. You specify this with a <b>-b</b> flag. For example, the command</p>
# To make the number continually increasing, the Development Number is a 2
# digit number starting at 01 after a release is continually bumped along
- # at significant points during developement. If it ever reaches 99 then the
+ # at significant points during development. If it ever reaches 99 then the
# Release version must be bumped, and it is probably past time for a
# release anyway.
Basic Options:
-i=n use n columns per indentation level (default n=4)
- -t tabs: use one tab character per indentation level, not recommeded
+ -t tabs: use one tab character per indentation level, not recommended
-nt no tabs: use n spaces per indentation level (default)
-et=n entab leading whitespace n spaces per tab; not recommended
-io "indent only": just do indentation, no other formatting.
# Scan all lines looking for runs of consecutive lines beginning with
# selected keywords. Example keywords are 'my', 'our', 'local', ... but
# they may be anything. We will set flags requesting that blanks be
- # inserted around and withing them according to input parameters. Note
+ # inserted around and within them according to input parameters. Note
# that we are scanning the lines as they came in in the input stream, so
# they are not necessarily well formatted.
# undo continuation indentation of a terminal closing token if
# it is the last token before a level decrease. This will allow
# a closing token to line up with its opening counterpart, and
- # avoids a indentation jump larger than 1 level.
+ # avoids an indentation jump larger than 1 level.
if ( $types_to_go[$i_terminal] =~ /^[\}\]\)R]$/
&& $i_terminal == $ibeg
&& defined($K_beg) )
# RT #104427: Dont break before opening sub brace because
# sub block breaks handled at higher level, unless
- # it looks like the preceeding list is long and broken
+ # it looks like the preceding list is long and broken
&& !(
$next_nonblank_block_type =~ /^sub\b/
&& ( $nesting_depth_to_go[$i_begin] ==
sub tentatively_decrease_available_spaces {
# We are asked to tentatively delete $spaces_needed of indentation
- # for a indentation item. We may want to undo this later. NOTE: if
+ # for an indentation item. We may want to undo this later. NOTE: if
# there are child nodes, their total SPACES must be reduced by the
# caller.
my ( $item, $spaces_needed ) = @_;
$attrs = $2;
# If we also found the sub name on this call then append PROTO.
- # This is not necessary but for compatability with previous
+ # This is not necessary but for compatibility with previous
# versions when the -csc flag is used:
if ( $match && $proto ) {
$tok .= $proto;
sub is_deletable_token {
- # Determine if an token with no match possibility can be removed to
+ # Determine if a token with no match possibility can be removed to
# improve chances of making an alignment.
my ( $token, $i, $imax, $jline, $i_eq ) = @_;
the input file with the extension F<.tdy> appended. If you decide that
the formatting is acceptable, you will want to backup your originals and
then remove the F<.tdy> extensions from the reformatted files. There is
-an powerful perl script called C<rename> that can be used for this
+a powerful perl script called C<rename> that can be used for this
purpose; if you don't have it, you can find it for example in B<The Perl
Cookbook>.