Re: What about Perl autodie?

From: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, John Naylor <johncnaylorls(at)gmail(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Subject: Re: What about Perl autodie?
Date: 2024-03-18 13:18:43
Message-ID: 87h6h3k79o.fsf@wibble.ilmari.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:

>> On 18 Mar 2024, at 07:27, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
>> After some pondering, I figured the exclude list is better.
>
> Agreed.
>
>> So here is a squashed patch, also with a complete commit message.
>
> Looks good from a read-through. It would have been nice to standardize on
> using one of "|| die" and "or die" consistently but that's clearly not for this
> body of work.

"or die" is generally the preferred form, since || has higher precedence
than comma, so it's easy to make mistakes if you don't parenthesise the
function args, like:

open my $fh, '>', $filname || die "can't open $filename: $!";

which will only fail if $filename is falsy (i.e. undef, "", or "0").

- ilmari

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2024-03-18 13:24:46 Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan
Previous Message Jacob Champion 2024-03-18 13:17:18 Re: Support json_errdetail in FRONTEND builds