On Thu, Feb 25, 2010 at 05:39:10PM -0500, Bruce Momjian wrote:
> 
> David, I am sorry this didn't get applied, and the code has drifted too
> much to apply it now.  Would you be able to make a new patch to make our
> Perl files strict?

Please find updated patch attached.  It passes strict, warnings, and
perlcritic -4

Cheers,
David.
-- 
David Fetter <[email protected]> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: [email protected]
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
diff --git a/src/tools/version_stamp.pl b/src/tools/version_stamp.pl
index 3243e16..e06f5f2 100755
--- a/src/tools/version_stamp.pl
+++ b/src/tools/version_stamp.pl
@@ -1,5 +1,7 @@
-#! /usr/bin/perl -w
+#!/usr/bin/env perl
 
+use strict;
+use warnings;
 #################################################################
 # version_stamp.pl -- update version stamps throughout the source tree
 #
@@ -22,26 +24,26 @@
 
 # Major version is hard-wired into the script.  We update it when we branch
 # a new development version.
-$major1 = 9;
-$major2 = 0;
+my $major1 = 9;
+my $major2 = 0;
 
 # Validate argument and compute derived variables
-$minor = shift;
+my $minor = shift;
 defined($minor) || die "$0: missing required argument: minor-version\n";
 
+my ($dotneeded, $numericminor);
 if ($minor =~ m/^\d+$/) {
     $dotneeded = 1;
     $numericminor = $minor;
-} elsif ($minor eq "devel") {
-    $dotneeded = 0;
-    $numericminor = 0;
-} elsif ($minor =~ m/^alpha\d+$/) {
-    $dotneeded = 0;
-    $numericminor = 0;
-} elsif ($minor =~ m/^beta\d+$/) {
-    $dotneeded = 0;
-    $numericminor = 0;
-} elsif ($minor =~ m/^rc\d+$/) {
+} elsif ($minor =~ m/
+    ^
+    (
+        devel |
+        alpha\d+ |
+        beta\d+ |
+        rc\d+
+    )
+    $/x) {
     $dotneeded = 0;
     $numericminor = 0;
 } else {
@@ -49,32 +51,33 @@ if ($minor =~ m/^\d+$/) {
 }
 
 # Create various required forms of the version number
-$majorversion = $major1 . "." . $major2;
+my $majorversion = $major1 . "." . $major2;
+my $fullversion;
 if ($dotneeded) {
     $fullversion = $majorversion . "." . $minor;
 } else {
     $fullversion = $majorversion . $minor;
 }
-$numericversion = $majorversion . "." . $numericminor;
-$padnumericversion = sprintf("%d%02d%02d", $major1, $major2, $numericminor);
+my $numericversion = $majorversion . "." . $numericminor;
+my $padnumericversion = sprintf("%d%02d%02d", $major1, $major2, $numericminor);
 
 # Get the autoconf version number for eventual nag message
 # (this also ensures we're in the right directory)
 
-$aconfver = "";
-open(FILE, "configure.in") || die "could not read configure.in: $!\n";
-while (<FILE>) {
+my $aconfver = "";
+open(my $file, '<', "configure.in") || die "could not read configure.in: $!\n";
+while (<$file>) {
     if (m/^m4_if\(m4_defn\(\[m4_PACKAGE_VERSION\]\), \[(.*)\], \[\], 
\[m4_fatal/) {
         $aconfver = $1;
        last;
     }
 }
-close(FILE);
+close($file);
 $aconfver ne "" || die "could not find autoconf version number in 
configure.in\n";
 
 # Update configure.in and other files that contain version numbers
 
-$fixedfiles = "";
+my $fixedfiles = "";
 
 sed_file("configure.in",
         "-e 's/AC_INIT(\\[PostgreSQL\\], 
\\[[0-9a-z.]*\\]/AC_INIT([PostgreSQL], [$fullversion]/'");
@@ -113,4 +116,5 @@ sub sed_file {
       or die "mv failed: $?";
 
     $fixedfiles .= "\t$filename\n";
+    return;
 }
-- 
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to