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

<http://perl5.git.perl.org/perl.git/commitdiff/df699a2e01831d0a39d95275c4490c1e6f4ab043?hp=102f1566ae3179210c18c496975364effd65758b>

- Log -----------------------------------------------------------------
commit df699a2e01831d0a39d95275c4490c1e6f4ab043
Author: Abigail <[email protected]>
Date:   Fri Nov 18 14:52:18 2016 +0100

    $/ = \-1 will be fatal in Perl 5.28.
    
    Setting $/ to a reference of a non-positive integer has been deprecated
    since 5.20, in which it was special cased to act like you had set to
    $/ to undef.
    
    In Perl 5.28, setting $/ to a reference to a non-positive integer will
    be a fatal error.
-----------------------------------------------------------------------

Summary of changes:
 mg.c                    |  2 +-
 pod/perldeprecation.pod | 18 ++++++++++++++++++
 pod/perldiag.pod        |  6 +++---
 t/lib/warnings/9uninit  |  2 +-
 t/lib/warnings/mg       |  8 ++++----
 5 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/mg.c b/mg.c
index 719242d..baa2b25 100644
--- a/mg.c
+++ b/mg.c
@@ -2898,7 +2898,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
                     if (val <= 0) {
                         tmpsv= &PL_sv_undef;
                         Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
-                            "Setting $/ to a reference to %s as a form of 
slurp is deprecated, treating as undef",
+                            "Setting $/ to a reference to %s as a form of 
slurp is deprecated, treating as undef. This will be fatal in Perl 5.28",
                             SvIV(SvRV(sv)) < 0 ? "a negative integer" : "zero"
                         );
                     }
diff --git a/pod/perldeprecation.pod b/pod/perldeprecation.pod
index 027010d..8986396 100644
--- a/pod/perldeprecation.pod
+++ b/pod/perldeprecation.pod
@@ -45,6 +45,24 @@ removing them from your code fixes the deprecation warning; 
and removing
 them will not influence the behaviour of your code.
 
 
+=head3 Setting $/ to a reference to a non-positive integer
+
+You assigned a reference to a scalar to C<$/> where the
+referenced item is not a positive integer.  In older perls this B<appeared>
+to work the same as setting it to C<undef> but was in fact internally
+different, less efficient and with very bad luck could have resulted in
+your file being split by a stringified form of the reference.
+
+In Perl 5.20.0 this was changed so that it would be B<exactly> the same as
+setting C<$/> to undef, with the exception that this warning would be
+thrown.
+
+In Perl 5.28, this will throw a fatal error.
+
+You are recommended to change your code to set C<$/> to C<undef> explicitly
+if you wish to slurp the file.
+
+
 =head3 Using the same symbol to open a filehandle and a dirhandle
 
 It used to be legal to use C<open()> to associate both a
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 52743e3..01b6e84 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -5536,7 +5536,7 @@ didn't think so.
 forget to check the return value of your socket() call?  See
 L<perlfunc/setsockopt>.
 
-=item Setting $/ to a reference to %s as a form of slurp is deprecated, 
treating as undef
+=item Setting $/ to a reference to %s as a form of slurp is deprecated, 
treating as undef. This will be fatal in Perl 5.28
 
 (D deprecated) You assigned a reference to a scalar to C<$/> where the
 referenced item is not a positive integer.  In older perls this B<appeared>
@@ -5549,8 +5549,8 @@ setting C<$/> to undef, with the exception that this 
warning would be
 thrown.
 
 You are recommended to change your code to set C<$/> to C<undef> explicitly
-if you wish to slurp the file.  In future versions of Perl assigning
-a reference to will throw a fatal error.
+if you wish to slurp the file.  In Perl 5.28 assigning C<$/> to a 
+reference to an integer which isn't positive will throw a fatal error.
 
 =item Setting $/ to %s reference is forbidden
 
diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit
index c8b843f..5eaf322 100644
--- a/t/lib/warnings/9uninit
+++ b/t/lib/warnings/9uninit
@@ -411,7 +411,7 @@ chomp ($x, $y); chop ($x, $y);
 EXPECT
 Use of uninitialized value $m1 in scalar assignment at - line 4.
 Use of uninitialized value $m1 in scalar assignment at - line 4.
-Setting $/ to a reference to zero as a form of slurp is deprecated, treating 
as undef at - line 4.
+Setting $/ to a reference to zero as a form of slurp is deprecated, treating 
as undef. This will be fatal in Perl 5.28 at - line 4.
 Use of uninitialized value $y in chop at - line 8.
 ########
 use warnings 'uninitialized';
diff --git a/t/lib/warnings/mg b/t/lib/warnings/mg
index a4231bf..7fdefc2 100644
--- a/t/lib/warnings/mg
+++ b/t/lib/warnings/mg
@@ -3,7 +3,7 @@
   No such signal: SIG%s
     $SIG{FRED} = sub {}
 
-  Setting $/ to a reference to zero as a form of slurp is deprecated, treating 
as undef
+  Setting $/ to a reference to zero as a form of slurp is deprecated, treating 
as undef. This will be fatal in Perl 5.28
 
   SIG%s handler \"%s\" not defined.
     $SIG{"INT"} = "ok3"; kill "INT",$$;
@@ -25,19 +25,19 @@ EXPECT
 # warnable code, warnings enabled via command line switch
 $/ = \0;
 EXPECT
-Setting $/ to a reference to zero as a form of slurp is deprecated, treating 
as undef at - line 3.
+Setting $/ to a reference to zero as a form of slurp is deprecated, treating 
as undef. This will be fatal in Perl 5.28 at - line 3.
 ########
 -w
 # warnable code, warnings enabled via command line switch
 $/ = \-1;
 EXPECT
-Setting $/ to a reference to a negative integer as a form of slurp is 
deprecated, treating as undef at - line 3.
+Setting $/ to a reference to a negative integer as a form of slurp is 
deprecated, treating as undef. This will be fatal in Perl 5.28 at - line 3.
 ########
 $/ = \-1;
 no warnings 'deprecated';
 $/ = \-1;
 EXPECT
-Setting $/ to a reference to a negative integer as a form of slurp is 
deprecated, treating as undef at - line 1.
+Setting $/ to a reference to a negative integer as a form of slurp is 
deprecated, treating as undef. This will be fatal in Perl 5.28 at - line 1.
 ########
 # mg.c
 use warnings 'signal' ;

--
Perl5 Master Repository

Reply via email to