view spy.pl @ 313:a5d85719155d

fixed the if/else logic
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 06 Jan 2009 23:51:53 +0800
parents ff8db948e1a1
children 8a69b96be376
line wrap: on
line source

#!/usr/bin/perl

use strict;
use Ikariam;
use Data::Dumper;
use Decision::ParseTree q{ParseTree};
use YAML qw/LoadFile Dump DumpFile/;

Ikariam::Cities->has_a(user => 'Ikariam::User');

our $i = new Ikariam($::server, $::user, $::pass);
$i->login;
# $i->check();
foreach (glob("city-*-dump.yaml")) {
    my $city = LoadFile($_);
    # $i->{'cities'}->{$city->{id}} = $city;
    my $spydata = $i->checkSafeHouse($city->{id});
    foreach (keys(%{$spydata})) {
        my $city = Ikariam::Cities->retrieve($_);
        my $user = $city->user;
        printf("%s %s\n", $user->name, $city->cityname);
        DumpFile("spy-$_-dump.yaml", $spydata->{$_});
    }
}
$i->logout;