This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #81290] assertion failure with lock &lvsub
authorFather Chrysostomos <sprout@cpan.org>
Thu, 21 Jul 2011 06:52:57 +0000 (23:52 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 21 Jul 2011 06:53:23 +0000 (23:53 -0700)
commitf4df43b5ee48f8f744bf0e51a622822865e03c4b
tree6bb1d3d60059b5eec3a6732af95939a342660d9b
parent7dbf2beb71242008630175c6aaac814cb97e7785
[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"_"
MANIFEST
op.c
pod/perldelta.pod
t/op/lock.t [new file with mode: 0644]