}
len = namend - name;
+ /* $_ should always be in main:: even when our'ed */
+ if (*name == '_' && !name[1])
+ stash = PL_defstash;
+
/* No stash in name, so see how we can default */
if (!stash) {
if (global)
stash = PL_defstash;
- else if ((COP*)PL_curcop == &PL_compiling) {
+ else if (IN_PERL_COMPILETIME) {
stash = PL_curstash;
if (add && (PL_hints & HINT_STRICT_VARS) &&
sv_type != SVt_PVCV &&
if (!stash) {
if (add) {
- qerror(Perl_mess(aTHX_
+ register SV *err = Perl_mess(aTHX_
"Global symbol \"%s%s\" requires explicit package name",
(sv_type == SVt_PV ? "$"
: sv_type == SVt_PVAV ? "@"
: sv_type == SVt_PVHV ? "%"
- : ""), name));
+ : ""), name);
+ if (USE_UTF8_IN_NAMES)
+ SvUTF8_on(err);
+ qerror(err);
stash = GvHV(gv_fetchpv("<none>::", GV_ADDMULTI, SVt_PVHV));
}
else
SvREADONLY_on(av);
}
goto magicalize;
- case '#':
case '*':
- if (ckWARN2(WARN_DEPRECATED, WARN_SYNTAX) && len == 1 && sv_type == SVt_PV)
- Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX), "Use of $%s is deprecated", name);
+ if (len == 1 && sv_type == SVt_PV && ckWARN2(WARN_DEPRECATED, WARN_SYNTAX))
+ Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
+ "$* is no longer supported");
+ break;
+ case '#':
+ if (len == 1 && sv_type == SVt_PV && ckWARN2(WARN_DEPRECATED, WARN_SYNTAX))
+ Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX),
+ "Use of $# is deprecated");
/* FALL THROUGH */
case '[':
case '^':
return;
}
- SvREFCNT_dec(gp->gp_sv);
- SvREFCNT_dec(gp->gp_av);
- if(gp->gp_hv && HvNAME(gp->gp_hv) && PL_stashcache)
- hv_delete(PL_stashcache, HvNAME(gp->gp_hv), strlen(HvNAME(gp->gp_hv)), G_DISCARD);
- SvREFCNT_dec(gp->gp_hv);
- SvREFCNT_dec(gp->gp_io);
- SvREFCNT_dec(gp->gp_cv);
- SvREFCNT_dec(gp->gp_form);
+ if (gp->gp_sv) SvREFCNT_dec(gp->gp_sv);
+ if (gp->gp_sv) SvREFCNT_dec(gp->gp_av);
+ if (gp->gp_hv) {
+ if (PL_stashcache && HvNAME(gp->gp_hv))
+ hv_delete(PL_stashcache,
+ HvNAME(gp->gp_hv), strlen(HvNAME(gp->gp_hv)),
+ G_DISCARD);
+ SvREFCNT_dec(gp->gp_hv);
+ }
+ if (gp->gp_io) SvREFCNT_dec(gp->gp_io);
+ if (gp->gp_cv) SvREFCNT_dec(gp->gp_cv);
+ if (gp->gp_form) SvREFCNT_dec(gp->gp_form);
Safefree(gp);
GvGP(gv) = 0;
/* GvSV contains the name of the method. */
GV *ngv = Nullgv;
- DEBUG_o( Perl_deb(aTHX_ "Resolving method `%.256"SVf"' for overloaded `%s' in package `%.256s'\n",
+ DEBUG_o( Perl_deb(aTHX_ "Resolving method `%"SVf256\
+ "' for overloaded `%s' in package `%.256s'\n",
GvSV(gv), cp, HvNAME(stash)) );
if (!SvPOK(GvSV(gv))
|| !(ngv = gv_fetchmethod_autoload(stash, SvPVX(GvSV(gv)),
/* Can be an import stub (created by `can'). */
SV *gvsv = GvSV(gv);
const char *name = SvPOK(gvsv) ? SvPVX(gvsv) : "???";
- Perl_croak(aTHX_ "%s method `%.256s' overloading `%s' in package `%.256s'",
+ Perl_croak(aTHX_ "%s method `%.256s' overloading `%s' "\
+ "in package `%.256s'",
(GvCVGEN(gv) ? "Stub found while resolving"
: "Can't resolve"),
name, cp, HvNAME(stash));
case '!':
case '-':
case '#':
- case '*':
case '[':
case '^':
case '~':