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

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

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 6, 2023, 08:05 UTC
Message-ID
<230406.86355dv363.gmgdl@evledraar.gmail.com>
In-Reply-To
<20230405213020.M231170@dcvr>
On Wed, Apr 05 2023, Eric Wong wrote:
Show 17 quoted lines
> Patrick Steinhardt <ps@pks.im> 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.

I much prefer "use warnings", and it's what we should be using. Note that "-w" isn't just "global warnings", but for anything non-trivial you'll likely be tripped up by "-w" being dynamically scoped, and "use warnings" being lexically scoped. See "What's wrong with -w and $^W" in "perldoc warnings".

In any case, I think it's fine to change these to "use warnings", and the behavior won't change, as the scripts are trivial, and the either don't use any modules, or use perl core modules that are (presumably) warning-free.

But I think that change really should be split up from any proposed shebang change, as it's just being made here because by usin g"env" in particular we can't pass the "-w" argument...

Previous: Felipe ContrerasNext: Jeff King
Message 22 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.