From 78942cb7cb284c83a75d178f692aa5f74fe8501c Mon Sep 17 00:00:00 2001 From: franck cuny Date: Fri, 12 Feb 2010 16:55:35 +0100 Subject: layout --- clean-country.pl | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'clean-country.pl') diff --git a/clean-country.pl b/clean-country.pl index 9fb0b5c..8d26d12 100644 --- a/clean-country.pl +++ b/clean-country.pl @@ -9,26 +9,32 @@ use YAML::Syck; my $conf = LoadFile(shift); -my $schema = githubexplorer::Schema->connect(@{$conf->{connect_info}}); +my $schema = githubexplorer::Schema->connect( @{ $conf->{connect_info} } ); -my $profiles = $schema->resultset('Profiles')->search({id => {'>' => 55781}, location => {'!=' => - undef}, location => {'!=' => ''}}); +my $profiles = $schema->resultset('Profiles')->search( + { + id => { '>' => 55781 }, + location => { '!=' => undef }, + location => { '!=' => '' } + } +); my $geo = Geo::GeoNames->new(); -while (my $pr = $profiles->next) { +while ( my $pr = $profiles->next ) { next if $pr->location =~ /^http/; next if $pr->country; next if $pr->location =~ /earth/i; - say "-> process ".$pr->login." with ".$pr->location; + say "-> process " . $pr->login . " with " . $pr->location; my $result = $geo->search( q => $pr->location, maxRows => 1 ); my $res = shift @$result; if ($res) { eval { - $pr->update({city => $res->{name}, country => $res->{countryName}}); + $pr->update( + { city => $res->{name}, country => $res->{countryName} } ); }; next if $@; - say "** fix with ".$pr->city . " in ".$pr->country; + say "** fix with " . $pr->city . " in " . $pr->country; } sleep(1); } \ No newline at end of file -- cgit 1.4.1