diff options
author | Abigail <abigail@abigail.be> | 2016-11-15 23:51:53 +0100 |
---|---|---|
committer | Abigail <abigail@abigail.be> | 2017-01-16 19:18:11 +0100 |
commit | 52b37024902e2235753cc53604567cfd4be0b15a (patch) | |
tree | abf7097b9667b8f235a116f4826bd36e03c40605 | |
parent | c96809061c2def2e6554bf2f122c294e7396fb98 (diff) | |
download | perl-52b37024902e2235753cc53604567cfd4be0b15a.tar.gz |
Remove deprecation warnings related to $* and $#.
The magic variables $* and $# were deprecated in 5.000. Their magical
meaning was removed in Perl 5.10. Since then, a warning was issued
if the variables were used.
This warnings has been removed.
-rw-r--r-- | gv.c | 14 | ||||
-rw-r--r-- | pod/perldeprecation.pod | 33 | ||||
-rw-r--r-- | pod/perldiag.pod | 18 | ||||
-rw-r--r-- | t/lib/warnings/2use | 20 | ||||
-rw-r--r-- | t/lib/warnings/gv | 60 |
5 files changed, 44 insertions, 101 deletions
@@ -2153,13 +2153,6 @@ S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, SvREADONLY_on(av); } break; - case '*': /* $* */ - case '#': /* $# */ - if (sv_type == SVt_PV) - /* diag_listed_as: $* is no longer supported */ - Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX), - "$%c is no longer supported", *name); - break; case '\010': /* $^H */ { HV *const hv = GvHVn(gv); @@ -2266,13 +2259,6 @@ S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type) require_tie_mod_s(gv, '!', "Errno", 1); else if (*name == '-' || *name == '+') 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 */ - Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, - WARN_SYNTAX), - "$%c is no longer supported", *name); - } } if (sv_type==SVt_PV || sv_type==SVt_PVGV) { switch (*name) { diff --git a/pod/perldeprecation.pod b/pod/perldeprecation.pod index 95f89d2630..a70fe7b603 100644 --- a/pod/perldeprecation.pod +++ b/pod/perldeprecation.pod @@ -81,6 +81,39 @@ To tie the handle, use C<tie *$scalar> (with an explicit asterisk). The same applies to C<tied *$scalar> and C<untie *$scalar>. +=head2 Perl 5.10 + +=head3 $* is no longer supported + +C<$*> was once a magic variable. C<$*> enabled or disabled +multi-line matching within a string. Deprecated since Perl 5.000, +its special meaning was removed in Perl 5.10. Aftwards, an +deprecation message was issued when using this variable; this message +was discontinued in Perl 5.26. + +Instead of using C<$*> you should use the C</m> (and maybe C</s>) regexp +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>.) + +Although you can use C<$*> as a normal variable, you are discouraged +from doing so. + +=head3 $# is no longer supported + +C<$#> was once a magic variable. C<$#> could be used to format +printed numbers. Deprecated since Perl 5.000, +its special meaning was removed in Perl 5.10. Aftwards, an +deprecation message was issued when using this variable; this message +was discontinued in Perl 5.26. + +Instead of using C<$#>, you should be using C<(s)printf> to format +your numbers. + +Although you can use C<$*> as a normal variable, you are discouraged +from doing so. + + =head1 SEE ALSO L<warnings>, L<diagnostics>. diff --git a/pod/perldiag.pod b/pod/perldiag.pod index cc8aaeae08..82967173ec 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -3128,24 +3128,6 @@ 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. -=item $* is no longer supported - -(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 -previous versions of perl the use of C<$*> enabled or disabled multi-line -matching within a string. - -Instead of using C<$*> you should use the C</m> (and maybe C</s>) regexp -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 - -(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. - =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..ab5586a0a6 100644 --- a/t/lib/warnings/2use +++ b/t/lib/warnings/2use @@ -361,19 +361,21 @@ Use of uninitialized value $c in scalar chop at - line 9. ######## # Check that deprecation warnings are not implicitly disabled by use -$*; +our $foo :unique; use warnings "void"; -$#; +our $bar :unique; +$*; EXPECT -$* is no longer supported at - line 3. -$# is no longer supported at - line 5. -Useless use of a variable in void context at - line 5. +Attribute "unique" is deprecated, and will disappear in Perl 5.28 at - line 3. +Attribute "unique" is deprecated, and will disappear in Perl 5.28 at - line 5. +Useless use of a variable in void context at - line 6. ######## # Check that deprecation warnings are not implicitly disabled by no -$*; +our $foo :unique; no warnings "void"; -$#; +our $bar :unique; +$*; EXPECT -$* is no longer supported at - line 3. -$# is no longer supported at - line 5. +Attribute "unique" is deprecated, and will disappear in Perl 5.28 at - line 3. +Attribute "unique" is deprecated, and will disappear in Perl 5.28 at - line 5. diff --git a/t/lib/warnings/gv b/t/lib/warnings/gv index 8a93f8b632..ddc4c97d4c 100644 --- a/t/lib/warnings/gv +++ b/t/lib/warnings/gv @@ -59,66 +59,6 @@ EXPECT Use of inherited AUTOLOAD for non-method main::fᕃƌ() is deprecated at - line 7. ######## # gv.c -$a = ${"#"}; -$a = ${"*"}; -no warnings 'deprecated' ; -$a = ${"#"}; -$a = ${"*"}; -EXPECT -$# is no longer supported at - line 2. -$* is no longer supported at - line 3. -######## -# gv.c -$a = ${#}; -$a = ${*}; -no warnings 'deprecated' ; -$a = ${#}; -$a = ${*}; -EXPECT -$# is no longer supported at - line 2. -$* is no longer supported at - line 3. -######## -# gv.c -$a = $#; -$a = $*; -$# = $a; -$* = $a; -$a = \$#; -$a = \$*; -no warnings 'deprecated' ; -$a = $#; -$a = $*; -$# = $a; -$* = $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. -######## -# gv.c -@a = @#; -@a = @*; -$a = $#; -$a = $*; -EXPECT -$# is no longer supported at - line 4. -$* is no longer supported at - line 5. -######## -# gv.c -$a = $#; -$a = $*; -@a = @#; -@a = @*; -EXPECT -$# is no longer supported at - line 2. -$* is no longer supported at - line 3. -######## -# gv.c $a = ${^ENCODING}; $a = ${^E_NCODING}; ${^ENCODING} = 1; |