Re: What about Perl autodie? - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: What about Perl autodie?
Date
Msg-id ACFA6733-68B8-447F-8A4F-6B77A0BA9F30@yesql.se
Whole thread Raw
In response to Re: What about Perl autodie?  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
List pgsql-hackers
> On 18 Mar 2024, at 14:18, Dagfinn Ilmari Mannsåker <ilmari@ilmari.org> wrote:
> Daniel Gustafsson <daniel@yesql.se> writes:

>> 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").

Thanks for the clarification!  Looking over the || die() codepaths we have, and
we'll add as part of this patchset, none are vulnerable to the above issue
AFAICT.

--
Daniel Gustafsson




pgsql-hackers by date:

Previous
From: Jacob Champion
Date:
Subject: Re: sslinfo extension - add notbefore and notafter timestamps
Next
From: Étienne BERSAC
Date:
Subject: Re: REVOKE FROM warning on grantor