diff options
-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, 101 insertions, 44 deletions
@@ -2154,6 +2154,13 @@ 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); @@ -2260,6 +2267,13 @@ 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 56f7348e40..1581d453fa 100644 --- a/pod/perldeprecation.pod +++ b/pod/perldeprecation.pod @@ -423,39 +423,6 @@ 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 b407233ef8..df7056d37f 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -3141,6 +3141,24 @@ 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 + +(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 ab5586a0a6..4e10d4b73d 100644 --- a/t/lib/warnings/2use +++ b/t/lib/warnings/2use @@ -361,21 +361,19 @@ 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; $*; +use warnings "void"; +$#; EXPECT -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. +$* 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. ######## # Check that deprecation warnings are not implicitly disabled by no -our $foo :unique; -no warnings "void"; -our $bar :unique; $*; +no warnings "void"; +$#; EXPECT -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. +$* is no longer supported at - line 3. +$# is no longer supported at - line 5. diff --git a/t/lib/warnings/gv b/t/lib/warnings/gv index 08a8474d4b..20c8ac55a1 100644 --- a/t/lib/warnings/gv +++ b/t/lib/warnings/gv @@ -59,6 +59,66 @@ EXPECT Use of inherited AUTOLOAD for non-method main::fᕃƌ() is deprecated. This will be fatal in Perl 5.28 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; |