The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

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.

ABSTRACT

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

PROCEDURES AND METHODS

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).

new

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.

Supporting procedures when using selection or selection_loop.

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

get_postcodes

This will return an unsorted list of all the postcodes.

get_types

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

type2verbose

  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.

TYPE

This class defines the following types for the postal locations:

BX

Post Office box

ST

Street address

SX

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

IO

Individual owner (a company with its own postcode).

STBX

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

MU

Multiple usage (a mix of the other types)

PP

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

PN

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.

DESCRIPTION

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

CAVEAT

This module uses inside out objects, see for instance http://www.stonehenge.com/merlyn/UnixReview/col63.html for a discussion of the concept.

SEE ALSO

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; http://bbop.org/perl/GeoPostcodes for additional information and sample usage. The child classes that can be found there have some sample programs.

COPYRIGHT AND LICENCE

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.