summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorAbhijit Menon-Sen <ams@wiw.org>2002-03-16 02:38:08 +0000
committerAbhijit Menon-Sen <ams@wiw.org>2002-03-16 02:38:08 +0000
commit3ad83ce7d21aa3aa1ac69bde413ed71b6ce30329 (patch)
tree3dbac8a96fbc1b5225f84d2a9d7e4f0984ff860b /gv.c
parent6e6372ba61ad0832b23176adf895ff047ad66cc7 (diff)
downloadperl-3ad83ce7d21aa3aa1ac69bde413ed71b6ce30329.tar.gz
Subject: [PATCH @15047] Use of inherited AUTOLOAD for non-method
*::DESTROY() is deprecated From: Ilya Zakharevich <ilya@math.ohio-state.edu> Date: Thu, 14 Mar 2002 18:39:22 -0500 Message-Id: <20020314183922.A8448@math.ohio-state.edu> Subject: Re: [PATCH @15047] Use of inherited AUTOLOAD for non-method *::DESTROY() is deprecated From: Dave Mitchell <davem@fdgroup.com> Date: Fri, 15 Mar 2002 19:22:49 +0000 Message-Id: <20020315192249.A22389@fdgroup.com> p4raw-link: @15047 on //depot/perl: 0cce8c827906d6294f47c30840f886b52d8345f8 p4raw-id: //depot/perl@15251
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gv.c b/gv.c
index 3785a2b465..6fd5ff75df 100644
--- a/gv.c
+++ b/gv.c
@@ -1412,6 +1412,7 @@ Perl_gv_handler(pTHX_ HV *stash, I32 id)
{
MAGIC *mg;
AMT *amtp;
+ CV *ret;
if (!stash)
return Nullcv;
@@ -1425,8 +1426,21 @@ Perl_gv_handler(pTHX_ HV *stash, I32 id)
if ( amtp->was_ok_am != PL_amagic_generation
|| amtp->was_ok_sub != PL_sub_generation )
goto do_update;
- if (AMT_AMAGIC(amtp))
- return amtp->table[id];
+ if (AMT_AMAGIC(amtp)) {
+ ret = amtp->table[id];
+ if (ret && isGV(ret)) { /* Autoloading stab */
+ /* Passing it through may have resulted in a warning
+ "Inherited AUTOLOAD for a non-method deprecated", since
+ our caller is going through a function call, not a method call.
+ So return the CV for AUTOLOAD, setting $AUTOLOAD. */
+ GV *gv = gv_fetchmethod(stash, (char*)PL_AMG_names[id]);
+
+ if (gv && GvCV(gv))
+ return GvCV(gv);
+ }
+ return ret;
+ }
+
return Nullcv;
}