develooper Front page | perl.perl5.porters | Postings from September 2013

Re: [perl #119873] Bleadperl v5.19.3-583-g80d2c56 breaks WSNYDER/IPC-Locker-1.492.tar.gz

Thread Previous | Thread Next
From:
ilmari
Date:
September 18, 2013 12:38
Subject:
Re: [perl #119873] Bleadperl v5.19.3-583-g80d2c56 breaks WSNYDER/IPC-Locker-1.492.tar.gz
Message ID:
d8jbo3qxq2w.fsf@dalvik.ping.uio.no
Steve Hay <steve.m.hay@googlemail.com> writes:

> On 18 September 2013 10:54, Andreas Koenig
> <andreas.koenig.7os6VVqR@franz.ak.mind.de> wrote:
>> Steve Hay <Steve.Hay@verosoftware.com> writes:
>>
>>> I'm confused by this report (and the three cpantesters reports listed
>>> above) because the offending commit (80d2c56d79) only changes anything
>>> when running on MSWin32, but all these reports are from linux.
>>
>> Precendence of the ternary:
>>
>> % perl -MO=Deparse,-p
>> $^O eq 'MSWin32' &&$! == ($] < 5.019004) ? 10022 : Errno::EINVAL
>> ^D
>> ((($^O eq 'MSWin32') && ($! == ($] < 5.019004))) ? '???' : '???');
>> - syntax OK
>>
>
> Gah!
>
> Thanks for pointing that out. Now fixed in commit a576a29029.

If the intention is to compare $! to a different value depending on the
condition $] < 5.019004, it's still wrong, due to the low precedence of
the ternary operator:

    $ perl -MO=Deparse,-p
    ($! == ($] < 5.019004) ? 10022 : Errno::EINVAL)
    ^D
    (($! == ($] < 5.019004)) ? '???' : '???');
    - syntax OK

You need this:

    $ perl -MO=Deparse,-p
    ($! == ($] < 5.01904 ? 10022 : Errno::EINVAL))
    ^D
    ($! == (($] < 5.01904) ? 10022 : 'Errno::EINVAL'));
    - syntax OK

Add the extra parentheses around the condition if you wish to be
explicit.


-- 
- Twitter seems more influential [than blogs] in the 'gets reported in
  the mainstream press' sense at least.               - Matt McLeod
- That'd be because the content of a tweet is easier to condense down
  to a mainstream media article.                      - Calle Dybedahl


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About