Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1csqma-0005iz-R9 for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2017 13:03:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1csqma-0007MS-DS for pgsql-hackers@arkaria.postgresql.org; Tue, 28 Mar 2017 13:03:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1csqmZ-0007M1-9W for pgsql-hackers@postgresql.org; Tue, 28 Mar 2017 13:03:31 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1csqmW-0004PL-HB for pgsql-hackers@postgresql.org; Tue, 28 Mar 2017 13:03:30 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id D8CD620954; Tue, 28 Mar 2017 09:03:26 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Tue, 28 Mar 2017 09:03:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= fm1; bh=SdvTLj2IZUr9I4OIMCkGOAqAP/PV4AyfZfZQ3neWFX0=; b=D1bn612r GzxaiuIh9MjOzF8KnlNVwj5vu+1Ngu/utlTdD3zHnWKEdDUgGOyRZ4Doj+i9mrM1 EWNMnUO1GJqN5dCIBkUTuyah0etk8o6OJp90aPr4wGMOTiPfgy7SrPCK8W2ga7fu 7ZY+unLwzNfzq8XcMOV7N8egi9QDSDmLh4+Sv45it2A5jvVNdtVvu2ra7TFau0FP 3OzzYdL12cQ4FR/bLXdfTmVLhP90tWD4TRoWVsJqNynGsl2KeO9MHh9pEFWOxdaD 9J3nNL/fVffcl7bjV9Y+LQHqbW0KtQ9ebrpantVCiShhSa0WXy8GERWOVdYFdZ0U myuh2jPJizihUQ== X-ME-Sender: X-Sasl-enc: fS3ddnNV6mhWuvwsQ69s5EtMeaq4YVASqth5eDYN5TX5 1490706206 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id 7835D24658; Tue, 28 Mar 2017 09:03:26 -0400 (EDT) Subject: Re: [COMMITTERS] pgsql: Clean up Perl code according to perlcritic To: =?UTF-8?Q?Dagfinn_Ilmari_Manns=c3=a5ker?= , Tom Lane References: <14575.1490652977@sss.pgh.pa.us> <4193.1490662733@sss.pgh.pa.us> Cc: pgsql-hackers@postgresql.org From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <051c7451-ba97-f996-4ddd-11d9e0daef6c@2ndquadrant.com> Date: Tue, 28 Mar 2017 09:03:26 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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