In perl.git, the branch abigail/deprecation has been updated <http://perl5.git.perl.org/perl.git/commitdiff/5a0d7028df2e737e7232e1fbf1c675d10a1f83ba?hp=a6f03fd6ee02ef1cd2999f4cc9bab3047d4dbfe7>
- Log ----------------------------------------------------------------- commit 5a0d7028df2e737e7232e1fbf1c675d10a1f83ba Author: Abigail <[email protected]> Date: Fri Nov 18 18:33:19 2016 +0100 Bare heredocs will be fatal in 5.28. Heredocs without a terminator after the << have been deprecated since 5.000. After more than 2 decades, it's time to retire this construct. They will be fatal in 5.28. ----------------------------------------------------------------------- Summary of changes: pod/perldeprecation.pod | 15 +++++++++++++++ pod/perldiag.pod | 5 ++++- t/lib/warnings/toke | 6 +++--- t/op/heredoc.t | 2 +- toke.c | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/pod/perldeprecation.pod b/pod/perldeprecation.pod index d68804f..55c2db4 100644 --- a/pod/perldeprecation.pod +++ b/pod/perldeprecation.pod @@ -45,6 +45,21 @@ removing them from your code fixes the deprecation warning; and removing them will not influence the behaviour of your code. +=head3 Bare here-document terminators + +Perl has allowed you to use a bare here-document terminator to have the +here-document end at the first empty line. This practise was deprecated +in Perl 5.000, and this will be a fatal error in Perl 5.28. + +You are encouraged to use the explictly quoted form if you wish to +use an empty line as the terminator of the here-document: + + print <<""; + Print this line. + + # Previous blank line ends the here-document. + + =head3 Setting $/ to a reference to a non-positive integer You assigned a reference to a scalar to C<$/> where the diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 27a0dcf..e8428cc 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -6882,12 +6882,15 @@ returns no useful value. See L<perlmod>. (D deprecated) The C<$[> variable (index of the first element in an array) is deprecated. See L<perlvar/"$[">. -=item Use of bare << to mean <<"" is deprecated +=item Use of bare << to mean <<"" is deprecated. Its use will be fatal in Perl 5.28 (D deprecated) You are now encouraged to use the explicitly quoted form if you wish to use an empty line as the terminator of the here-document. +Use of a bare terminator was deprecated in Perl 5.000, and +will be a fatal error in Perl 5.28. + =item Use of /c modifier is meaningless in s/// (W regexp) You used the /c modifier in a substitution. The /c diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke index 279d33b..f34680e 100644 --- a/t/lib/warnings/toke +++ b/t/lib/warnings/toke @@ -147,7 +147,7 @@ no warnings 'deprecated' ; $a = <<; EXPECT -Use of bare << to mean <<"" is deprecated at - line 2. +Use of bare << to mean <<"" is deprecated. Its use will be fatal in Perl 5.28 at - line 2. ######## # toke.c $a = <<~; @@ -155,8 +155,8 @@ $a = <<~; $a = <<~ ; EXPECT -Use of bare << to mean <<"" is deprecated at - line 2. -Use of bare << to mean <<"" is deprecated at - line 4. +Use of bare << to mean <<"" is deprecated. Its use will be fatal in Perl 5.28 at - line 2. +Use of bare << to mean <<"" is deprecated. Its use will be fatal in Perl 5.28 at - line 4. ######## # toke.c $a =~ m/$foo/eq; diff --git a/t/op/heredoc.t b/t/op/heredoc.t index 15b12d9..5166159 100644 --- a/t/op/heredoc.t +++ b/t/op/heredoc.t @@ -102,7 +102,7 @@ HEREDOC fresh_perl_like( qq(<<\n\$ \n), # valgrind and asan reports an error between these two lines - qr/^Use of bare << to mean <<"" is deprecated at - line 1\.\s+Final \$/, + qr/^Use of bare << to mean <<"" is deprecated\. Its use will be fatal in Perl 5\.28 at - line 1\.\s+Final \$/, {}, "don't use an invalid oldoldbufptr (some more)" ); diff --git a/toke.c b/toke.c index 7fa242e..646bdda 100644 --- a/toke.c +++ b/toke.c @@ -9597,7 +9597,7 @@ S_scan_heredoc(pTHX_ char *s) else term = '"'; if (!isWORDCHAR_lazy_if(s,UTF)) - deprecate("bare << to mean <<\"\""); + deprecate_fatal_in("5.28", "Use of bare << to mean <<\"\" is deprecated"); peek = s; while (isWORDCHAR_lazy_if(peek,UTF)) { peek += UTF ? UTF8SKIP(peek) : 1; -- Perl5 Master Repository
