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

From: Jakub Narebski <[email-masked]>
Date: Sat, 19 Feb 2011 16:54:41 +0100

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.
 
> 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);

[...]
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -3501,7 +3501,7 @@ sub print_feed_meta {
>  			$href_params{'-title'} = 'log';
>  		}
>  
> -		foreach my $format qw(RSS Atom) {
> +		foreach my $format (qw(RSS Atom)) {
>  			my $type = lc($format);
>  			my %link_attr = (
>  				'-rel' => 'alternate',

I am not against futureproofing gitweb in above way for future
Perl 5.14.x

-- 
Jakub Narebski
Poland