From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
---|---|
To: | "David E(dot) Wheeler" <david(at)justatheory(dot)com> |
Cc: | John Naylor <johncnaylorls(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se> |
Subject: | Re: Generate GUC tables from .dat file |
Date: | 2025-09-03 08:39:22 |
Message-ID: | 720354bc-edad-4099-bc22-1a68ffbc1e71@eisentraut.org |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 28.08.25 20:03, David E. Wheeler wrote:
> On Aug 28, 2025, at 09:29, Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
>
>> A tiny nitpick is that all the other generator scripts (that I looked at) in
>> the tree use GetOptions() with named parameter rather than dereference ARGV
>> directly:
>>
>> +my $input_fname = $ARGV[0];
>> +my $output_fname = $ARGV[1];
>
> GetOptions() is overkill when there are no options. I’d opt for:
>
> die "Usage: $0 INPUT_FILE OUTPUT_FILE\n" unless @ARGV == 2;
> my ($input_fname, $output_fname) = @ARGV;
Done that way.
> And since I griped about Perl style previously, I made a pass over modernizing it a bit. One might argue it’s less clear, of course; there is less alignment of the printing than in the original. Otherwise, I’d note:
>
> * Use the /r regex return sequence to simplify dquote() (requires Perl 5.14, IIRC)
I adopted that one. We already use that elsewhere.
> * Iterate over the data types in a single line
> * Pass lists of values to `print`
> * Use {$fh} syntax to make file handle arguments clearer
These don't match our existing style, so I'll leave that to someone who
wants to make these sorts of changes across the whole tree.
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2025-09-03 08:41:14 | Re: Generate GUC tables from .dat file |
Previous Message | Peter Eisentraut | 2025-09-03 08:37:52 | Re: Generate GUC tables from .dat file |