summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>2015-10-06 23:13:31 +0100
committerTony Cook <tony@develop-help.com>2015-10-12 15:21:45 +1100
commit0f948285b1d20fc918c76b133dd5bf40d0fa1221 (patch)
treeda0aebfee340547ad496eddc36c25b5725b1a387 /pp_hot.c
parent4a21999a595cf89f78d57aa5b3fdf3fbfa638fb1 (diff)
downloadperl-0f948285b1d20fc918c76b133dd5bf40d0fa1221.tar.gz
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.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c6
1 files changed, 4 insertions, 2 deletions
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