summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-03-20 16:47:16 +0100
committerNicholas Clark <nick@ccl4.org>2013-03-21 09:13:52 +0100
commit982110e06e40aad7a538cb788327cca8aaabce22 (patch)
treee066a5b50eb3efeb3074649db1ffd561fc376bb1 /gv.c
parent53213d38f22e9356f489162e494d2ffa46ec2ca2 (diff)
downloadperl-982110e06e40aad7a538cb788327cca8aaabce22.tar.gz
Add a deprecation warning for all uses of @*, %*, &* and **.
All compile-time uses of the ** typeglob now warn.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/gv.c b/gv.c
index 7e954d86b6..d96bde8a22 100644
--- a/gv.c
+++ b/gv.c
@@ -1638,16 +1638,23 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
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 == '*') {
+ } else if (sv_type == SVt_PV && *name == '#') {
+ Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED,
+ WARN_SYNTAX),
+ "$# is no longer supported");
+ }
+ if (*name == '*') {
+ if (sv_type == SVt_PV)
Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED,
WARN_SYNTAX),
"$* is no longer supported, and will become a syntax error");
- } else if (*name == '#') {
- Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED,
- WARN_SYNTAX),
- "$# is no longer supported");
- }
+ else
+ Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
+ "%c* is deprecated, and will become a syntax error",
+ sv_type == SVt_PVAV ? '@'
+ : sv_type == SVt_PVCV ? '&'
+ : sv_type == SVt_PVHV ? '%'
+ : '*');
}
if (sv_type==SVt_PV || sv_type==SVt_PVGV) {
switch (*name) {
@@ -1940,6 +1947,14 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
if (sv_type == SVt_PV)
Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
"$* is no longer supported, and will become a syntax error");
+ else {
+ Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
+ "%c* is deprecated, and will become a syntax error",
+ sv_type == SVt_PVAV ? '@'
+ : sv_type == SVt_PVCV ? '&'
+ : sv_type == SVt_PVHV ? '%'
+ : '*');
+ }
break;
case '#': /* $# */
if (sv_type == SVt_PV)