diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-07-20 23:52:57 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-07-20 23:53:23 -0700 |
commit | f4df43b5ee48f8f744bf0e51a622822865e03c4b (patch) | |
tree | 6bb1d3d60059b5eec3a6732af95939a342660d9b /op.c | |
parent | 7dbf2beb71242008630175c6aaac814cb97e7785 (diff) | |
download | perl-f4df43b5ee48f8f744bf0e51a622822865e03c4b.tar.gz |
[perl #81290] assertion failure with lock &lvsub
With this commit, locking an lvalue subroutine no longer tries to lock
the subroutine itself (triggering an assertion in pp_lock). Instead,
the &foo syntax is treated as a scalar lvalue expression, as with tie,
so the return value gets locked. Non-lvalue sub calls still produce a
‘Can't modify’ error, as they are not modifiable.
This also stops lock from trying to return a sub as though it were a
scalar, thereby breaking this JAPH I’ve just written:-)
sub _:lvalue{$x}for(lock&_){$_
="Just another Perl hacker,\n"}
print+prototype"_"
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1878,7 +1878,7 @@ Perl_doref(pTHX_ OP *o, I32 type, bool set_op_ref) switch (o->op_type) { case OP_ENTERSUB: - if ((type == OP_EXISTS || type == OP_DEFINED || type == OP_LOCK) && + if ((type == OP_EXISTS || type == OP_DEFINED) && !(o->op_flags & OPf_STACKED)) { o->op_type = OP_RV2CV; /* entersub => rv2cv */ o->op_ppaddr = PL_ppaddr[OP_RV2CV]; |