Re: [PATCH v2 2/3] gitweb/gitweb.perl: remove use of qw(...) as parentheses

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

 



On Sat, Feb 19, 2011 at 16:54, Jakub Narebski <jnareb@xxxxxxxxx> wrote:
> On Sat, 19 Feb 2011, Ãvar ArnfjÃrà Bjarmason wrote:
>
>> Using the qw(...) construct as implicit parentheses was deprecated in
>> perl 5.13.5. Change the relevant code in gitweb to not use the
>> deprecated construct. The offending code was introduced in 3562198b by
>> Jakub Narebski.
>
> It is strange that Perl introduces such backwards incompatibile change
> (well, actually will introduce, as 5.13.x is development branch leading
> to future Perl version 5.14).
>
> qw{} is described in perlop(1) as "word list" operator, so one would
> suppose that it generates a list.

It does, but it wasn't supposed to generate parens for you.

>> The issue is that perl will now warn about this:
>>
>> Â Â $ perl -wE 'for my $i qw(a b) { say $i }'
>> Â Â Use of qw(...) as parentheses is deprecated at -e line 1.
>> Â Â a
>> Â Â b
>
> Hmmm... does it affect only foreach loop, or dows it affect also other
> places, like
>
> Â Â Âuse POSIX qw( setlocale localeconv )
> Â Â Â@EXPORT = qw( foo bar baz );
>
> Both of those forms are used by gitweb:
>
> Â Â Âuse CGI qw(:standard :escapeHTML -nosticky);
>
> Â Â Âmap { $_ => 'sh' Â} qw(bash zsh ksh)
> Â Â Âmy @navs = qw(summary shortlog log commit commitdiff tree);

No. This is being deprecated because qw(foo bar) is supposed to mean
"foo, "bar", not ("foo", "bar"). I.e. this doesn't compile:

    for my $i "a", "b", "c" { }

So neither should this:

    for my $i qw(a b c) {}

But these both work:

    for my $i ("a", "b", "c") { }
    for my $i (qw(a b c)) {}

All of your other examples could have used a list without implicit
parens. So this is the only change that's needed in gitweb.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]