
Geo::Postcodes::Update - Helper module for keeping the postcodes up to date

#! /usr/bin/perl -w use strict; use Geo::Postcodes::Update; my $class = 'NO'; my $file = 'tilbud5'; my $url = 'http://epab.posten.no/Norsk/Nedlasting/_Files/tilbud5'; my $procedure = \&parse_no; my $update = @ARGV && $ARGV[0] eq "-update"; Geo::Postcodes::Update::update($class, $file, $url, $procedure, $update); sub parse_no { my @in = @_; my @out; ... return @out; }
This is how the norwegian postcodes are treated, without showing the inner workings of parse_no which receives the lines from the file tilbud5 and returns suitable perl code for inclusion in the module. (The program is included as misc/update_no in the norwegian module.)
Run the program from the root (or the ./misc) directory of the distribution.

This module has only one external procedure.
Call this procedure with the following four parameters:
The name of the class in upper case letters, e.g. 'DK', 'NO' or 'U2'. This is a two-letter country code, as defined in ISO 3166-1, except for our utopian 'U2' (as used in the tutorial; perldoc Geo::Postcodes::Tutorial or man Geo::Postcodes::Tutorial).
The file where the postcodes are taken from. It is located in the ./misc directory of the distribution, together with the update_xx program.
An optional URL, where the program can download the postcode file if allowed to do so by the user. Use undef if no URL is available.
A pointer to a procedure that parses the postcode data. It will receive the lines from the postcode file as input, and must return a list of perl code lines with a suitable data structure, ready for writing to the country module file.
Set this to true to get the procedure to actually offer to update the module. It will display the perl code on-screen otherwise. This is usefull for debugging purposes when making the parsing procedure.

The update_* programs will do the following, when executed:

This module requires the CPAN-module libwww-perl to work. It is used for semiautomatic downloading of the postcode file.

Copyright (C) 2006 by Arne Sommer - perl@bbop.org
This library is free software; you can redistribute them and/or modify it under the same terms as Perl itself.