NAME
Geo::Postcodes::DK - Danish postal codes with names
SYNOPSIS
This module can be used object oriented, or as procedures. Take your pick.
OBJECT ORIENTED
use Geo::Postcodes::DK qw(valid);
my $pnr = '1171';
if (valid($pnr)) # A valid postal code? { my $P = Geo::Postcodes::DK->new($pnr);
print "Postcode" '" . $P->$pnr . "'.\n";
print "Postal location: '" . $P->location_of . "'.\n";
print "Postcode type: '" . $P->type . "'.\n";
print "Owner: '" . $P->owner . "'.\n";
print "Address: '" . $P->address . "'.\n";
}
The test for a valid postal code can also be expressed this way:
my $P = Geo::postcodes::DK->new($pnr);
if ($P) { ... }
PROCEDURES
use Geo::postcodes::DK ':all';
my $pnr = "1171";
if (valid($pnr)) { print "Postcode" '" . $postcode . "'.\n"; print "Postal location: '" . location_of($postcode) . "'.\n"; print "Postcode type: '" . type_of($postcode) . "'.\n"; print "Owner: '" . owner_of($postcode) . "'.\n"; print "Address: '" . address_of($postcode) . "'.\n"; }
ABSTRACT
Geo::postcodes::DK - Perl extension for the mapping between danish (including Grønland and Færøerne) postal codes, postal location, address and address owner.
DESCRIPTION
Tired og entering the postal name all the time? This is not necessary, as it is uniquely defined from the postal code. Request the postal code only, and use this library to get the postal name.
EXPORT
None by default.
The procedures can be imported individually, or en block with use Geo::postcodes::DK ':all';.
DEPENDENCIES
This module is a subclass of Geo::Postcodes, which must be installed separately.
PROCEDURES
Note that the xxx_of procedures return undef when passed an illegal argument.
legal
my $boolean = Geo::postcodes::DK::legal($number);
Do we have a legal postal code; a code that follows the syntax rules?
valid
my $boolean = Geo::postcodes::DK::valid($number);
Do we have a valid postal code; a code in actual use?
location_of
my $location = Geo::postcodes::DK::location_of($number);
The postal place associated with the specified postal code.
owner_of
my $owner = Geo::postcodes::DK::owner_of($number);
The owner (company) of the postal code, if any.
address_of
my $address = Geo::postcodes::DK::address_of($number);
The address (street) associated with the specified postal code.
type_of
my $type = Geo::postcodes::DK::type_of($number);
What kind of postal code is this. Possible values are: "Postboks", "Personlig eier", "Ufrankerede svarforsendelser", and "Gateadresse".
This information may not be especially useful.
METHODS
new
my $P = Geo::postcodes::DK->new($number);
Create a new postal code object.
The constructor will return undef when passed an illegal postal code. Legal postal codes consist of four digits, and must also be in use.
Either check the postal code with legal
before this call, or test it afterwards; if ($P) { ... }
.
postcode
my $postcode = $P->postcode;
The postcode.
location
my $location = $P->location;
The postal location associated with the specified postcode.
type
my $type = $P->type;
See the description of the procedure type_of above.
CAVEAT
This module uses "inside out objects".
POSTCODES
Danish postcodes (including Grønland) are four digit numbers ("0000" to "9999"), while Færøerne uses three digits numbers ("000" to "999"). This means that "0010" and "010" are legal, while "10" is not.
Use legal to check for legal postcodes, and valid to check if the postcode is actually in use. Geo::postcodes::NO-
new($postcode)> will return undef if passed an illegal or invalif postcode.
Attempts to access the methods of a non-existent postal code object will result in a runtime error. This can be avoided by checking if the postal code is legal, before creating the object; valid($postcode)
returns true or false.
CHARACTER SET
The library was written using the ISO-8859-1 (iso-latin1) character set, and the special danish letters 'Æ', 'Ø' and 'Å' occur regularly in the postal places, kommune name and fylke name. Usage of other character set may cause havoc. Unicode is not tested.
SEE ALSO
The latest version of this library should always be available on CPAN, but see also the library home page; http://bbop.org/perl/GeoPostcodes.
AUTHOR
Arne Sommer, <arne@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Arne Sommer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 1601:
Non-ASCII character seen before =encoding in 'Grønland'. Assuming CP1252