New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require parses barewords strangely #11824
Comments
From @cpansproutWhen require is followed by a bareword, if that bareword is followed by an operator that has higher precedence than require, it falls back to treating its argument as a normal expression, but not quite. Here is the special behaviour: $ perl5.15.5 -MO=Concise -e 'require a::b' Notice the "a/b.pm". Now if we put ‘. 1’ after it (+1 doesn’t work, because of bug #105924): $ perl5.15.5 -MO=Concise -we 'require a::b . 1' That I can understand, as a::b is a string in the absence of any other interpretation, ‘a::b . 1’ being the argument to require, which is more than a single bareword. But if there is a subroutine named a::b, things get strange: $ perl5.15.5 -MO=Concise -we 'sub a::b; require a::b . 1' The a::b should be a subroutine call. This may be related to #36333. Flags: Site configuration information for perl 5.15.5: Configured by sprout at Sun Dec 18 11:26:14 PST 2011. Summary of my perl5 (revision 5 version 15 subversion 5) configuration: Locally applied patches: @INC for perl 5.15.5: Environment for perl 5.15.5: |
From @cpansproutOn Sun Dec 25 14:20:49 2011, sprout wrote:
When ‘require’ is followed by a bareword, it is treated specially in 1. The token following it is forced to be a bareword, even if there is a Items 1 and 3 happen in the tokeniser, based on whether the token that This means that cases like ‘require a::b . "foo"’ treat a::b as a (This also means that ‘require foo’ is allowed under strict, but I’m wondering whether it would be possible to make the require code in Simply moving all the bareword handling to op.c won’t work, because -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Sun Dec 25 14:20:49 2011, sprout wrote:
When ‘require’ is followed by a bareword, it is treated specially in 1. The token following it is forced to be a bareword, even if there is a Items 1 and 3 happen in the tokeniser, based on whether the token that This means that cases like ‘require a::b . "foo"’ treat a::b as a (This also means that ‘require foo’ is allowed under strict, but I’m wondering whether it would be possible to make the require code in Simply moving all the bareword handling to op.c won’t work, because -- Father Chrysostomos |
@cpansprout - Status changed from 'new' to 'open' |
From @cpansproutOn Thu May 03 22:47:36 2012, sprout wrote:
I would prefer to avoid this method, if possible. If we introduce
I wonder whether we should somehow record the name of a sub (more -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Thu May 03 22:47:36 2012, sprout wrote:
I would prefer to avoid this method, if possible. If we introduce
I wonder whether we should somehow record the name of a sub (more -- Father Chrysostomos |
From @cpansproutThe plot thickens: $ perl -e 'sub v123{a} require v123()' $ perl -e 'sub v123{a} require +v123()' $ perl -e 'sub v123{a} require v123.""' $ perl -e 'sub v123{a} require v123 .""' $ perl -e 'sub v123{a} require v123' $ perl -e 'sub v123{a} require +v123' That whitespace is significant is troubling. That v123 could be It is not at all clear how these things are supposed to behave. -- Father Chrysostomos |
From [Unknown Contact. See original ticket]The plot thickens: $ perl -e 'sub v123{a} require v123()' $ perl -e 'sub v123{a} require +v123()' $ perl -e 'sub v123{a} require v123.""' $ perl -e 'sub v123{a} require v123 .""' $ perl -e 'sub v123{a} require v123' $ perl -e 'sub v123{a} require +v123' That whitespace is significant is troubling. That v123 could be It is not at all clear how these things are supposed to behave. -- Father Chrysostomos |
From @nwc10On Thu, May 10, 2012 at 06:38:26PM -0700, Father Chrysostomos via RT wrote:
Agree. It isn't. (No-one else seems to have commented) Nicholas Clark |
Migrated from rt.perl.org#107004 (status was 'open')
Searchable as RT107004$
The text was updated successfully, but these errors were encountered: