This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow the \$ proto to accept any scalar lvalue [perl #91846]
authorFather Chrysostomos <sprout@cpan.org>
Fri, 24 Jun 2011 06:14:17 +0000 (23:14 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 24 Jun 2011 15:19:27 +0000 (08:19 -0700)
commit062678b2241d3d1cc3a46f80f402cf4147b825f1
tree869c6c549fac533a09cf512a92680e2034916dfe
parentf5d552b480dda142e3e1fc3a463194ebdf0b8b3e
Allow the \$ proto to accept any scalar lvalue [perl #91846]

This makes the \$ prototype’s parsing the same as the second argument
to read(), making it possible to create a custom myread() function
that has the same syntax.

This is handled in two places in the prototype-parsing code, to avoid
calling scalar() on the op if another character in \[...] will accept
it.  I don’t know what the consequences of that would be.  So it calls
Perl_op_lvalue_flags in the $ case only if it is not inside brackets.
Then in the ] case it checks to see whether there was a $.

OP_READ, not OP_ENTERSUB, is passed as the type to
Perl_op_lvalue_flags, since OP_ENTERSUB would allow sub foo(\$) to
accept an array as an argument.  OP_RECV and OP_SYSREAD would have
worked, too.
op.c
pod/perldelta.pod
t/comp/proto.t