# HG changeset patch # User "Rex Tsai " # Date 1228639204 -28800 # Node ID b3b845d30d4b85e74e6defe509c17ed52eaf49a5 # Parent 073442284ec170f9c22f5e4ed3344092e9a7811e new cache mechanism diff -r 073442284ec1 -r b3b845d30d4b Ikariam.pm --- a/Ikariam.pm Sun Dec 07 15:12:33 2008 +0800 +++ b/Ikariam.pm Sun Dec 07 16:40:04 2008 +0800 @@ -113,6 +113,7 @@ use HTTP::Cookies; use WWW::Mechanize; use XML::LibXML qw(:encoding); +use YAML qw/LoadFile Dump DumpFile/; use IO::Uncompress::Gunzip qw(gunzip $GunzipError) ; use POSIX; use utf8; @@ -133,6 +134,7 @@ debug => undef, }; + # if debug LWP::Debug::level('+trace'); @@ -1298,9 +1300,12 @@ if($#cities<0) { die ("login failed\n"); } - foreach(@cities) { + foreach (@cities) { $self->{'cities'}->{$_} = {}; $self->{'cities'}->{$_}->{id} = $_; + if(-f "city-$_-dump.yaml") { + $self->{'cities'}->{$_} = LoadFile("city-$_-dump.yaml"); + } } } diff -r 073442284ec1 -r b3b845d30d4b spy.pl --- a/spy.pl Sun Dec 07 15:12:33 2008 +0800 +++ b/spy.pl Sun Dec 07 16:40:04 2008 +0800 @@ -11,8 +11,7 @@ # $i->check(); foreach (glob("city-*-dump.yaml")) { my $city = LoadFile($_); - $i->{'cities'}->{$city->{id}} = $city; - + # $i->{'cities'}->{$city->{id}} = $city; my $spydata = $i->checkSafeHouse($city->{id}); foreach (keys(%{$spydata})) { DumpFile("spy-$_-dump.yaml", $spydata->{$_});