diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-06-23 23:14:17 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-06-24 08:19:27 -0700 |
commit | 062678b2241d3d1cc3a46f80f402cf4147b825f1 (patch) | |
tree | 869c6c549fac533a09cf512a92680e2034916dfe /pod/perldelta.pod | |
parent | f5d552b480dda142e3e1fc3a463194ebdf0b8b3e (diff) | |
download | perl-062678b2241d3d1cc3a46f80f402cf4147b825f1.tar.gz |
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.
Diffstat (limited to 'pod/perldelta.pod')
-rw-r--r-- | pod/perldelta.pod | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 751da25964..d4bc3c359e 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -33,6 +33,15 @@ here, but most should go in the L</Performance Enhancements> section. You can now limit the size of an array using C<splice(@a,MAX_LEN)> without worrying about warnings. +=head2 The C<\$> prototype accepts any scalar lvalue + +The C<\$> and C<\[$]> subroutine prototypes now accept any scalar lvalue +argument. Previously they only accepted scalars beginning with C<$> and +hash and array elements. This change makes them consistent with the way +the built-in C<read> and C<recv> functions (among others) parse their +arguments. This means that one can override the built-in functions with +custom subroutines that parse their arguments the same way. + =head1 Security XXX Any security-related notices go here. In particular, any security |