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
bogus syntax errors with 'use subs' #16371
Comments
From @sisyphusHi, Following are 2 simple scripts that fail to compile. ################################ use warnings; if( FOO < 43) { print "a\n" } sub FOO { return 42 } C:\_32\pscrpt>perl subs.pl ################################ Pre-declaring 'sub FOO' makes no difference. ################################ use warnings; if( FOO <=> 43 ) { print "a\n" } sub FOO { return 42 } C:\_32\pscrpt>perl subs2.pl Again, the only workarounds I have are to either append parens to FOO, or to Another failing case (with identical error to the first script) is the Cheers, My perl -V is: Summary of my perl5 (revision 5 version 27 subversion 7) configuration: Platform: Characteristics of this binary (from libperl): |
From zefram@fysh.orgSisyphus wrote:
Both of your failures have the same cause: the "<" is interpreted $ perl -lwe 'sub FOO; if (FOO < 43) { print "a"; } sub FOO { return 42; }' The same problem applies to other characters that can be either the $ perl -lwe 'sub FOO { return 42; } print FOO + 1; print FOO() + 1' This isn't a bug, but an intentional grammatical feature. Using explicit $ perl -lwe 'sub FOO () { return 42; } if (FOO < 43) { print "a"; } print FOO + 1' -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From @sisyphus-----Original Message----- Sisyphus wrote:
I hadn't thought of that solution - and it's a very useful one because, However, I think the subs documentation should at least acknowledge this Currently the documentation simply states that use subs " will predeclare (I just noticed a small typo in that section of the docs that I quoted - Cheers, |
From @xsawyerxOn 01/20/2018 04:54 AM, sisyphus1@optusnet.com.au wrote:
Relevant to this is the following Perl::Critic policy: https://metacpan.org/pod/Perl::Critic::Policy::ValuesAndExpressions::ConstantBeforeLt |
@arc - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been Perl 5.28.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#132744 (status was 'resolved')
Searchable as RT132744$
The text was updated successfully, but these errors were encountered: