annotate spy.pl @ 298:b3b845d30d4b

new cache mechanism
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Sun, 07 Dec 2008 16:40:04 +0800
parents 10f14db31151
children ff8db948e1a1
rev   line source
284
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
1 #!/usr/bin/perl
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
2
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
3 use strict;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
4 use Ikariam;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
5 use Data::Dumper;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
6 use Decision::ParseTree q{ParseTree};
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
7 use YAML qw/LoadFile Dump DumpFile/;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
8
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
9 our $i = new Ikariam($::server, $::user, $::pass);
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
10 $i->login;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
11 # $i->check();
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
12 foreach (glob("city-*-dump.yaml")) {
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
13 my $city = LoadFile($_);
298
b3b845d30d4b new cache mechanism
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents: 284
diff changeset
14 # $i->{'cities'}->{$city->{id}} = $city;
284
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
15 my $spydata = $i->checkSafeHouse($city->{id});
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
16 foreach (keys(%{$spydata})) {
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
17 DumpFile("spy-$_-dump.yaml", $spydata->{$_});
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
18 }
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
19 }
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
20 $i->logout;
10f14db31151 added new dump spy info function
"Rex Tsai <chihchun@kalug.linux.org.tw>"
parents:
diff changeset
21