Re: [PATCH] global: resolve Perl executable via PATH
- From
- Eric Wong <e@80x24.org>
- Date
- Apr 5, 2023, 21:30 UTC
- Message-ID
- <20230405213020.M231170@dcvr>
- In-Reply-To
- <d9cfad7caf9ff5bf88eb06cf7bb3be5e70e6d96f.1680689378.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> wrote:
Show 9 quoted lines
> 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'.