summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-07-04 16:28:40 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-07-04 16:28:40 +0000
commitc1899e02bd58ea340a8d89dc821ccba4502a63a7 (patch)
treee03a13cc8205f85fe3572f3ca8efb8b35b017c7d /pp_hot.c
parentf199104684ce3695f33e22530039c0b087f1a163 (diff)
downloadperl-c1899e02bd58ea340a8d89dc821ccba4502a63a7.tar.gz
better diagnostic on Frob->stuff() when Frob:: doesn't exist
(from Richard Soderberg <rs@oregonnet.com>) p4raw-id: //depot/perl@6306
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/pp_hot.c b/pp_hot.c
index b066b21832..2775003c8a 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2884,6 +2884,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
char* leaf = name;
char* sep = Nullch;
char* p;
+ GV* gv;
for (p = name; *p; p++) {
if (*p == '\'')
@@ -2899,9 +2900,18 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
packname = name;
packlen = sep - name;
}
- Perl_croak(aTHX_
- "Can't locate object method \"%s\" via package \"%s\"",
- leaf, packname);
+ gv = gv_fetchpv(packname, 0, SVt_PVHV);
+ if (gv && isGV(gv)) {
+ Perl_croak(aTHX_
+ "Can't locate object method \"%s\" via package \"%s\"",
+ leaf, packname);
+ }
+ else {
+ Perl_croak(aTHX_
+ "Can't locate object method \"%s\" via package \"%s\"
+ " (perhaps you forgot to load \"%s\"?)",
+ leaf, packname, packname);
+ }
}
return isGV(gv) ? (SV*)GvCV(gv) : (SV*)gv;
}