diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-05-31 21:32:28 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-05-31 21:32:28 -0700 |
commit | 69b22cd191e9b6eff1e60a75aa38b87646cfb775 (patch) | |
tree | 45a707e25fd637c2f89f7e6d318ab3512755a6c8 /form.h | |
parent | 6b8305409e650748b2e6fb75634200370b69238b (diff) | |
download | perl-69b22cd191e9b6eff1e60a75aa38b87646cfb775.tar.gz |
Make empty lvalue subs work correctly
In perl 5.8.1 and earlier, sub{} would return @_ in list context. This
was fixed in 5.8.2 for regular subs, but not lvalue subs.
Before the syntactic restriction on return values was removed in
commit 145b2bb, there was a bug affecting compilation of empty subs
before any use statement:
$ perl5.14.0 -e 'sub foo :lvalue {}'
Can't modify stub in lvalue subroutine return at -e line 1, near "{}"
Execution of -e aborted due to compilation errors.
$ perl5.14.0 -le 'use sigtrap; sub foo :lvalue {} print "ok"'
ok
But I digress. :-)
Up to 5.14, lvalue subs were still returning @_, or, rather, the ele-
ments of @_ as separate scalars:
$ perl5.14.0 -Mre -le '(sub :lvalue {}->($a,$b))=(3,4); print "$a $b"'
Useless use of "re" pragma at -e line 0
3 4
(Not exactly useless, eh? The -Mre allows the sub to compile.)
This commit fixes that bug.
Diffstat (limited to 'form.h')
0 files changed, 0 insertions, 0 deletions