pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: cleaning perl code
Date: Sun, 12 Apr 2020 00:42:45 -0700
Message-ID: <20200412074245.GB623763@rfd.leadboat.com> (raw)
In-Reply-To: <0a4406d5-b428-4831-8ed9-c36764360f57@2ndQuadrant.com>
References: <e56f6fb6-38d5-8450-577c-24eb5d63f2e1@2ndQuadrant.com>
	<20200411043014.GA590991@rfd.leadboat.com>
	<0a4406d5-b428-4831-8ed9-c36764360f57@2ndQuadrant.com>

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





view thread (34+ messages)  latest in thread

Message-ID: <20200412074245.GB623763@rfd.leadboat.com>
Permalink:  ../20200412074245.GB623763@rfd.leadboat.com/
Also on:    postgresql.org/message-id/20200412074245.GB623763@rfd.leadboat.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: noah@leadboat.com, andrew.dunstan@2ndquadrant.com
  Subject: Re: cleaning perl code
  In-Reply-To: <20200412074245.GB623763@rfd.leadboat.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