develooper Front page | perl.perl5.porters | Postings from June 2018

[perl #133294] `perldoc -f do` has unneccessary condition

Thread Previous
From:
Zoffix Znet
Date:
June 22, 2018 18:26
Subject:
[perl #133294] `perldoc -f do` has unneccessary condition
Message ID:
rt-4.0.24-5376-1529691959-24.133294-75-0@perl.org
# New Ticket Created by  Zoffix Znet 
# Please include the string:  [perl #133294]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=133294 >


`perldoc -f do` for v5.26.0 as well as current https://perldoc.perl.org/functions/do.html as the very last code example list this code:

   for $file ("/share/prog/defaults.rc",
               "$ENV{HOME}/.someprogrc")
    {
        unless ($return = do $file) {
            warn "couldn't parse $file: $@" if $@;
            warn "couldn't do $file: $!"    unless defined $return;
            warn "couldn't run $file"       unless $return;
        }
    }


The last conditional (`unless $return) is not necessary as that entire block is already guarded by `unless ($return = ...)`


Thread Previous


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