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
'unless', as opposed to 'if', does not issue a warning #15113
Comments
From mguttman4@gmail.comReply-To: mguttman4@gmail.com This is a bug report for perl from mguttman4@gmail.com, # I made a (typical for me) mistake and in the condition of an 'unless' use strict; use Data::Dumper; $Data::Dumper::Sortkeys = 1; my %original = (aaa=>1, bbb=> 2, ccc=> 2, ddd=> 3, eee=> 1, fff=> 0, ggg=> ########## The correct version ########## # prints: ########## The wrong one but still 'unless' ########## # Prints: # prints essentially the same but, ok, big but, with a warning! Flags: Site configuration information for perl 5.18.2: Configured by strawberry-perl at Tue Jan 7 22:34:04 2014. Summary of my perl5 (revision 5 version 18 subversion 2) configuration: Platform: Locally applied patches: @INC for perl 5.18.2: Environment for perl 5.18.2: PATH=C:\ProgramData\Oracle\Java\javapath;C:\strawberry\perl\bin;C:\Program |
From @jkeenanOn Sat Jan 02 05:39:05 2016, mguttman4@gmail.com wrote:
I confess I'm having difficulty replicating your problem. Can you simplify the statement by presenting just the code which you feel should throw a warning but fails to do so? Thank you very much.
-- |
The RT System itself - Status changed from 'new' to 'open' |
From @jkeenanOn Sat Jan 02 18:35:30 2016, jkeenan wrote:
Okay, I think I have a clearer example: ########## for my $i ( 1..2 ) { If I understand you correctly, you would expect to get *2* "Found = in conditional" warnings: the one shown at line 16 and another at line 20. Yes, this seems like a bug to me. Thank you very much.
-- |
From zefram@fysh.orgJames E Keenan via RT wrote:
I believe the complaint amounts to this disparity: $ perl -lwe 'if($a = 2) { }' I expect this occurs due to unless() being rewritten to if(!()). -zefram |
From @tonycozOn Sat Jan 02 19:26:32 2016, zefram@fysh.org wrote:
Given newCONDOP()'s parameters that seems simple to fix as with the attached. until ($x = 0) { ... } has a similar issue, but the fix won't be quite so simple. Tony |
From @jkeenanOn Sun Jan 03 15:20:51 2016, tonyc wrote:
Correctly handles the test file I attached: ########## I've sent the patch for smoking in the smoke-me/jkeenan/tonyc/127122-unless branch. -- |
From mguttman4@gmail.comDear James Here is a lot simpler one: use strict; my %original = (aaa=>1, bbb=> 2, eee=> 1, fff=> 0, jjj=> 0); say "now with 'unless':"; foreach my $key ( sort keys %original ){ say "now with 'if'-'else':"; foreach my $key ( sort keys %original ){ #Prints: # Please note, the warning is only about line 19, NOT line 10! On Sun, Jan 3, 2016 at 4:47 AM, James E Keenan via RT <
-- |
From @tonycozOn Sun Jan 03 15:20:51 2016, tonyc wrote:
Applied as 08b3e84.
Created ticket 127933 for this. Tony |
@tonycoz - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for submitting this report. You have helped make Perl better. Perl 5.24.0 may be downloaded via https://metacpan.org/release/RJBS/perl-5.24.0 |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#127122 (status was 'resolved')
Searchable as RT127122$
The text was updated successfully, but these errors were encountered: