From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Clean up Perl code according to perlcritic
Date: Tue, 28 Mar 2017 09:03:26 -0400
Message-ID: <051c7451-ba97-f996-4ddd-11d9e0daef6c@2ndquadrant.com> (raw)
In-Reply-To: <d8jvaqtvjo2.fsf@dalvik.ping.uio.no>
References: <E1csTgB-0003xZ-3P@gemulon.postgresql.org>
<14575.1490652977@sss.pgh.pa.us>
<4193.1490662733@sss.pgh.pa.us>
<d8jvaqtvjo2.fsf@dalvik.ping.uio.no>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 3/28/17 05:23, Dagfinn Ilmari Mannsåker wrote:
> I suggest splitting the substitution and filtering part into separate
> map and grep calls, for clarity. The substituion is crying out for the
> /r regex modifier to avoid the local variable, but that's only available
> since perl 5.14.
>
> diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
> index d9367f8..cf93a60 100644
> --- a/src/tools/msvc/vcregress.pl
> +++ b/src/tools/msvc/vcregress.pl
> @@ -520,11 +520,9 @@ sub fetchRegressOpts
> # Substitute known Makefile variables, then ignore options that retain
> # an unhandled variable reference. Ignore anything that isn't an
> # option starting with "--".
> - @opts = grep {
> - my $x = $_;
> - $x =~ s/\Q$(top_builddir)\E/\"$topdir\"/;
> - $x !~ /\$\(/ && $x =~ /^--/
> - } split(/\s+/, $1);
> + @opts = grep { !/\$\(/ && /^--/ }
> + map { (my $x = $_) =~ s/\Q$(top_builddir)\E/\"$topdir\"/; $x;}
> + split(/\s+/, $1);
> }
> if ($m =~ /^\s*ENCODING\s*=\s*(\S+)/m)
> {
Committed that way.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, ilmari@ilmari.org, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Subject: Re: [COMMITTERS] pgsql: Clean up Perl code according to perlcritic
In-Reply-To: <051c7451-ba97-f996-4ddd-11d9e0daef6c@2ndquadrant.com>
References: <E1csTgB-0003xZ-3P@gemulon.postgresql.org> <14575.1490652977@sss.pgh.pa.us> <4193.1490662733@sss.pgh.pa.us> <d8jvaqtvjo2.fsf@dalvik.ping.uio.no> <051c7451-ba97-f996-4ddd-11d9e0daef6c@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox