Re: Generate GUC tables from .dat file - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: Generate GUC tables from .dat file
Date
Msg-id 48E7965C-DF18-4D8A-A660-AFEA2F78CAD9@justatheory.com
Whole thread Raw
In response to Re: Generate GUC tables from .dat file  (John Naylor <johncnaylorls@gmail.com>)
List 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





Attachment

pgsql-hackers by date:

Previous
From: Mihail Nikalayeu
Date:
Subject: Re: Adding REPACK [concurrently]
Next
From: Rahila Syed
Date:
Subject: Re: Improve LWLock tranche name visibility across backends