From f32553c8b4d5416d702441d4b65e1f942d18df6f Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 27 Sep 2020 11:32:44 -0700 Subject: [PATCH] keep any space between a bareword and quote --- lib/Perl/Tidy/Formatter.pm | 6 +++++- local-docs/BugLog.pod | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 90e60e96..613ddcd8 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -2216,7 +2216,11 @@ EOM # -data => $data; # This is the safest thing to do. If we had the token to the right of # the minus we could do a better check. - || $tokenr eq '-' && $typel eq 'w' + # + # And do not combine a bareword and a quote, like this: + # oops "Your login, $Bad_Login, is not valid"; + # It can cause a syntax error if oops is a sub + || $typel eq 'w' && ($tokenr eq '-' || $typer eq 'Q') # perl is very fussy about spaces before << || $tokenr =~ /^\<\ + +In random testing, the -mangle option introduced a syntax error by deleting +the space between barewords and quotes (test file 'MxScreen'), such as: + + oops"Your login, $Bad_Login, is not valid"; + +Sub is_essential_whitespace was updated to prevent this on 27 Sep 2020. + =item B The .LOG file reports any disagreements between the indentation of the input and output files. -- 2.39.5