Mercurial > eagle-eye
comparison spy.pl @ 305:ff8db948e1a1
list user and city name
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Wed, 10 Dec 2008 00:42:12 +0800 |
parents | b3b845d30d4b |
children | 8a69b96be376 |
comparison
equal
deleted
inserted
replaced
303:50cff2eee239 | 305:ff8db948e1a1 |
---|---|
3 use strict; | 3 use strict; |
4 use Ikariam; | 4 use Ikariam; |
5 use Data::Dumper; | 5 use Data::Dumper; |
6 use Decision::ParseTree q{ParseTree}; | 6 use Decision::ParseTree q{ParseTree}; |
7 use YAML qw/LoadFile Dump DumpFile/; | 7 use YAML qw/LoadFile Dump DumpFile/; |
8 | |
9 Ikariam::Cities->has_a(user => 'Ikariam::User'); | |
8 | 10 |
9 our $i = new Ikariam($::server, $::user, $::pass); | 11 our $i = new Ikariam($::server, $::user, $::pass); |
10 $i->login; | 12 $i->login; |
11 # $i->check(); | 13 # $i->check(); |
12 foreach (glob("city-*-dump.yaml")) { | 14 foreach (glob("city-*-dump.yaml")) { |
13 my $city = LoadFile($_); | 15 my $city = LoadFile($_); |
14 # $i->{'cities'}->{$city->{id}} = $city; | 16 # $i->{'cities'}->{$city->{id}} = $city; |
15 my $spydata = $i->checkSafeHouse($city->{id}); | 17 my $spydata = $i->checkSafeHouse($city->{id}); |
16 foreach (keys(%{$spydata})) { | 18 foreach (keys(%{$spydata})) { |
19 my $city = Ikariam::Cities->retrieve($_); | |
20 my $user = $city->user; | |
21 printf("%s %s\n", $user->name, $city->cityname); | |
17 DumpFile("spy-$_-dump.yaml", $spydata->{$_}); | 22 DumpFile("spy-$_-dump.yaml", $spydata->{$_}); |
18 } | 23 } |
19 } | 24 } |
20 $i->logout; | 25 $i->logout; |
21 | 26 |