git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jakub Narebski <jnareb@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 2/3] gitweb/gitweb.perl: remove use of qw(...) as parentheses
Date: Sat, 19 Feb 2011 17:06:20 +0100	[thread overview]
Message-ID: <AANLkTi==3c4ZLckUPE6NUt-sqWBsywQh3Gu+4B5vOBpj@mail.gmail.com> (raw)
In-Reply-To: <201102191654.41601.jnareb@gmail.com>

On Sat, Feb 19, 2011 at 16:54, Jakub Narebski <jnareb@gmail.com> 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.

  parent reply	other threads:[~2011-02-19 16:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-19 14:10 [PATCH] gitweb/gitweb.perl: remove use of qw(...) as parentheses Ævar Arnfjörð Bjarmason
2011-02-19 15:27 ` [PATCH v2 0/3] Fix failure-causing warnings in Gitweb + improve gitweb-lib.sh Ævar Arnfjörð Bjarmason
2011-02-19 15:27 ` [PATCH v2 1/3] t/gitweb-lib.sh: print to stderr when gitweb_run has errors Ævar Arnfjörð Bjarmason
2011-02-19 15:46   ` Jakub Narebski
2011-02-19 16:17     ` Ævar Arnfjörð Bjarmason
2011-02-19 18:16       ` Jakub Narebski
2011-02-19 19:11         ` Ævar Arnfjörð Bjarmason
2011-02-21  6:40         ` Junio C Hamano
2011-02-19 15:27 ` [PATCH v2 2/3] gitweb/gitweb.perl: remove use of qw(...) as parentheses Ævar Arnfjörð Bjarmason
2011-02-19 15:54   ` Jakub Narebski
2011-02-19 16:02     ` Jakub Narebski
2011-02-19 16:06     ` Ævar Arnfjörð Bjarmason [this message]
2011-02-20 14:42       ` Jakub Narebski
2011-02-19 15:27 ` [PATCH v2 3/3] gitweb/gitweb.perl: don't call S_ISREG() with undef Ævar Arnfjörð Bjarmason
2011-02-19 15:57   ` Jakub Narebski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi==3c4ZLckUPE6NUt-sqWBsywQh3Gu+4B5vOBpj@mail.gmail.com' \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jnareb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).