summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mg.c2
-rw-r--r--pod/perldeprecation.pod18
-rw-r--r--pod/perldiag.pod6
-rw-r--r--t/lib/warnings/9uninit2
-rw-r--r--t/lib/warnings/mg8
5 files changed, 27 insertions, 9 deletions
diff --git a/mg.c b/mg.c
index 1bcfc4f977..8a00dd2541 100644
--- a/mg.c
+++ b/mg.c
@@ -2900,7 +2900,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 027010d96e..8986396bfe 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 4e40fedd84..8acdb54dd0 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -5517,7 +5517,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>
@@ -5530,8 +5530,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 77a93ced69..1dc71397b6 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 a4231bf98f..7fdefc26b3 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' ;