[postgis-users] postgis_restore.pl patch to pass use strict;
strk at refractions.net
strk at refractions.net
Wed May 18 01:39:26 PDT 2005
Hi James,
I applied your patch, but before committing it can you remind
me the considerations you're talking about?
The eval part is there to allow a bourne
shell to run the script using perl interpreter (thus permitting
different installation paths for perl). `use strict' should be
*after* the eval for the thing to work.
--strk;
On Tue, May 17, 2005 at 12:48:53PM -0700, James Marca wrote:
> 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} )
> {
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list