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
use || not or! :-) #10781
Comments
From alex.davies@talktalk.netCreated by alex@AmelieSpotted the following (likely) misuses of C<or>: :: cpan\Archive-Tar\lib\Archive\Tar.pm :: cpan\Module-Load-Conditional\lib\Module\Load\Conditional.pm :: utils\h2xs.PL The C<or>s should be C<||>s. [I was surprised that this usage didn't generate a warning; but % perl -we "my $x = undef or 0;" ...remains silent] Perl Info
|
From @ikegamiThanks for the report. One catch: bugs for modules in cpan/ should be
0 and 1 don't generate warnings for being used in void context.
|
The RT System itself - Status changed from 'new' to 'open' |
From @chornyOn Fri Oct 29 10:52:14 2010, alex.davies@talktalk.net wrote:
Submitted patches to corresponding repositories.
Patch attached. -- |
From @chorny0001-instead-of-or-perl-78708.patchFrom 4cfc00f98b1d7921629fe7d00c9519885f018f06 Mon Sep 17 00:00:00 2001
From: Alexandr Ciornii <alexchorny@gmail.com>
Date: Wed, 7 Sep 2011 00:30:46 +0300
Subject: [PATCH] || instead of "or" (perl#78708)
---
utils/h2xs.PL | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/utils/h2xs.PL b/utils/h2xs.PL
index 634e891..90d8ece 100644
--- a/utils/h2xs.PL
+++ b/utils/h2xs.PL
@@ -893,7 +893,7 @@ if( @path_h ){
}
else {
# Work from miniperl too - on "normal" systems
- my $SEEK_SET = eval 'use Fcntl qw/SEEK_SET/; SEEK_SET' or 0;
+ my $SEEK_SET = eval 'use Fcntl qw/SEEK_SET/; SEEK_SET' || 0;
seek CH, 0, $SEEK_SET;
my $src = do { local $/; <CH> };
close CH;
--
1.7.6.msysgit.0
|
From @hvds"Alexandr Ciornii via RT" <perlbug-followup@perl.org> wrote: Um, that's wrong too. You'll need parens. Hugo |
From @tamiasOn Mon, Dec 05, 2011 at 07:59:27AM +0000, hv@crypt.org wrote:
It appears to parse as desired without the parens: % perl -MO=Deparse,-p -e 'my $SEEK_SET = eval "use Fcntl qw/SEEK_SET/; SEEK_SET" || 0;' Ronald |
From @AbigailOn Mon, Dec 05, 2011 at 09:43:59AM -0500, Ronald J Kimball wrote:
That's because named unary operators have a higher precedence than ||. It may not be clear to everyone that 'eval' is a named unary operator though. Abigail |
From @cpansproutOn Sun Dec 04 18:01:35 2011, chorny wrote:
Thank you. Applied as 70eec64. -- Father Chrysostomos |
@cpansprout - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#78708 (status was 'resolved')
Searchable as RT78708$
The text was updated successfully, but these errors were encountered: