summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-03-20 12:00:11 +0100
committerNicholas Clark <nick@ccl4.org>2013-03-21 09:13:52 +0100
commitff68367153668fa69490c3a2ec009c228a10795f (patch)
tree6d47550f7551e1ef10ffb9cdfb42b95b44056176 /gv.c
parent340067e5ad5b9d5f9885e3c9fbc048c7e388e288 (diff)
downloadperl-ff68367153668fa69490c3a2ec009c228a10795f.tar.gz
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.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gv.c b/gv.c
index 8ac08abf50..143323d184 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 '[':