summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbigail <abigail@abigail.be>2017-01-15 22:23:47 +0100
committerAbigail <abigail@abigail.be>2017-01-16 19:18:17 +0100
commit37398dc1a6d62d8d18b2db9ec44bca65d4091614 (patch)
treebf1670ef37db7d506edcf91ab366cc5f179756ce
parenta678626e6d2dd11740073117f5269f7efee639de (diff)
downloadperl-37398dc1a6d62d8d18b2db9ec44bca65d4091614.tar.gz
Use of $* and $# will be fatal in 5.30.
Initially, the plan was to just drop the deprecation message of $* and $#, letting them be the magicless punctuation variables they are now. However, we decided to make their use fatal, so we can use them in a future version of Perl.
-rw-r--r--gv.c10
-rw-r--r--pod/perldeprecation.pod23
-rw-r--r--pod/perldiag.pod8
-rw-r--r--t/lib/warnings/2use8
-rw-r--r--t/lib/warnings/gv28
5 files changed, 53 insertions, 24 deletions
diff --git a/gv.c b/gv.c
index 6732dd2021..fff8e95c75 100644
--- a/gv.c
+++ b/gv.c
@@ -2157,9 +2157,10 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len,
case '*': /* $* */
case '#': /* $# */
if (sv_type == SVt_PV)
- /* diag_listed_as: $* is no longer supported */
+ /* diag_listed_as: $* is no longer supported. Its use will be fatal in Perl 5.30 */
Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
- "$%c is no longer supported", *name);
+ "$%c is no longer supported. Its use "
+ "will be fatal in Perl 5.30", *name);
break;
case '\010': /* $^H */
{
@@ -2269,10 +2270,11 @@ S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type)
require_tie_mod_s(gv, *name, "Tie::Hash::NamedCapture", 0);
} else if (sv_type == SVt_PV) {
if (*name == '*' || *name == '#') {
- /* diag_listed_as: $* is no longer supported */
+ /* diag_listed_as: $# is no longer supported. Its use will be fatal in Perl 5.30 */
Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED,
WARN_SYNTAX),
- "$%c is no longer supported", *name);
+ "$%c is no longer supported. Its use "
+ "will be fatal in Perl 5.30", *name);
}
}
if (sv_type==SVt_PV || sv_type==SVt_PVGV) {
diff --git a/pod/perldeprecation.pod b/pod/perldeprecation.pod
index 1581d453fa..bb69f7f1f9 100644
--- a/pod/perldeprecation.pod
+++ b/pod/perldeprecation.pod
@@ -52,6 +52,29 @@ This usage has been deprecated, and will no longer be allowed in Perl 5.32.
=head2 Perl 5.30
+=head3 C<< $* >> is no longer supported
+
+Before Perl 5.10, setting C<< $* >> to a true value globally enabled
+multi-line matching within a string. This relique from the past lost
+its special meaning in 5.10. Use of this variable will be a fatal error
+in Perl 5.30, freeing the variable up for a future special meaning.
+
+To enable multiline matching one should use the C<< /m >> regexp
+modifier (possibly in combination with C<< /s >>). This can be set
+on a per match bases, or can be enabled per lexical scope (including
+a whole file) with C<< use re '/m' >>.
+
+=head3 C<< $# >> is no longer supported
+
+This variable used to have a special meaning -- it could be used
+to control how numbers were formatted when printed. This seldom
+used functionality was removed in Perl 5.10. In order to free up
+the variable for a future special meaning, its use will be a fatal
+error in Perl 5.30.
+
+To specify how numbers are formatted when printed, one is adviced
+to use C<< printf >> or C<< sprintf >> instead.
+
=head3 C<< File::Glob::glob() >> will disappear
C<< File::Glob >> has a function called C<< glob >>, which just calls
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index df7056d37f..67c5f95b24 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -3141,7 +3141,7 @@ You specified a character that has the given plainer way of writing it,
and which is also portable to platforms running with different character
sets. This usage is deprecated, and will be a fatal error in Perl 5.28.
-=item $* is no longer supported
+=item $* is no longer supported. Its use will be fatal in Perl 5.30
(D deprecated, syntax) The special variable C<$*>, deprecated in older
perls, has been removed as of 5.10.0 and is no longer supported. In
@@ -3153,12 +3153,16 @@ modifiers. You can enable C</m> for a lexical scope (even a whole file)
with C<use re '/m'>. (In older versions: when C<$*> was set to a true value
then all regular expressions behaved as if they were written using C</m>.)
-=item $# is no longer supported
+Use of this variable will be a fatal error in Perl 5.30.
+
+=item $# is no longer supported. Its use will be fatal in Perl 5.30
(D deprecated, syntax) The special variable C<$#>, deprecated in older
perls, has been removed as of 5.10.0 and is no longer supported. You
should use the printf/sprintf functions instead.
+Use of this variable will be a fatal error in Perl 5.30.
+
=item '%s' is not a code reference
(W overload) The second (fourth, sixth, ...) argument of
diff --git a/t/lib/warnings/2use b/t/lib/warnings/2use
index 4e10d4b73d..a02505eff1 100644
--- a/t/lib/warnings/2use
+++ b/t/lib/warnings/2use
@@ -365,8 +365,8 @@ $*;
use warnings "void";
$#;
EXPECT
-$* is no longer supported at - line 3.
-$# is no longer supported at - line 5.
+$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
+$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 5.
Useless use of a variable in void context at - line 5.
########
@@ -375,5 +375,5 @@ $*;
no warnings "void";
$#;
EXPECT
-$* is no longer supported at - line 3.
-$# is no longer supported at - line 5.
+$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
+$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 5.
diff --git a/t/lib/warnings/gv b/t/lib/warnings/gv
index 20c8ac55a1..c8e2b89acd 100644
--- a/t/lib/warnings/gv
+++ b/t/lib/warnings/gv
@@ -65,8 +65,8 @@ no warnings 'deprecated' ;
$a = ${"#"};
$a = ${"*"};
EXPECT
-$# is no longer supported at - line 2.
-$* is no longer supported at - line 3.
+$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 2.
+$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
########
# gv.c
$a = ${#};
@@ -75,8 +75,8 @@ no warnings 'deprecated' ;
$a = ${#};
$a = ${*};
EXPECT
-$# is no longer supported at - line 2.
-$* is no longer supported at - line 3.
+$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 2.
+$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
########
# gv.c
$a = $#;
@@ -93,12 +93,12 @@ $* = $a;
$a = \$#;
$a = \$*;
EXPECT
-$# is no longer supported at - line 2.
-$* is no longer supported at - line 3.
-$# is no longer supported at - line 4.
-$* is no longer supported at - line 5.
-$# is no longer supported at - line 6.
-$* is no longer supported at - line 7.
+$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 2.
+$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
+$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 4.
+$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 5.
+$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 6.
+$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 7.
########
# gv.c
@a = @#;
@@ -106,8 +106,8 @@ $* is no longer supported at - line 7.
$a = $#;
$a = $*;
EXPECT
-$# is no longer supported at - line 4.
-$* is no longer supported at - line 5.
+$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 4.
+$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 5.
########
# gv.c
$a = $#;
@@ -115,8 +115,8 @@ $a = $*;
@a = @#;
@a = @*;
EXPECT
-$# is no longer supported at - line 2.
-$* is no longer supported at - line 3.
+$# is no longer supported. Its use will be fatal in Perl 5.30 at - line 2.
+$* is no longer supported. Its use will be fatal in Perl 5.30 at - line 3.
########
# gv.c
$a = ${^ENCODING};