X-Git-Url: https://ruin.nu/git/?a=blobdiff_plain;f=scripts%2Fstats.pl;h=6e9c8508e2332ca393162e366cc6b0392f781c5b;hb=c00d916b84908f24522800479b669014856354df;hp=f5e11ec539f106f7d463adf5b2a755a7854ef41b;hpb=13e3df1e4218c19325ef732a4a2cb2b7db79a69c;p=ndwebbie.git diff --git a/scripts/stats.pl b/scripts/stats.pl index f5e11ec..6e9c850 100755 --- a/scripts/stats.pl +++ b/scripts/stats.pl @@ -25,8 +25,12 @@ use warnings; use DBI; use DBD::Pg qw(:pg_types); -use LWP::Simple; -use lib qw{/var/www/ndawn/lib/}; +use LWP::Simple qw/get $ua/; +$ua->agent("Stupid user agent check is stupid"); + +use FindBin; +use lib "$FindBin::Bin/../lib"; + use ND::DB; our $dbh = ND::DB::DB(); @@ -35,15 +39,15 @@ $dbh->do("SET CLIENT_ENCODING TO 'LATIN1';"); my %classes = (Fighter => 'Fi', Corvette => 'Co', Frigate => 'Fr', Destroyer => 'De', Cruiser => 'Cr', Battleship => 'Bs'); -my $file = get("http://game.planetarion.com/manual.php?page=stats"); +my $file = get("http://game.planetarion.com/manual.pl?page=stats"); $dbh->begin_work; -my $st = $dbh->prepare(q{INSERT INTO ship_stats (name,"class",t1,t2,t3,"type",init,guns,armor,damage,eres,metal,crystal,eonium,race) VALUES(?,?,NULLIF(?,'-'),NULLIF(?,'-'),NULLIF(?,'-'),?,?,?,?,?,?,?,?,?,?)}); -while ($file =~ /((?:\w| )+)<\/td>