summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-07-07 23:39:07 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-07-08 00:24:11 -0700
commitc220e1a11e00efe060ea99925553cb1e03e3363a (patch)
tree09183cee50c75b20540fa4fad54eb5260aab0419 /pp_hot.c
parent12f98b43fb8a44e8dfde5d99489b6a599bb91908 (diff)
downloadperl-c220e1a11e00efe060ea99925553cb1e03e3363a.tar.gz
Correct err msg when calling stub w/no autoload fb
If an AUTOLOAD subroutine loads a sub by assigning to the glob, there may be code elsewhere that has a reference to a stub, that is now assigned over. To cope with this situation, calls to undefined sub- routines will fall back to whatever sub is in the subroutine’s owner typeglob. This has been the case since Perl 5.000. But the error message that occurs if the typeglob happens to have no sub in it is wrong: $ perl -e ' my $foosub = \&foo; undef *foo; &$foosub; ' Not a CODE reference at -e line 4. as opposed to this: $ perl -e ' my $foosub = \&foo; &$foosub; ' Undefined subroutine &main::foo called at -e line 3. They should both produce the same error message, because $foosub is a code reference, albeit without a body.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 77b707cc13..38c49a068a 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2648,15 +2648,15 @@ try_autoload:
{
cv = GvCV(autogv);
}
- /* sorry */
else {
+ sorry:
sub_name = sv_newmortal();
gv_efullname3(sub_name, gv, NULL);
DIE(aTHX_ "Undefined subroutine &%"SVf" called", SVfARG(sub_name));
}
}
if (!cv)
- DIE(aTHX_ "Not a CODE reference");
+ goto sorry;
goto retry;
}