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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 05 2023, Eric Wong wrote:

> Patrick Steinhardt <ps@xxxxxx> 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...



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux