git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
EWEric 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'.

Previous: Kristoffer HaugsbakkNext: Felipe Contreras
Message 20 of 27 in “global: resolve Perl executable via PATH”
  1. global: resolve Perl executable via PATHPatrick Steinhardt, Apr 5, 2023
  2. Felipe ContrerasApr 5, 2023
  3. Patrick SteinhardtApr 5, 2023
  4. Todd ZullingerApr 5, 2023
  5. Patrick SteinhardtApr 5, 2023
  6. Todd ZullingerApr 5, 2023
  7. Felipe ContrerasApr 5, 2023
  8. Patrick SteinhardtApr 5, 2023
  9. Junio C HamanoApr 5, 2023
  10. Felipe ContrerasApr 6, 2023
  11. Jeff KingApr 5, 2023
  12. Patrick SteinhardtApr 5, 2023
  13. Jeff KingApr 5, 2023
  14. Felipe ContrerasApr 6, 2023
  15. Jeff KingApr 6, 2023
  16. Ævar Arnfjörð BjarmasonApr 6, 2023
  17. Felipe ContrerasApr 18, 2023
  18. Patrick SteinhardtApr 6, 2023
  19. Kristoffer HaugsbakkApr 5, 2023
  20. Eric WongApr 5, 2023
  21. Felipe ContrerasApr 6, 2023
  22. Ævar Arnfjörð BjarmasonApr 6, 2023
  23. Jeff KingApr 6, 2023
  24. Patrick SteinhardtApr 6, 2023
  25. t/lib-httpd: pass PERL_PATH to CGI scriptsJeff King, Apr 6, 2023
  26. Junio C HamanoApr 6, 2023
  27. Felipe ContrerasApr 18, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.