Subject: Re: [PATCH] global: resolve Perl executable via PATH

From: Eric Wong <[email-masked]>
Date: Wed, 5 Apr 2023 21:30:20 +0000

Patrick Steinhardt <[email-masked]> wrote:
> diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
> index 755a110bc4..3fe43b8968 100755
> --- a/Documentation/cmd-list.perl
> +++ b/Documentation/cmd-list.perl
> @@ -1,5 +1,6 @@
> -#!/usr/bin/perl -w
> +#!/usr/bin/env perl
>  
> +use warnings;

Fwiw, adding `use warnings' only affects the current scope
(package main), whereas `-w' affects the entire Perl process.

I prefer `-w' since adding `use warnings' everywhere is
annoyingly verbose and I only use 3rd-party code that's
warning-clean.

In *.t test scripts and stuff I intend to be overwritten in
install scripts; I've been using `#!perl -w' as the shebang
as a clear signal that it should be overwritten on install
or or run via `$(PERL) FOO' in a Makefile.

For personal scripts in ~/bin, I've been going shebang-less
and having the following as the first two lines:

	eval 'exec perl -w -S $0 ${1+"$@"}'
	if 0; # running under some shell

(Only tested GNU/Linux and FreeBSD, though).  This (and
`env perl') will fail if distros someday decide to start
using `perl5' as the executable name.

That said, I don't know if anything I've said above is
appropriate for the git project aside from noting the
difference between `-w' and `use warnings'.