From: Jarkko Hietaniemi Date: Wed, 26 Jul 2000 17:49:14 +0000 (+0000) Subject: Allow "sub AUTOLOAD;" to stop AUTOLOAD inheritance, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ed8504609e65bf608915df5053decb2c1e5c56e9;p=p5sagit%2Fp5-mst-13.2.git Allow "sub AUTOLOAD;" to stop AUTOLOAD inheritance, from Graham Barr in the module list. p4raw-id: //depot/perl@6444 --- diff --git a/gv.c b/gv.c index f18f174..22e419e 100644 --- a/gv.c +++ b/gv.c @@ -418,6 +418,9 @@ Perl_gv_autoload4(pTHX_ HV *stash, const char *name, STRLEN len, I32 method) return Nullgv; cv = GvCV(gv); + if (!CvROOT(cv)) + return Nullgv; + /* * Inheriting AUTOLOAD for non-methods works ... for now. */ diff --git a/pod/perlobj.pod b/pod/perlobj.pod index 4e45aff..9a9bda9 100644 --- a/pod/perlobj.pod +++ b/pod/perlobj.pod @@ -168,6 +168,12 @@ the method that was intended to be called. If none of that works, Perl finally gives up and complains. +If you want to stop the AUTOLOAD inheritance say simply + + sub AUTOLOAD; + +and the call will die using the name of the sub being called. + Perl classes do method inheritance only. Data inheritance is left up to the class itself. By and large, this is not a problem in Perl, because most classes model the attributes of their object using an