Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNXGb-0005Dq-8U for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Apr 2020 07:42:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jNXGa-00086z-4I for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Apr 2020 07:42:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNXGZ-00086s-TY for pgsql-hackers@lists.postgresql.org; Sun, 12 Apr 2020 07:42:55 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jNXGT-0006mt-Em for pgsql-hackers@postgresql.org; Sun, 12 Apr 2020 07:42:54 +0000 Received: by mail-pf1-x42f.google.com with SMTP id b8so3138136pfp.8 for ; Sun, 12 Apr 2020 00:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Oj+ZSKyzt3M1GvA6HjDVrIPmK9ZSLPxyJUrWAldIskE=; b=dZ+c4mY7cuK0Hmm7yo/RM01laQAM0xHxiLOxHXgp25QFpzFDtdTpGf9OkTGtAHzu+9 wBNRBU1VwuOEIspvRLmuwZ1qptNcSZfRgq7cJQz1R12dk7nvX+9HTpP1QdCPbW2QffAB /C34dcJYJesuJI+4KokFZBZV7JbGeDbz4u9Cg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Oj+ZSKyzt3M1GvA6HjDVrIPmK9ZSLPxyJUrWAldIskE=; b=oN3+CL64qApomRsAA/2K4092xMR430X24J47SPhOF9ZdHij5xLSXu1VRimVSObTGlt Vj66dsjoEgEKmxJSA4JFC5//vOtUXktYZLAvD91JcLfKDwr88rI9n9dUe0ZobIK37fBY y+2rz6slEzXC9SWf5/aFXjRKPlx12KRKceXfMjwCciFrchscj6GBZiVR1wcMaRKY0V7C Ip2Tg6OQz+nQ9ct4+GDfzfDUa4MMkLvuXrlnvFldTHK5eKaY+Pv1sry0KJORptjps+zf T10v0NwdkPnAoYiJpK8nzAzH2E84D17tXYUrt28uzoT7RTFahIGR1oTbRVZZUzvBjB2M 5oqQ== X-Gm-Message-State: AGi0PuY8blpUnheF4PN9gc6FxQaL09OpbdxDAV3yZ30hMJpLmSUvBtwo Ip0MzBxPqV6e3nWjXJtOo/s3sA== X-Google-Smtp-Source: APiQypIJPCfw+4gkUTxLblMlhi+hQCmCX55muMFeVFGJSIN4OBwjtsJT/3I/DKdSFqL7T/w8CniuTg== X-Received: by 2002:a63:2347:: with SMTP id u7mr1521501pgm.183.1586677368118; Sun, 12 Apr 2020 00:42:48 -0700 (PDT) Received: from rfd.leadboat.com (108-233-125-46.lightspeed.sntcca.sbcglobal.net. [108.233.125.46]) by smtp.gmail.com with ESMTPSA id o12sm5857578pjt.16.2020.04.12.00.42.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Apr 2020 00:42:47 -0700 (PDT) Date: Sun, 12 Apr 2020 00:42:45 -0700 From: Noah Misch To: Andrew Dunstan Cc: PostgreSQL-development Subject: Re: cleaning perl code Message-ID: <20200412074245.GB623763@rfd.leadboat.com> References: <20200411043014.GA590991@rfd.leadboat.com> <0a4406d5-b428-4831-8ed9-c36764360f57@2ndQuadrant.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0a4406d5-b428-4831-8ed9-c36764360f57@2ndQuadrant.com> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Apr 11, 2020 at 12:13:08PM -0400, Andrew Dunstan wrote: > --- a/src/tools/msvc/Project.pm > +++ b/src/tools/msvc/Project.pm > @@ -420,13 +420,10 @@ sub read_file > { > my $filename = shift; > my $F; > - my $t = $/; > - > - undef $/; > + local $/ = undef; > open($F, '<', $filename) || croak "Could not open file $filename\n"; > my $txt = <$F>; > close($F); > - $/ = $t; +1 for this and for the other three hunks like it. The resulting code is shorter and more robust, so this is a good one-time cleanup. It's not important to mandate this style going forward, so I wouldn't change perlcriticrc for this one. > --- a/src/tools/version_stamp.pl > +++ b/src/tools/version_stamp.pl > @@ -1,4 +1,4 @@ > -#! /usr/bin/perl -w > +#! /usr/bin/perl > > ################################################################# > # version_stamp.pl -- update version stamps throughout the source tree > @@ -21,6 +21,7 @@ > # > > use strict; > +use warnings; This and the other "use warnings" additions look good. I'm assuming you'd change perlcriticrc like this: +[TestingAndDebugging::RequireUseWarnings] +severity = 5