Re: Generate GUC tables from .dat file

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: Generate GUC tables from .dat file
Дата
Msg-id 48E7965C-DF18-4D8A-A660-AFEA2F78CAD9@justatheory.com
обсуждение исходный текст
Ответ на Re: Generate GUC tables from .dat file  (John Naylor <johncnaylorls@gmail.com>)
Список pgsql-hackers
Hi John,

On Sep 1, 2025, at 03:21, John Naylor <johncnaylorls@gmail.com> wrote:

> I find the loop over @parse a lot less readable this way.

Yeah, that’s the trade-off. Probably not worth it to reduce legibility.

>> * Use the /r regex return sequence to simplify dquote() (requires Perl 5.14, IIRC)
>
> I think our perlcritic configuration would complain about the lack of
> return statement.

Oh, I ran the indenter but not perlcritic.

>> * Use {$fh} syntax to make file handle arguments clearer
>
> With this I wonder why the variable looks different for `print` vs. `open`.

I’ve never seen {} used with open. I just tried it, and Perl complained:

    Use of uninitialized value $fh in anonymous hash ({}) at try line 8.

The use of {$fh} with print/say always looked like an exception to me, I’m not sure what the syntax resolves to, but
it’snot a hash reference. At any rate, Perl best practices I’ve been aware of (admittedly 10y or so out of date)
recommendedit to distinguish the file handle from the values actually being printed. 

Best,

David





Вложения

В списке pgsql-hackers по дате отправления: