Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the IO-All CPAN distribution.

Report information
The Basics
Id: 87200
Status: resolved
Priority: 0/
Queue: IO-All

People
Owner: Nobody in particular
Requestors: rurban [...] x-ray.at
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] wrong return precedence
returns binds stronger than or, so the expression after or is ignored. See https://rt.perl.org/rt3/Public/Bug/Display.html?id=59802
Subject: IO-All-0.46-returnor.patch
diff -bu IO-All-0.46-XOGh8X/lib/IO/All.pm~ IO-All-0.46-XOGh8X/lib/IO/All.pm --- IO-All-0.46-XOGh8X/lib/IO/All.pm~ 2012-07-25 18:34:32.000000000 -0600 +++ IO-All-0.46-XOGh8X/lib/IO/All.pm 2013-07-21 08:32:05.971125231 -0600 @@ -610,8 +610,8 @@ } } $self->error_check; - return (@lines) or - $self->_autoclose && $self->close && () or + return (@lines) || + $self->_autoclose && $self->close && () || (); }
The attached patch is not correct. % perl -le ' my @lines = (42); sub before { return (@lines) or die; } print before(); sub after { return (@lines) || die; } print after(); ' 42 1
On Sun Sep 22 01:46:58 2013, ANDK wrote: Show quoted text
> The attached patch is not correct. > > % perl -le ' > my @lines = (42); > sub before { > return (@lines) or die; > } > print before(); > sub after { > return (@lines) || die; > } > print after(); > ' > 42 > 1
It is: $ perl -e'my @lines = (42); sub before { return (@lines) or die "before"; } print before(); sub after { return (@lines) || die "after"; } @lines=(); print before(); print after();' after at -e line 7. the first or die is ignored, but it shouldn't. -- Reini Urban
RT-Send-CC: RURBAN [...] cpan.org
Ugggh, communication gap. I'm sorry, I thought my example should be obvious enough. I should have known better. I stand to my claim that your patch is not correct, because it changes the return value of the command return(@lines) in the case where @lines contains a value. I'm not talking about the empty array @lines, I'm talking about the array @lines with an element. So please review my counter example once again: % perl -le ' my @lines = (42); sub before { return (@lines) or die; } print before(); sub after { return (@lines) || die; } print after(); ' 42 1 If you *only* change the C<or> to C<||>, then you change the return value of the subroutine from 42 to 1 in the case that @lines contains 42. This is why I said your patch is wrong. Clear now?
Fixed in 0.50