Haven't looked at the module yet, don't know where he's getting the
----- Forwarded message from william ross <will(a)spanner.org> -----
From: william ross <will(a)spanner.org>
Date: Tue, 31 Aug 2004 19:39:06 +0100
To: CDBI <cdbi-talk(a)groups.kasei.com>
I've just finished (for now) and uploaded the module that I use to work
with UK postcodes. It handles validation, parsing, location and the
common distance-to-here calculation in a fairly economical way, and it
can deal transparently with postcodes at different resolutions (ie it
will tell you how far it is from 'SW1' to 'EC1Y 8PQ'), to allow for the
various data sets that are available.
At the moment it's up as Geo::Postcode, but that may well change in
order to sit nicely next to similar modules from other countries.
The accuracy of its measurements depends on the data set that it's
working with. It comes with a basic set of nearly 3000 points that
pretty much covers all the postcode areas (like 'E1' or 'LA23'), but no
more. That's enough to get started and rough out an application, but
for serious public use you will need to license the use of a proper
postcode set. The module is designed to accept all sorts of data
sources without too much trouble.
I mention it here because I use it mostly with CDBI apps, so it is
designed to inflate and deflate cleanly as a has_a. If a class already
has a se[arate postcode field, it can just be dropped in:
My::Person->has_a( postcode => 'Geo::Postcode' );
My::Cinema->has_a( postcode => 'Geo::Postcode' );
my $distance = $person->postcode->distance_from( $cinema->postcode );
...and much more.
I hope it turns out to be useful, and I'd be very glad of feedback and
ps. if it hasn't reached your mirror, try www.spanner.org/postcodes/
----- End forwarded message -----