comparison Ikariam.pm @ 291:73c9bf517155

fixed for check checking
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Fri, 05 Dec 2008 22:49:36 +0800
parents 24de33db8284
children 1d0a55318262
comparison
equal deleted inserted replaced
290:2cdf6c6bfd0e 291:73c9bf517155
853 if($locations[$_] eq 'safehouse') { 853 if($locations[$_] eq 'safehouse') {
854 my $res = $self->{mech}->get(sprintf('http://%s/index.php?view=safehouse&id=%d&position=%d', $self->{server}, $cityId, $_ )); 854 my $res = $self->{mech}->get(sprintf('http://%s/index.php?view=safehouse&id=%d&position=%d', $self->{server}, $cityId, $_ ));
855 my $extractor = Ikariam::Extractor->new(content => $res->content); 855 my $extractor = Ikariam::Extractor->new(content => $res->content);
856 foreach (1..25) { 856 foreach (1..25) {
857 my @links = $extractor->find(sprintf('//div[@class="spyinfo" and position() = %d]//a/@href', $_)); 857 my @links = $extractor->find(sprintf('//div[@class="spyinfo" and position() = %d]//a/@href', $_));
858 last if($#links < 0);
859 if ($links[0] =~ /id=(\d+)/) { 858 if ($links[0] =~ /id=(\d+)/) {
860 $data->{$1}->{city} = $self->readCity($1); 859 $data->{$1}->{city} = $self->readCity($1);
861 @{$data->{$1}->{risks}} = Ikariam::Extractor->new(content => $self->{mech}->get($links[1])->content)->find('//div[@class="missionRisk"]'); 860 @{$data->{$1}->{risks}} = Ikariam::Extractor->new(content => $self->{mech}->get($links[1])->content)->find('//div[@class="missionRisk"]');
862 } 861 }
863 } 862 }