]> git.donarmstrong.com Git - perltidy.git/commitdiff
add 'ref' to a hash to fix git #32, misparse of a ? as quote delimiter
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 24 Jun 2020 13:17:19 +0000 (06:17 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 24 Jun 2020 13:17:19 +0000 (06:17 -0700)
bin/perltidy
lib/Perl/Tidy/Tokenizer.pm

index 7b795f2395e851c5b905942645127f314f956240..07b43704ae0fa42ffd53825ff5fb8268305db146 100755 (executable)
@@ -1100,7 +1100,7 @@ Suppose the user requests that / signs have a space to the left but not to the r
        print $x /$y;
    }
 
-If formatted in this way, the program will not run (at least with recent versions of perl) because the $x is taken to be a filehandle and / is assumed to start a quote. In a complex program, there might happen to be a / which terminates the multiline quote without a syntax error, allowing the program to run, but incorrectly.
+If formatted in this way, the program will not run (at least with recent versions of perl) because the $x is taken to be a filehandle and / is assumed to start a quote. In a complex program, there might happen to be a / which terminates the multiline quote without a syntax error, allowing the program to run, but not as intended.
 
 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.
 
index 2e15f75a617015fae5c877ad78a26394600fe7d3..74ce6966c17be4bcde9fc726f462865a06d3af76 100644 (file)
@@ -2075,9 +2075,11 @@ sub prepare_for_a_new_file {
             elsif ( $expecting == UNKNOWN ) {
 
                 # In older versions of Perl, a bare ? can be a pattern
-                # delimiter.  Sometime after Perl 5.10 this seems to have
-                # been dropped, but we have to support it in order to format
-                # older programs.  For example, the following line worked
+                # delimiter.  In perl version 5.22 this was
+                # dropped, but we have to support it in order to format
+                # older programs. See:
+                ## https://perl.developpez.com/documentations/en/5.22.0/perl5211delta.html
+                # For example, the following line worked
                 # at one time:
                 #      ?(.*)? && (print $1,"\n");
                 # In current versions it would have to be written with slashes:
@@ -8044,6 +8046,7 @@ BEGIN {
       eval
       lc
       pop
+      ref
       shift
       uc
       undef