Re: What about Perl autodie?

Поиск
Список
Период
Сортировка
От Daniel Gustafsson
Тема Re: What about Perl autodie?
Дата
Msg-id ACFA6733-68B8-447F-8A4F-6B77A0BA9F30@yesql.se
обсуждение исходный текст
Ответ на Re: What about Perl autodie?  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
Список 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 по дате отправления:

Предыдущее
От: Jacob Champion
Дата:
Сообщение: Re: sslinfo extension - add notbefore and notafter timestamps
Следующее
От: Étienne BERSAC
Дата:
Сообщение: Re: REVOKE FROM warning on grantor