view ally.pl @ 377:5d6f429e5f19 tip

fixed a typo.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 14 Apr 2009 17:16:43 +0800
parents dd3d76f43999
children
line wrap: on
line source

#!/usr/bin/perl
use strict;
use Ikariam;
use Data::Dumper;
use List::Util qw[min max];

package main;
# my $users = Ikariam::User->search(ally => 'WMeMe');

Ikariam::Cities->set_sql(ally => qq {
        SELECT cities.cityId
          FROM cities
         WHERE cities.ally == ?
    });

Ikariam::Island->has_many(cities => 'Ikariam::Cities');
Ikariam::Island->set_sql(ally => qq {
        SELECT island.id
          FROM island, cities
         WHERE cities.island == island.id
           AND cities.ally == ?
    });

die("Usage: $0\nUsage: $0 ally\n") unless ($#ARGV == 0);

my @cities = Ikariam::Cities->search_ally($ARGV[0]);
print Dumper(@cities);