[postgis-users] postgis_restore.pl patch to pass use strict;

James Marca jmarca at translab.its.uci.edu
Tue May 17 12:48:53 PDT 2005


Hi.  Appended is a patch to postgis_restore.pl for your consideration
which lets it run after adding

  use strict;

to the top.  I just added 4 "my"s inside of loops. 

James

--- postgis-1.0.0/utils/postgis_restore.pl.orig	2005-05-16 15:53:19.000000000 -0700
+++ postgis-1.0.0/utils/postgis_restore.pl	2005-05-16 15:56:11.000000000 -0700
@@ -36,13 +36,13 @@
 #	pg_dump-743/pg743 => pg_restore-800/pg800
 #	pg_dump-800/pg800 => pg_restore-800/pg800
 #
-
+use strict;
 eval "exec perl -w $0 $@"
 	if (0);
 
 (@ARGV == 3) || die "Usage: postgis_restore.pl <postgis.sql> <db> <dump>\nRestore a custom dump (pg_dump -Fc) of a postgis enabled database.\n";
 
-$DEBUG=1;
+my $DEBUG=1;
 
 my %aggs = ();
 my %fncasts = ();
@@ -127,7 +127,7 @@ while( my $line = <INPUT>)
 		my $geomfound = 0;
 		for (my $i=0; $i<@args; $i++)
 		{
-			$arg = lc($args[$i]);
+			my $arg = lc($args[$i]);
 			#print "ARG1: [$arg]\n";
 			$arg =~ s/^ *//;
 			$arg =~ s/ *$//;
@@ -162,7 +162,7 @@ while( my $line = <INPUT>)
 		{
 			for (my $i=0; $i<@args; $i++)
 			{
-				$arg = $args[$i];
+				my $arg = $args[$i];
 				$arg = 'geometry' if ($arg eq 'oldgeometry');
 				$args[$i] = $arg;
 			}
@@ -342,7 +342,7 @@ while( my $line = <INPUT> )
 		my $wkbinvolved = 0;
 		for (my $i=0; $i<@args; $i++)
 		{
-			$arg = lc($args[$i]);
+			my $arg = lc($args[$i]);
 			$arg =~ s/^ *//;
 			$arg =~ s/ *$//;
 			$arg =~ s/^public.//;
@@ -354,7 +354,7 @@ while( my $line = <INPUT> )
 			$wkbinvolved++ if ( $arg eq 'wkb' );
 		}
 
-		$args = join(', ', @args);
+		my $args = join(', ', @args);
 		#print "ARGS SCALAR: [$args]\n";
 		my $id = $funcname."(".$args.")";
 		#print "ID: [$id]\n";
@@ -392,7 +392,7 @@ while( my $line = <INPUT> )
 		my @args = split(",", $3);
 		for (my $i=0; $i<@args; $i++)
 		{
-			$arg = lc($args[$i]);
+			my $arg = lc($args[$i]);
 			$arg =~ s/^ *//;
 			$arg =~ s/ *$//;
 			$arg =~ s/^public.//;
@@ -402,7 +402,7 @@ while( my $line = <INPUT> )
 			}
 			$args[$i] = $arg;
 		}
-		$args = join(', ', @args);
+		my $args = join(', ', @args);
 		my $id = $name."(".$args.")";
 		if ( $aggs{$id} )
 		{



More information about the postgis-users mailing list