So I'm thinking of creating some modules that will generate links to maps.
So far I have code to generate maps for the following countries:
USA - mapquest
Canada - mapquest
Switzerland - www.multimap.com
Australia - www.street-directory.com
Singapore - www.streetdirectory.com.sg
Each service takes differnet data, but it's possible to figure out a
superset and create a single API.
So I'm thinking that the modules will work something like this:
my $map = WWW::Map->new( country => 'usa',
address => '100 Foo St.',
city => 'Testville',
state => 'MN',
postal_code => '01020',
service => 'Mapquest',
);
print $map->link;
The new method will probably also take an optional username & pw, since
many of these services offer a paid version, and sometimes that's the only
way to link to them without violating their TOS.
The link() method is the only one I'm thinking of implementing initially,
but I could imagine other methods later, for example one to actually
retrieve tha map.
The actual maps will be generated by subclasses like WWW::Map::Mapquest,
WWW::Map::MultiMap, etc.
I'm thinking that WWW::Map can load each of these modules and ask them
what countries they support. If we have more than one module for a
country, it will just pick one, unless you specify a service.
So my questions are:
- Does this API seem reasonable?
- Is WWW::Map a good namespace? Is there a better one?
There is at least one similar distro on CPAN, WWW::Shorten, which provides
a generic API to URL shortening services.
-dave
/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/