This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow ‘sub x :lvalue’ to apply to XSUBs and stubs
authorFather Chrysostomos <sprout@cpan.org>
Fri, 17 Jun 2011 15:21:50 +0000 (08:21 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 17 Jun 2011 15:28:54 +0000 (08:28 -0700)
commit4dbb339a42f47d222b16b1c32189decd83eecfda
tree044a88077ad87b942d50307a496dcf13f0a3ddb6
parent815dd406a7217429564c39cb160845d317b6da75
Allow ‘sub x :lvalue’ to apply to XSUBs and stubs

This was disabled in 5.12 (with a warning) by commit 885ef6f5, because
applying the attribute to a Perl sub isn’t effective: it does not mod-
ify the op tree accordingly.

But applying an attribute to an XSUB after the fact is perfectly
fine, and is the only way to do it (either with declarative syntax or
attributes.pm).  This commit restores the old behaviour of declarative
for XSUBs.  (attributes.pm never stopped working.)

Commit 885ef6f5 also stopped a declaration from applying the flag to
an undefined subroutine if it happens to have been assigned from else-
where.  It does not make sense to allow the :method attribute to be
applied to such a sub, but not :lvalue.
op.c
pod/perldelta.pod
t/op/sub_lval.t