In perl.git, the branch smoke-me/nicholas/splat-dollar-star-dollar-hash has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/245db38d7cca402deb8687a5056ea2254a5aafe4?hp=93f31ee9fb6e815cac5df15822755aa4d75c91a9> - Log ----------------------------------------------------------------- commit 245db38d7cca402deb8687a5056ea2254a5aafe4 Author: Nicholas Clark <[email protected]> Date: Wed Mar 20 12:00:11 2013 +0100 Generate the deprecation warnings for all uses $* or $#. Previously it would fail to be generated if another variable using the same typeglob was seen first (e.g. @* before $*), and would not be generated for the second and subsequent uses. It's hard to fix the failure to generate warnings at all without also generating them every time, and warning every time is consistent with the warnings that $[ used to generate. M gv.c M pod/perldelta.pod M t/lib/warnings/gv commit be6c0b0415c44749ea25353fc46ac882be592e5f Author: Nicholas Clark <[email protected]> Date: Wed Mar 20 11:40:42 2013 +0100 Additional tests for the deprecation warnings when using $* or $#. M t/lib/warnings/gv ----------------------------------------------------------------------- Summary of changes: gv.c | 13 ++++++++++++- pod/perldelta.pod | 10 +++++++--- t/lib/warnings/gv | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 4 deletions(-) diff --git a/gv.c b/gv.c index 8ac08ab..143323d 100644 --- a/gv.c +++ b/gv.c @@ -1628,13 +1628,24 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, if (add) { GvMULTI_on(gv); gv_init_svtype(gv, sv_type); + /* You reach this path once the typeglob has already been created, + either by the same or a different sigil. If this path didn't + exist, then (say) referencing $! first, and %! second would + mean that %! was not handled correctly. */ if (len == 1 && stash == PL_defstash) { if (sv_type == SVt_PVHV || sv_type == SVt_PVGV) { if (*name == '!') require_tie_mod(gv, "!", newSVpvs("Errno"), "TIEHASH", 1); else if (*name == '-' || *name == '+') require_tie_mod(gv, name, newSVpvs("Tie::Hash::NamedCapture"), "TIEHASH", 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) { case '[': diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 1aa1135..0208a7d 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -192,13 +192,17 @@ XXX L<message|perldiag/"message"> =head2 Changes to Existing Diagnostics -XXX Changes (i.e. rewording) of diagnostic messages go here - =over 4 =item * -XXX Describe change here +The warning that use of C<$*> and C<$#> is no longer supported is now +generated for every location that references them. Previously it would fail +to be generated if another variable using the same typeglob was seen first +(e.g. C<@*> before C<$*>), and would not be generated for the second and +subsequent uses. (It's hard to fix the failure to generate warnings at all +without also generating them every time, and warning every time is +consistent with the warnings that C<$[> used to generate.) =back diff --git a/t/lib/warnings/gv b/t/lib/warnings/gv index 6101f69..6b022e1 100644 --- a/t/lib/warnings/gv +++ b/t/lib/warnings/gv @@ -63,6 +63,56 @@ $# 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 use warnings 'syntax' ; use utf8; use open qw( :utf8 :std ); -- Perl5 Master Repository
