From: Steve Hancock Date: Tue, 22 Sep 2020 19:12:07 +0000 (-0700) Subject: added note about whitespace control issues; update docs X-Git-Tag: 20201001~15 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7c2e9b6bc2e7d9b6cecb6f81098d34433365e121;p=perltidy.git added note about whitespace control issues; update docs --- diff --git a/bin/perltidy b/bin/perltidy index 4c0a4097..12d6a3f4 100755 --- a/bin/perltidy +++ b/bin/perltidy @@ -1141,7 +1141,7 @@ and look at the .DEBUG file to see the tokenization. B Be sure to put these tokens in quotes to avoid having them misinterpreted by your command shell. -=item Note: Perltidy does always follow whitespace controls +=item Note1: Perltidy does always follow whitespace controls The various parameters controlling whitespace within a program are requests which perltidy follows as well as possible, but there are a number of situations where changing whitespace could change program behavior and is not done. Some of these are obvious; for example, we should not remove the space between the two plus symbols in '$x+ +$y' to avoid creating a '++' operator. Some are more subtle and involve the whitespace around bareword symbols and locations of possible filehandles. For example, consider the problem of formatting the following subroutine: @@ -1161,6 +1161,25 @@ If formatted in this way, the program will not run (at least with recent version Related issues arise with other binary operator symbols, such as + and -, and in older versions of perl there could be problems with ternary operators. So to avoid changing program behavior, perltidy has the simple rule that whitespace around possible filehandles is left unchanged. Likewise, whitespace around barewords is left unchanged. The reason is that if the barewords are defined in other modules, or in code that has not even been written yet, perltidy will not have seen their prototypes and must treat them cautiously. +=item Note2: Perltidy's whitespace rules are not perfect + +Despite these precautions, it is still possible to introduce syntax errors with +some asymmetric whitespace rules, particularly when call parameters are not +placed in containg parens or braces. For example, the following two lines will +be parsed by perl without a syntax error: + + # original programming, syntax ok + my @newkeys = map $_-$nrecs+@data, @oldkeys; + + # perltidy default, syntax ok + my @newkeys = map $_ - $nrecs + @data, @oldkeys; + +But the following will give a syntax error: + + # perltidy -nwrs='-' + my @newkeys = map $_ -$nrecs + @data, @oldkeys; + + =item Space between specific keywords and opening paren When an opening paren follows a Perl keyword, no space is introduced after the diff --git a/docs/BugLog.html b/docs/BugLog.html index 30b1a49d..25494409 100644 --- a/docs/BugLog.html +++ b/docs/BugLog.html @@ -21,6 +21,12 @@
+
If an =cut starts a POD section within code, give a warning
+
+ +

Previously only a complaint was given, which went into the log file and was not normally seen. Perl silently accepts this but it can cause significant problems with pod utilities, so a clear warning is better. This situation arose in testing on random files in combination with a -dp flag and it took some time to understand the results because of the lack of a warning.

+ +
Switched from using an eval block to the -can() function for sub finish_formatting>
diff --git a/docs/ChangeLog.html b/docs/ChangeLog.html index ebd4ac6d..247b8b18 100644 --- a/docs/ChangeLog.html +++ b/docs/ChangeLog.html @@ -10,9 +10,13 @@ opening container token of a multiple-line list. Related new parameters -bbhbi=n, -bbsbi=n, -bbpi=n control indentation of these tokens. +- Added keyword 'isa'. + - Numerous issues have been found during automated testing and fixed. Many involve references to uninitialized variables when perltidy is given random text. A complete list is given in - the file 'BugLog.pod'. + the file + + https://github.com/perltidy/perltidy/blob/master/local-docs/BugLog.pod

2020 09 07

diff --git a/docs/perltidy.html b/docs/perltidy.html index bc17a8b9..f5887ec8 100644 --- a/docs/perltidy.html +++ b/docs/perltidy.html @@ -876,7 +876,7 @@

WARNING Be sure to put these tokens in quotes to avoid having them misinterpreted by your command shell.

-
Note: Perltidy does always follow whitespace controls
+
Note1: Perltidy does always follow whitespace controls

The various parameters controlling whitespace within a program are requests which perltidy follows as well as possible, but there are a number of situations where changing whitespace could change program behavior and is not done. Some of these are obvious; for example, we should not remove the space between the two plus symbols in '$x+ +$y' to avoid creating a '++' operator. Some are more subtle and involve the whitespace around bareword symbols and locations of possible filehandles. For example, consider the problem of formatting the following subroutine:

@@ -897,6 +897,23 @@

Related issues arise with other binary operator symbols, such as + and -, and in older versions of perl there could be problems with ternary operators. So to avoid changing program behavior, perltidy has the simple rule that whitespace around possible filehandles is left unchanged. Likewise, whitespace around barewords is left unchanged. The reason is that if the barewords are defined in other modules, or in code that has not even been written yet, perltidy will not have seen their prototypes and must treat them cautiously.

+
+
Note2: Perltidy's whitespace rules are not perfect
+
+ +

Despite these precautions, it is still possible to introduce syntax errors with some asymmetric whitespace rules, particularly when call parameters are not placed in containg parens or braces. For example, the following two lines will be parsed by perl without a syntax error:

+ +
  # original programming, syntax ok
+  my @newkeys = map $_-$nrecs+@data, @oldkeys;
+
+  # perltidy default, syntax ok
+  my @newkeys = map $_ - $nrecs + @data, @oldkeys;
+ +

But the following will give a syntax error:

+ +
  # perltidy -nwrs='-'
+  my @newkeys = map $_ -$nrecs + @data, @oldkeys;
+
Space between specific keywords and opening paren