Guildencrantz has asked for the wisdom of the Perl Monks concerning the following question:
Once again I am back looking for wisdom. This time I am truly stumped. I am getting errors where, to the best of my knowledge I should not be getting these particular errors. the problem is that in either server mode or CLI I get:
Global symbol "%allIPs" requires explicit package name at /var/www/cgi-bin/ds/deactivate.pl line 71.
Global symbol "%allIPs" requires explicit package name at /var/www/cgi-bin/ds/deactivate.pl line 116.
Global symbol "%allIPs" requires explicit package name at /var/www/cgi-bin/ds/deactivate.pl line 117.
syntax error at /var/www/cgi-bin/ds/deactivate.pl line 136, near "else"
Execution of /var/www/cgi-bin/ds/deactivate.pl aborted due to compilation errors.
The odd part is really the error at line 71, which contains "print <<END_OF_BLOCK". I also fail to see the syntax error at 136. I checked the closing bracket in 135, and it closes where it should.
As always, I await your wisdom.
~~Guildencrantz
#!/usr/bin/perl -wT # # Script: Dynamic Dungeon Siege IP Databas Deactivation Script # Author: Guildencrantz # Version: 4-14-02 # use strict; use CGI::Carp 'fatalsToBrowser'; use DB_File; my $activeIPsPath = "/var/www/cgi-bin/ds/database/activeIPs"; my $allIPsPath = "/var/www/cgi-bin/ds/database/allIPsPath"; open ACTIVE, "<$activeIPsPath" or die "Cannot open activeIPs list: $!"; my $counter = 0; my $found = 0; my @ips; while (<ACTIVE>) { chomp; unless ( $_ == $ENV{REMOTE_ADDR} ) { $ips[$counter] = $_; } else { $found = 1; } } close ACTIVE; if( $found ) { open ACTIVE, ">$activeIPsPath" or die "Cannot recreate activeIPs list: $!"; foreach(@ips) { print "$_\n"; } close ACTIVE; print "Content-type: text/html\n\n"; print <<END_OF_BLOCK; <HTML> <HEAD> <META HTTP-EQUIV="Refresh" CONTENT="5;URL=/ds-cgi/viewActive.p +l"> <TITLE>Deactivated!</TITLE> </HEAD> <BODY> <H1>Your IP has been removed from the list of active game servers< +/H1> <P> <A HREF="/ds-cgi/viewActive.pl"> You will be forwarded to the active servers list in 5 seco +nds </A> </P> </BODY> </HTML> END_OF_BLOCK } else { print "Content-type: text/html\n\n"; print <<END_OF_BLOCK; <HTML> <HEAD> <META HTTP-EQUIV="Refresh" CONTENT="15; URL=/ds-cgi/viewActive +.pl"> <TITLE>STUMPED!</TITLE> </HEAD> <BODY> <H1>Your IP was not found in the active servers list!</H1> END_OF_BLOCK; tie my %allIPs, "DB_File", $allIPsPath or die "Could not open allIPs database: $!"; if(exists $allIPs{$ENV{REMOTE_ADDR}}) { print <<END_OF_BLOCK <P> However your IP is registered in our complete list of IPs: </P> <TABLE BORDER=1> <TR> <TH>IP</TH> <TH>User Name</TH> <TH>Server Name</TH> <TH>Server Password</TH> <TH>Game Difficulty</TH> <TH>World Difficulty</TH> <TH>Map</TH> <TH>Drop on Death</TH> <TH>Team Play Enabled</TH> <TH>Player Pause Enabled</TH> <TH>Player vs. Player Enabled</TH> <TH>Join Game in Progress</TH> <TH>Choose Start Location Enabled</TH> <TH>New Characters Only</TH> </TR> END_OF_BLOCK print "$allIPs{$ENV{REMOTE_ADDR}}"; untie %allIPs; print <<END_OF_BLOCK; <P> If you forgot to activate the IP before your game, well, w +e're sorry and hope you remember next time. If you were trying to ac +tivate your IP before you start a game, please click on a <A HREF="/d +s-cgi/activate.pl">ACTIVATE IP</A> link. If you reached this page in + error, I'm sorry and wish you better luck next time. </P> <P> <A HREF="/ds-cgi/viewActive.pl"> You will be forwarded to the list of active servers in + 15 seconds </A> </P> </BODY> </HTML> END_OF_BLOCK } else { print "Content-type: text/html\n\n"; print <<END_OF_BLOCK <HTML> <HEAD> <META HTTP-EQUIV="Refresh" CONTENT="15; URL=/ds-cgi/viewAc +tive.pl"> <TITLE>STUMPED!</TITLE> </HEAD> <H1>Your IP does not seem to be in any of our records!</H1> <P> END_OF_BLOCK print "This IP, $ENV{REMOTE_ADDR}, is not in either the active + servers list, or in our complete database of servers."; print <<END_OF_BLOCK If you did enter your server information there are a few possi +bilities for why this happened:<BR> 1) You are using DHCP and when you renewed you got a different + IP. <BR> 2) You moved your computer (laptop users, this is likely to ha +ppen a lot) 3) You installed a firewall and the server is now reading the +firewall's IP. <P> Basically it all comes down to the fact that this server u +ses the CURRENT IP when doing anything. I'm going to look into a met +hod of using the MAC address (this is a hardware address that is spec +ific to your network card) which should eliminate some problems with +people moving their machines around. </P> <P> Your option now is two either fill out the <A HREF="/ds/su +bmit.html">submission form</A> again, which will create an entry in t +he database for THIS IP, or you can try to get your old IP back and a +ctivate that (this would be a bit rediculous in most cases). </P> <P> <A HREF="/ds-cgi/bin"> You will be forwarded to the active server list in 30 +seconds </A> </P> </BODY> </HTML> } }
Edit kudra, 2002-04-15 Changed title
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strange
by clintp (Curate) on Apr 15, 2002 at 02:56 UTC | |
|
Re: Strange
by Chmrr (Vicar) on Apr 15, 2002 at 02:54 UTC |