In perl.git, the branch abigail/deprecation has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/fb847842d9aedf642a043677bf2b2a1af70f5646?hp=5a0d7028df2e737e7232e1fbf1c675d10a1f83ba>

- Log -----------------------------------------------------------------
commit fb847842d9aedf642a043677bf2b2a1af70f5646
Author: Abigail <[email protected]>
Date:   Mon Nov 21 22:38:32 2016 +0100

    Unescaped left braces in regular expressions will be fatal in 5.30.
    
    In 5.26, some uses of unescaped left braces were made fatal; they have
    given a deprecation warning since 5.20. Due to an oversight, some cases
    were missed, and did not give a deprecation warning. They do now.
    
    This patch changes said deprecation warning to mention the Perl version
    in which the use of an unescaped left brace will be fatal (5.30).
    
    The patch also cleans up some unnecessary quotes inside a C<> construct
    in the discussion of this warning in perldiag.pod.
-----------------------------------------------------------------------

Summary of changes:
 pod/perldeprecation.pod | 26 ++++++++++++++++++++++++++
 pod/perldiag.pod        | 22 +++++++++++-----------
 regcomp.c               |  2 +-
 t/re/reg_mesg.t         |  6 +++---
 4 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/pod/perldeprecation.pod b/pod/perldeprecation.pod
index 55c2db4..e91b6e9 100644
--- a/pod/perldeprecation.pod
+++ b/pod/perldeprecation.pod
@@ -30,6 +30,32 @@ disappear in Perl 5.30.
 Code using C<< File::Glob::glob() >> should call
 C<< File::Glob::bsd_glob() >> instead.
 
+
+=head3 Unescaped left braces in regular expressions
+
+The simple rule to remember, if you want to match a literal C<{>
+character (U+007B C<LEFT CURLY BRACKET>) in a regular expression
+pattern, is to escape each literal instance of it in some way.
+Generally easiest is to precede it with a backslash, like C<\{>
+or enclose it in square brackets (C<[{]>).  If the pattern
+delimiters are also braces, any matching right brace (C<}>) should
+also be escaped to avoid confusing the parser, for example,
+
+ qr{abc\{def\}ghi}
+
+Forcing literal C<{> characters to be escaped will enable the Perl
+language to be extended in various ways in future releases.  To avoid
+needlessly breaking existing code, the restriction is is not enforced in
+contexts where there are unlikely to ever be extensions that could
+conflict with the use there of C<{> as a literal.
+
+Literal uses of C<{> were deprecated in Perl 5.20, and some uses of it
+started to give deprecation warnings since. These cases were made fatal
+in Perl 5.26. Due to an oversight, not all cases of a use of a literal
+C<{> got a deprecation warning. These cases started warning in Perl 5.26,
+and they will be fatal by Perl 5.30.
+
+
 =head2 Perl 5.28
 
 =head3 Attribute "%s" is deprecated, and will disappear in 5.28
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index e8428cc..b454c5d 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -6224,30 +6224,30 @@ C<undef *foo>.
 (A) You've accidentally run your script through B<csh> instead of Perl.
 Check the #! line, or manually feed your script into Perl yourself.
 
-=item Unescaped left brace in regex is deprecated here, passed through in
-regex; marked by S<<-- HERE> in m/%s/
+=item Unescaped left brace in regex is deprecated here (and will be fatal in 
Perl 5.30), passed through in regex; marked by S<<-- HERE> in m/%s/
 
 (D deprecated, regexp)  The simple rule to remember, if you want to
-match a literal C<"{"> character (U+007B C<LEFT CURLY BRACKET>) in a
+match a literal C<{> character (U+007B C<LEFT CURLY BRACKET>) in a
 regular expression pattern, is to escape each literal instance of it in
 some way.  Generally easiest is to precede it with a backslash, like
-C<"\{"> or enclose it in square brackets (C<"[{]">).  If the pattern
-delimiters are also braces, any matching right brace (C<"}">) should
+C<\{> or enclose it in square brackets (C<[{]>).  If the pattern
+delimiters are also braces, any matching right brace (C<}>) should
 also be escaped to avoid confusing the parser, for example,
 
  qr{abc\{def\}ghi}
 
-Forcing literal C<"{"> characters to be escaped will enable the Perl
+Forcing literal C<{> characters to be escaped will enable the Perl
 language to be extended in various ways in future releases.  To avoid
 needlessly breaking existing code, the restriction is is not enforced in
 contexts where there are unlikely to ever be extensions that could
-conflict with the use there of C<"{"> as a literal.
+conflict with the use there of C<{> as a literal.
 
-In this release of Perl, some literal uses of C<"{"> are fatal, and some
+In this release of Perl, some literal uses of C<{> are fatal, and some
 still just deprecated.  This is because of an oversight:  some uses of a
-literal C<"{"> that should have raised a deprecation warning starting in
+literal C<{> that should have raised a deprecation warning starting in
 v5.20 did not warn until v5.26.  By making the already-warned uses fatal
 now, some of the planned extensions can be made to the language sooner.
+The cases which are still allowed will be fatal in Perl 5.30.
 
 The contexts where no warnings or errors are raised are:
 
@@ -6255,12 +6255,12 @@ The contexts where no warnings or errors are raised are:
 
 =item *
 
-as the first character in a pattern, or following C<"^"> indicating to
+as the first character in a pattern, or following C<^> indicating to
 anchor the match to the beginning of a line.
 
 =item *
 
-as the first character following a C<"|"> indicating alternation.
+as the first character following a C<|> indicating alternation.
 
 =item *
 
diff --git a/regcomp.c b/regcomp.c
index 332cf00..1d4aece 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -13798,7 +13798,7 @@ S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, 
U32 depth)
     skip_to_be_ignored_text(pRExC_state, &RExC_parse,
                                             FALSE /* Don't force to /x */ );
     if (PASS2 && *RExC_parse == '{' && OP(ret) != SBOL && ! 
regcurly(RExC_parse)) {
-        ckWARNregdep(RExC_parse + 1, "Unescaped left brace in regex is 
deprecated here, passed through");
+        ckWARNregdep(RExC_parse + 1, "Unescaped left brace in regex is 
deprecated here (and will be fatal in Perl 5.30), passed through");
     }
 
     return(ret);
diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t
index 52bec7a..1c26650 100644
--- a/t/re/reg_mesg.t
+++ b/t/re/reg_mesg.t
@@ -631,9 +631,9 @@ my @deprecated = (
  '/foo(:?{bar)/' => "",
  '/\s*{/'        => "",
  '/a{3,4}{/'     => "",
- '/.{/'         => 'Unescaped left brace in regex is deprecated here, passed 
through {#} m/.{{#}/',
- '/[x]{/'       => 'Unescaped left brace in regex is deprecated here, passed 
through {#} m/[x]{{#}/',
- '/\p{Latin}{/' => 'Unescaped left brace in regex is deprecated here, passed 
through {#} m/\p{Latin}{{#}/',
+ '/.{/'         => 'Unescaped left brace in regex is deprecated here (and will 
be fatal in Perl 5.30), passed through {#} m/.{{#}/',
+ '/[x]{/'       => 'Unescaped left brace in regex is deprecated here (and will 
be fatal in Perl 5.30), passed through {#} m/[x]{{#}/',
+ '/\p{Latin}{/' => 'Unescaped left brace in regex is deprecated here (and will 
be fatal in Perl 5.30), passed through {#} m/\p{Latin}{{#}/',
 );
 
 for my $strict ("", "use re 'strict';") {

--
Perl5 Master Repository

Reply via email to