summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorAlex Vandiver <alexmv@mit.edu>2003-05-02 02:45:05 -0400
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-05-12 21:49:21 +0000
commite27ad1f20b87bf08f3461d0be498f8d4da22a576 (patch)
treec42d11b1dcf1a112af0ecb9f209acb0f8b67e145 /gv.c
parentf9738a7f833dee4b6953b05d93d3f222f78be370 (diff)
downloadperl-e27ad1f20b87bf08f3461d0be498f8d4da22a576.tar.gz
Re: Bug stomping fun. [PATCH: bug #1016]
Message-Id: <1051872303.26203.104.camel@supox> (plus perldiag nit) p4raw-id: //depot/perl@19505
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gv.c b/gv.c
index 489ed0bdef..95d4d36c67 100644
--- a/gv.c
+++ b/gv.c
@@ -194,6 +194,10 @@ Perl_gv_fetchmeth(pTHX_ HV *stash, const char *name, STRLEN len, I32 level)
return 0;
}
+ if (!HvNAME(stash))
+ Perl_croak(aTHX_
+ "Can't use anonymous symbol table for method lookup");
+
if ((level > 100) || (level < -100))
Perl_croak(aTHX_ "Recursive inheritance detected while looking for method '%s' in package '%s'",
name, HvNAME(stash));
@@ -1064,14 +1068,20 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type)
void
Perl_gv_fullname4(pTHX_ SV *sv, GV *gv, const char *prefix, bool keepmain)
{
+ char *name;
HV *hv = GvSTASH(gv);
if (!hv) {
(void)SvOK_off(sv);
return;
}
sv_setpv(sv, prefix ? prefix : "");
- if (keepmain || strNE(HvNAME(hv), "main")) {
- sv_catpv(sv,HvNAME(hv));
+
+ if (!HvNAME(hv))
+ name = "__ANON__";
+ else
+ name = HvNAME(hv);
+ if (keepmain || strNE(name, "main")) {
+ sv_catpv(sv,name);
sv_catpvn(sv,"::", 2);
}
sv_catpvn(sv,GvNAME(gv),GvNAMELEN(gv));
@@ -1393,7 +1403,7 @@ Perl_gv_handler(pTHX_ HV *stash, I32 id)
AMT *amtp;
CV *ret;
- if (!stash)
+ if (!stash || !HvNAME(stash))
return Nullcv;
mg = mg_find((SV*)stash, PERL_MAGIC_overload_table);
if (!mg) {