In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/cf6e1fa1d43a0c317bbfc49f64171122b655a07e?hp=a5591204f2a9c91d685b247ee26652f9cf28af34>
- Log ----------------------------------------------------------------- commit cf6e1fa1d43a0c317bbfc49f64171122b655a07e Author: Father Chrysostomos <[email protected]> Date: Fri Oct 17 21:42:39 2014 -0700 Document variants of âCanât modifyâ individually ----------------------------------------------------------------------- Summary of changes: op.c | 6 ++---- pod/perldiag.pod | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/op.c b/op.c index a2d4027..f26f0d3 100644 --- a/op.c +++ b/op.c @@ -2355,7 +2355,6 @@ S_lvref(pTHX_ OP *o, I32 type) o->op_flags |= OPf_STACKED; if (o->op_flags & OPf_PARENS) { if (o->op_private & OPpLVAL_INTRO) { - /* diag_listed_as: Can't modify %s in %s */ yyerror(Perl_form(aTHX_ "Can't modify reference to " "localized parenthesized array in list assignment")); return; @@ -2389,7 +2388,6 @@ S_lvref(pTHX_ OP *o, I32 type) case OP_RV2HV: if (o->op_flags & OPf_PARENS) { parenhash: - /* diag_listed_as: Can't modify %s in %s */ yyerror(Perl_form(aTHX_ "Can't modify reference to " "parenthesized hash in list assignment")); return; @@ -2446,7 +2444,7 @@ S_lvref(pTHX_ OP *o, I32 type) /* FALLTHROUGH */ default: badref: - /* diag_listed_as: Can't modify %s in %s */ + /* diag_listed_as: Can't modify reference to %s in %s assignment */ yyerror(Perl_form(aTHX_ "Can't modify reference to %s in %s", o->op_type == OP_NULL && o->op_flags & OPf_SPECIAL ? "do block" @@ -10168,7 +10166,7 @@ Perl_ck_refassign(pTHX_ OP *o) break; default: bad: - /* diag_listed_as: Can't modify %s in %s */ + /* diag_listed_as: Can't modify reference to %s in %s assignment */ yyerror(Perl_form(aTHX_ "Can't modify reference to %s in scalar " "assignment", OP_DESC(varop))); diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 46052b8..863caf1 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1052,6 +1052,28 @@ a NULL. (F) Subroutines meant to be used in lvalue context should be declared as such. See L<perlsub/"Lvalue subroutines">. +=item Can't modify reference to %s in %s assignment + +(F) Only a limited number of constructs can be used as the argument to a +reference constructor on the left-hand side of an assignment, and what +you used was not one of them. See L<perlref/Assigning to References>. + +=item Can't modify reference to localized parenthesized array in list +assignment + +(F) Assigning to C<\local(@array)> or C<\(local @array)> is not supported, as +it is not clear exactly what it should do. If you meant to make @array +refer to some other array, use C<\@array = \@other_array>. If you want to +make the elements of @array aliases of the scalars referenced on the +right-hand side, use C<\(@array) = @scalar_refs>. + +=item Can't modify reference to parenthesized hash in list assignment + +(F) Assigning to C<\(%hash)> is not supported. If you meant to make %hash +refer to some other hash, use C<\%hash = \%other_hash>. If you want to +make the elements of %hash into aliases of the scalars referenced on the +right-hand side, use a hash slice: C<\@hash{@keys} = @those_scalar_refs>. + =item Can't msgrcv to read-only var (F) The target of a msgrcv must be modifiable to be used as a receive -- Perl5 Master Repository
