Before perl 5.004, the perl parser would skip over CR (carriage return) between tokens in source files, treating it as whitespace, but would retain CRs in quoted constructs such as multi-line strings and here-documents.
In 5.004, the behavior was changed to make CR in source files a fatal error ("Illegal character %s (carriage return)") to avoid surprises with unexpected literal CRs in string constants when scripts were copied from DOS/Windows without newline conversion.
In 5.005, the behavior changed again. Now CR was back to being ignored, but harder: Even in quoted constructs, CR was ignored when immediately followed by a newline. However, the 5.004 behavior could be restored by compiling perl with the PERL_STRICT_CR macro defined (e.g. with ./Configure -A ccflags=-DPERL_STRICT_CR ...). This option was undocumented except for a brief note in perl5005delta. (Also, the "Illegal character ..." error was changed to a warning, but perldiag wasn't updated and so still listed the message as "fatal" (F).)
And that's how things have been ever since 1998.
Foreground:
This patch removes all checks for PERL_STRICT_CR entirely, treating it as always off.
Rationale: It simplifies the code and reduces clutter. (Plus I don't see the need to perpetually maintain an undocumented configuration option that enables compatibility with an ancient perl version used sometime around 1997-1998.)
References:
4fdae80067 ("Make \r in script an error (per Larry)")
ff0cee690d ("Fix carriage-return message")
54310121b4 ("Improve diagnostic on \r in program text")
2db4f57cd9
f63a84b229
637e912262
b8957cf14d
6a27c1886b
This set of changes requires a perldelta entry, and it is included.
Background:
Before perl 5.004, the perl parser would skip over CR (carriage return) between tokens in source files, treating it as whitespace, but would retain CRs in quoted constructs such as multi-line strings and here-documents.
In 5.004, the behavior was changed to make CR in source files a fatal error ("Illegal character %s (carriage return)") to avoid surprises with unexpected literal CRs in string constants when scripts were copied from DOS/Windows without newline conversion.
In 5.005, the behavior changed again. Now CR was back to being ignored, but harder: Even in quoted constructs, CR was ignored when immediately followed by a newline. However, the 5.004 behavior could be restored by compiling perl with the
PERL_STRICT_CR
macro defined (e.g. with./Configure -A ccflags=-DPERL_STRICT_CR ...
). This option was undocumented except for a brief note in perl5005delta. (Also, the "Illegal character ..." error was changed to a warning, but perldiag wasn't updated and so still listed the message as "fatal" (F).)And that's how things have been ever since 1998.
Foreground:
This patch removes all checks for PERL_STRICT_CR entirely, treating it as always off.
Rationale: It simplifies the code and reduces clutter. (Plus I don't see the need to perpetually maintain an undocumented configuration option that enables compatibility with an ancient perl version used sometime around 1997-1998.)
References: