On 28.08.25 20:03, David E. Wheeler wrote:
On Aug 28, 2025, at 09:29, Daniel Gustafsson <[email protected]> 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.



Reply via email to