From 7d2057d821be137073b284c6ce586dfd519fd13b Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sat, 7 Jul 2012 23:46:52 -0700 Subject: [PATCH] =?utf8?q?=E2=80=98Undefined=20subroutine=20&foo=20called?= =?utf8?q?=E2=80=99=20for=20lex=20subs?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit instead of just ‘Undefined subroutine called’ without the name. --- pp_hot.c | 6 +++++- t/cmd/lexsub.t | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pp_hot.c b/pp_hot.c index 0d70dfc..45c5eb7 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2625,8 +2625,12 @@ PP(pp_entersub) SV* sub_name; /* anonymous or undef'd function leaves us no recourse */ - if (CvANON(cv) || !(gv = CvGV(cv))) + if (CvANON(cv) || !(gv = CvGV(cv))) { + if (CvNAMED(cv)) + DIE(aTHX_ "Undefined subroutine &%"HEKf" called", + HEKfARG(CvNAME_HEK(cv))); DIE(aTHX_ "Undefined subroutine called"); + } /* autoloaded stub? */ if (cv != GvCV(gv)) { diff --git a/t/cmd/lexsub.t b/t/cmd/lexsub.t index e0289b1..de5db96 100644 --- a/t/cmd/lexsub.t +++ b/t/cmd/lexsub.t @@ -132,9 +132,7 @@ is do foo(), 43, 'state sub falling out of scope (called via amper)'; } 44 } -::on; sb(1); -::off; sub sb2 { 43 } state sub sb2; sub sb2 { -- 2.7.4