‘Undefined subroutine &foo called’ for lex subs
authorFather Chrysostomos <sprout@cpan.org>
Sun, 8 Jul 2012 06:46:52 +0000 (23:46 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 16 Sep 2012 05:45:00 +0000 (22:45 -0700)
instead of just ‘Undefined subroutine called’ without the name.

pp_hot.c
t/cmd/lexsub.t

index 0d70dfc..45c5eb7 100644 (file)
--- 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)) {
index e0289b1..de5db96 100644 (file)
@@ -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 {