Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

acme (189)

acme
  (email not shown publicly)
http://www.astray.com/

Leon Brocard (aka acme) is an orange-loving Perl eurohacker with many varied contributions to the Perl community, including the GraphViz module on the CPAN. YAPC::Europe was all his fault. He is still looking for a Perl Monger group he can start which begins with the letter 'D'.

Journal of acme (189)

Friday October 25, 2002
06:58 AM

WWW::Gazetteer API

[ #8588 ]
After a little work figuring out the simplest API, Philippe "BooK" Bruhat and I have a generic gazetteer API: WWW::Gazetteer. It's a factory class, so you need to install ::Calle or ::HeavensAbove, but is dead easy to use. The following code uses both modules:

#!/usr/bin/perl -w

use strict;
use WWW::Gazetteer;
use YAML;

my $g1 = WWW::Gazetteer->new('calle');
my $g2 = WWW::Gazetteer->new('heavensabove');
print Dump($g1->find("Bath", "GB"));
print Dump($g2->find("Bath", "GB"));

and it prints out:

--- #YAML:1.0
city: Bath
country: GB
elevation: 132
latitude: 51.3833
longitude: -2.3500
--- #YAML:1.0
alias: ''
elevation: 74
latitude: 51.378
longitude: -2.366
name: Bath
region: Avon
regionname: county

Now how many subclasses are we going to have? ;-)

PS: Don't use this for navigation!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.