comparison Ikariam.pm @ 6:2975a94aa7a2

removed test code.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Wed, 08 Oct 2008 01:52:18 +0800
parents dbb97c4265ba
children 2040ccc95670
comparison
equal deleted inserted replaced
5:dbb97c4265ba 6:2975a94aa7a2
41 my $self = shift; 41 my $self = shift;
42 my $type = shift || 'score'; 42 my $type = shift || 'score';
43 my $user = shift || ''; 43 my $user = shift || '';
44 my $offset = shift || 0; 44 my $offset = shift || 0;
45 45
46 # my $res = $self->{mech}->post(sprintf("http://%s/index.php?view=worldmap_iso", $self->{server}), [ 46 my $res = $self->{mech}->post(sprintf("http://%s/index.php?view=worldmap_iso", $self->{server}), [
47 # highscoreType => $type, 47 highscoreType => $type,
48 # offset => $offset, 48 offset => $offset,
49 # searchUser => $user, 49 searchUser => $user,
50 # view => 'highscore' 50 view => 'highscore'
51 # ]); 51 ]);
52 # 52
53 # my $c; 53 my $c;
54 # my $status = gunzip \$res->content => \$c 54 my $status = gunzip \$res->content => \$c
55 # or die "gunzip failed: $GunzipError\n"; 55 or die "gunzip failed: $GunzipError\n";
56 56
57 my $c;
58 open(IN, "f");
59 while(<IN>) { $c .= $_;}
60 close(IN);
61 my $html = HTML::TagParser->new($c); 57 my $html = HTML::TagParser->new($c);
62 58
63 my ($table) = $html->getElementsByAttribute("class", "table01"); 59 my ($table) = $html->getElementsByAttribute("class", "table01");
64 my @elems = getElementsByTagName($table, "tr"); 60 my @elems = getElementsByTagName($table, "tr");
65 61
204 if ( $e[0]->getAttribute("href") =~ /with=(\d+)&destinationCityId=(\d+)/) 200 if ( $e[0]->getAttribute("href") =~ /with=(\d+)&destinationCityId=(\d+)/)
205 { 201 {
206 $info{'ownerId'} = $1; 202 $info{'ownerId'} = $1;
207 $info{'cityId'} = $2; 203 $info{'cityId'} = $2;
208 } 204 }
209
210 push @cities, \%info; 205 push @cities, \%info;
211 #foreach my $i (sort(keys(%info)))
212 #{
213 # printf("%s: %s ", $i, $info{$i});
214 # }
215 # printf("\n");
216 } 206 }
217 207
218 return @cities; 208 return @cities;
219 } 209 }
220 210