diff options
author | Karl Williamson <public@khwilliamson.com> | 2012-05-24 21:23:49 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2012-05-24 22:48:43 -0600 |
commit | 2a53d3314d380af5ab5283758219417c6dfa36e9 (patch) | |
tree | 7c72ef5cd43b245d58ad7a4303d789a0f20aa8b4 /lib/diagnostics.pm | |
parent | 9a54da5c9b834e6244f5695a8d2bf57e89d4fa90 (diff) | |
download | perl-2a53d3314d380af5ab5283758219417c6dfa36e9.tar.gz |
Deprecate literal unescaped "{" in regexes.
We are deprecating literal left braces in regular expressions. The 5.16
delta announced that this is coming.
This commit causes a warning to be raised when a literal "{" is
encountered. However, it does not do this if the left brace is at the
beginning of a construct. Such a brace does not cause problems for us
for our future use of it for other purposes, as, for example in things
like \b{w}, and there were a large number of core tests that failed
without this condition.
I didn't mention this exception in the diagnostic. We may choose to
forbid it everywhere, and we certainly want to discourage its use
everywhere. But this commit gets the essential components in early in
5.17, and we can tighten it up later if we decide to.
Diffstat (limited to 'lib/diagnostics.pm')
-rw-r--r-- | lib/diagnostics.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/diagnostics.pm b/lib/diagnostics.pm index 39bcb3d1dd..21cdf543b7 100644 --- a/lib/diagnostics.pm +++ b/lib/diagnostics.pm @@ -186,7 +186,7 @@ use 5.009001; use Carp; $Carp::Internal{__PACKAGE__.""}++; -our $VERSION = '1.28'; +our $VERSION = '1.29'; our $DEBUG; our $VERBOSE; our $PRETTY; @@ -435,11 +435,11 @@ my %msg; } my $lhs = join( '', @toks ); $transfmt{$header}{pat} = - " s{^$lhs}\n {\Q$header\E}s\n\t&& return 1;\n"; + " s^$lhs\Q$header\Es\n\t&& return 1;\n"; $transfmt{$header}{len} = $conlen; } else { $transfmt{$header}{pat} = - " m{^\Q$header\E} && return 1;\n"; + " m^\Q$header\E && return 1;\n"; $transfmt{$header}{len} = length( $header ); } |