View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Arne Sommer > Geo-Postcodes > Geo::Postcodes



Annotate this POD


New  1
Open  0
View/Report Bugs
Module Version: 0.32   Source  


Geo::Postcodes - Base class for the Geo::Postcodes::* modules


This module should not be used directly from application programs, but from a country subclass; e.g.:

 package Geo::Postcodes::U2;

 use Geo::Postcodes 0.30;
 use base qw(Geo::Postcodes);

 use strict;
 use warnings;

 our $VERSION = '0.30';

And so on. See the documentation for making country subclasses for the gory details; perldoc Geo::Postcodes::Subclass or man Geo::Postcodes::Subclass.


Geo::Postcodes - Base class for the Geo::Postcodes::* modules. It is useless on its own.


These procedures and methods should, with a few exceptions, not be used directly, but from a country module. See the documentation for the indiviual country modules for usage details.

address, borough, county, location, owner, postcode, type, type_verbose

Methods for accessing the fields of a postcode object. The individual country modules can support as many of them as needed, and add new ones.

address_of, borough_of, county_of, location_of, owner_of, postcode_of, type_of, type_verbose_of

Procedures that returns the value of the corresponding field for the given postcode. They will return undef if the postcode does not exist, or the field is without value for the given postcode.

get_fields, is_field

get_fields() will return a list of all the fields supported by the module, and is_field($field) will return true (1) if the specified field is supported by the module.

legal, valid

Procedures that return true if the postcode is legal (syntactically), or valid (in actual use).


This will create a new postcode object.

selection, selection_loop

Procedures/methods for selecting several postcodes at once.

See the selection manual (perldoc Geo::Postcodes::Selection or man Geo::Postcodes::Selection) for usage details, and the tutorial (perldoc Geo::Postcodes::Tutorial or man Geo::Postcodes::Tutorial) for sample code.

verify_selectionlist, is_legal_selectionmode, is_legal_initial_selectionmode get_selectionmodes, get_initial_selectionmodes

Supporting procedures when using selection or selection_loop.

See the selection manual; perldoc Geo::Postcodes::Selection or man Geo::Postcodes::Selection for usage details.


This will return an unsorted list of all the postcodes.


This will return a list of types. See the next section.


  my $type_as_english_text  = $Geo::Postcodes::type2verbose($type);
  my $type_as_national_text = $Geo::Postcodes::U2:type2verbose($type);

This procedure gives an english description of the type. Use the child class directly for a description in the native language.


This class defines the following types for the postal locations:


Post Office box


Street address


Service box (as a Post Office box, but the mail is delivered to the customer).


Individual owner (a company with its own postcode).


Either a Street address (ST) or a Post Office box (BX)


Multiple usage (a mix of the other types)


Porto Paye receiver (mail where the reicever will pay the postage).


Place name

The child classes can use them all, or only a subset, but must not define their own additions. The child classes are responsible for adding descriptions in the native language, if appropriate.


This is the base class for the Geo::Postcodes::* modules.


This module uses inside out objects, see for instance for a discussion of the concept.


See also the selection manual (perldoc Geo::Postcodes::Selection or man Geo::Postcodes::Selection) for usage details, the tutorial (perldoc Geo::Postcodes::Tutorial or man Geo::Postcodes::Tutorial) for sample code, and the ajax tutorial (perldoc Geo::Postcodes::Ajax or man Geo::Postcodes::Ajax) for information on using the modules in combination with ajax code in a html form to get the location updated automatically.

The latest version of this library should always be available on CPAN, but see also the library home page; for additional information and sample usage. The child classes that can be found there have some sample programs.


Copyright (C) 2006 by Arne Sommer -

This library is free software; you can redistribute them and/or modify it under the same terms as Perl itself.

syntax highlighting: