diff options
author | Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> | 2015-10-06 23:13:31 +0100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2015-10-12 15:21:45 +1100 |
commit | 0f948285b1d20fc918c76b133dd5bf40d0fa1221 (patch) | |
tree | da0aebfee340547ad496eddc36c25b5725b1a387 /pp_hot.c | |
parent | 4a21999a595cf89f78d57aa5b3fdf3fbfa638fb1 (diff) | |
download | perl-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.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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 |