X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=gv.c;h=29d2f604a166cd44f2311cf6b71ed1a23e1590fd;hb=cf2a2b693556595262000bd111376253d237e7a7;hp=746b2bb35a5533fa030c487081cf7676ce6775ff;hpb=7b8203e3be66f22041237ce6c371ea09ae857f20;p=p5sagit%2Fp5-mst-13.2.git diff --git a/gv.c b/gv.c index 746b2bb..29d2f60 100644 --- a/gv.c +++ b/gv.c @@ -204,6 +204,7 @@ Perl_gv_init(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, int multi) case SVt_PVIO: Perl_croak(aTHX_ "Cannot convert a reference to %s to typeglob", sv_reftype(has_constant, 0)); + default: NOOP; } SvRV_set(gv, NULL); SvROK_off(gv); @@ -312,6 +313,7 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level) GV** gvp; CV* cv; const char *hvname; + HV* lastchance = NULL; /* UNIVERSAL methods should be callable without a stash */ if (!stash) { @@ -399,7 +401,7 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level) /* if at top level, try UNIVERSAL */ if (level == 0 || level == -1) { - HV* const lastchance = gv_stashpvs("UNIVERSAL", FALSE); + lastchance = gv_stashpvs("UNIVERSAL", FALSE); if (lastchance) { if ((gv = gv_fetchmeth(lastchance, name, len, @@ -653,7 +655,6 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method) sv_setpvn(varsv, packname, packname_len); sv_catpvs(varsv, "::"); sv_catpvn(varsv, name, len); - SvTAINTED_off(varsv); return gv; } @@ -943,10 +944,16 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, : sv_type == SVt_PVAV ? "@" : sv_type == SVt_PVHV ? "%" : ""), name); + GV *gv; if (USE_UTF8_IN_NAMES) SvUTF8_on(err); qerror(err); - stash = GvHV(gv_fetchpvn_flags("::", 8, GV_ADDMULTI, SVt_PVHV)); + gv = gv_fetchpvn_flags("::", 8, GV_ADDMULTI, SVt_PVHV); + if(!gv) { + /* symbol table under destruction */ + return NULL; + } + stash = GvHV(gv); } else return NULL; @@ -1181,10 +1188,14 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, goto magicalize; case '+': + GvMULTI_on(gv); { AV* const av = GvAVn(gv); + HV* const hv = GvHVn(gv); sv_magic((SV*)av, (SV*)av, PERL_MAGIC_regdata, NULL, 0); SvREADONLY_on(av); + hv_magic(hv, NULL, PERL_MAGIC_regdata_names); + SvREADONLY_on(hv); /* FALL THROUGH */ } case '\023': /* $^S */ @@ -1712,6 +1723,12 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) */ SV* const newref = newSVsv(tmpRef); SvOBJECT_on(newref); + /* As a bit of a source compatibility hack, SvAMAGIC() and + friends dereference an RV, to behave the same was as when + overloading was stored on the reference, not the referant. + Hence we can't use SvAMAGIC_on() + */ + SvFLAGS(newref) |= SVf_AMAGIC; SvSTASH_set(newref, (HV*)SvREFCNT_inc(SvSTASH(tmpRef))); return newref; } @@ -1822,6 +1839,9 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags) notfound = 1; lr = -1; } else if (cvp && (cv=cvp[nomethod_amg])) { notfound = 1; lr = 1; + } else if ((amtp && amtp->fallback >= AMGfallYES) && !DEBUG_o_TEST) { + /* Skip generating the "no method found" message. */ + return NULL; } else { SV *msg; if (off==-1) off=method;