NAME
Geo::LookupPostcode - Get province data for a given postcode
VERSION
Version 0.01_02
This is a developer release, as the API interface may change.
SYNOPSIS
Given a country name and a postcode, get which province or region or area it refers to.
use Geo::LookupPostcode qw(lookup_postcode);
my $province = lookup_postcode("it", "00118");
# $province is now:
# {
# region_code => 'IT-62',
# province_code => 'IT-RM',
# }
If you prefer, you can use country-specific modules, it is the same result in either case.
use Geo::LookupPostcode::IT;
my $province = lookup_it_postcode("00118");
Supported countries
- Italy
-
This includes the Vatican and the Republic of San Marino.
- Spain
- Finland
SUBROUTINES/METHODS
lookup_postcode
Takes two character string arguments, the first one being a two-letter ISO 3166-1 country code, and the second one being a postcode in that country.
If successful, it returns a reference to a hash. The keys depend on the country. In the case of Italy, it would return this structure:
{
region_code => $region_code,
province_code => $province_code,
}
If it cannot find the province, it returns undef.
Note that the names may be anglicised (eg: "Vatican City", not "Città del Vaticano").
This subroutine will die if the wrong number of arguments is passed or if an unsupported country is passed.
my $rh_province = lookup_postcode("it", "00118");
AUTHOR
David D Lowe, <daviddlowe.flimm at gmail.com>
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Geo::LookupPostcode
You can also look for information at:
GitHub issue tracker (report bugs here)
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
SEE ALSO
Geo::Postcode, Geo::UK::Postcode and Address::PostCode::UK provides UK postcode validation and location.
Geo::PostalCode provides USA postal code functions.
Geo::Postcodes provides an abstract interface for looking up postcodes. The only two implementations that I am aware of are Geo::Postcodes::NO and Geo::Postcodes::DK, for Norway and Denmark.
ACKNOWLEDGEMENTS
Most of the data was sourced from Wikipedia.
LICENSE AND COPYRIGHT
Copyright 2016 David D Lowe and contributors.
This work is licensed under CC BY-SA 3.0.