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
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"_"