Branch: refs/heads/blead
Home: https://github.com/Perl/perl5
Commit: 999b4e2f823bb3637377cedf1548ce7eb27ab6c0
https://github.com/Perl/perl5/commit/999b4e2f823bb3637377cedf1548ce7eb27ab6c0
Author: Dagfinn Ilmari Mannsåker <[email protected]>
Date: 2021-12-16 (Thu, 16 Dec 2021)
Changed paths:
M t/lib/feature/bareword_filehandles
M toke.c
Log Message:
-----------
Fix function calls being misinterpreted as bareword filehandles
When bareword filehandles are disabled, the parser was interpreting
any bareword as a filehandle, even when immediatey followed by parens:
$ perl -M-feature=bareword_filehandles -le 'print foo()'
Bareword filehandle "foo" not allowed under 'no feature
"bareword_filehandles"' at -e line 1.
While with the feature enabled, it works and prints the value returned
by the function:
$ perl -le 'sub foo { @_ } print foo("bar")'
bar
As for filehandles versus functions, a space before the parens makes
the difference:
$ perl -le 'print STDOUT ("bar")'
bar
$ perl -le 'print STDOUT("bar")'
Undefined subroutine &main::STDOUT called at -e line 1.
This fixes the bug by using the already-existing "immediate_paren"
variable to make it consistent when the feature is disabled.
Fixes #19271
Commit: 5f5ca502c6f3b230ff3faa1a80c6009715f9970c
https://github.com/Perl/perl5/commit/5f5ca502c6f3b230ff3faa1a80c6009715f9970c
Author: Dagfinn Ilmari Mannsåker <[email protected]>
Date: 2021-12-16 (Thu, 16 Dec 2021)
Changed paths:
M t/lib/feature/bareword_filehandles
M toke.c
Log Message:
-----------
Also fix paren-less calls of subs where a filehandle could be
If a sub exists, it takes precedence over the filehandle
interpretation even without the parens:
$ perl -le 'sub foo { "bar" } print foo;'
bar
Compare: https://github.com/Perl/perl5/compare/59f2a7f55726...5f5ca502c6f3