From 0f948285b1d20fc918c76b133dd5bf40d0fa1221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= Date: Tue, 6 Oct 2015 23:13:31 +0100 Subject: Include the name of the non-lvalue sub in error message This makes the cause of the error more obvious if you accidentally call a non-lvalue sub in the final position of an lvalue one. --- pp_hot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pp_hot.c') diff --git a/pp_hot.c b/pp_hot.c index d05e03fd13..9ac606665f 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -3427,7 +3427,8 @@ PP(pp_entersub) SAVETMPS; if (UNLIKELY((cx->blk_u16 & OPpENTERSUB_LVAL_MASK) == OPpLVAL_INTRO && !CvLVALUE(cv))) - DIE(aTHX_ "Can't modify non-lvalue subroutine call"); + DIE(aTHX_ "Can't modify non-lvalue subroutine call of &%"SVf, + SVfARG(cv_name(cv, NULL, 0))); /* warning must come *after* we fully set up the context * stuff so that __WARN__ handlers can safely dounwind() * if they want to @@ -3448,7 +3449,8 @@ PP(pp_entersub) & PUSHSUB_GET_LVALUE_MASK(Perl_is_lvalue_sub) ) & OPpENTERSUB_LVAL_MASK) == OPpLVAL_INTRO && !CvLVALUE(cv))) - DIE(aTHX_ "Can't modify non-lvalue subroutine call"); + DIE(aTHX_ "Can't modify non-lvalue subroutine call of &%"SVf, + SVfARG(cv_name(cv, NULL, 0))); if (UNLIKELY(!hasargs && GvAV(PL_defgv))) { /* Need to copy @_ to stack. Alternative may be to -- cgit v1.2.1