NAME
Geo::LookupPostcode - Get a province name for a given postcode
VERSION
Version 0.01_01
This is a developer release, as the API interface may change.
SYNOPSIS
Given a country name and a postcode, get the name of the province.
use Geo::LookupPostcode qw(lookup_postcode);
my $province = lookup_postcode("it", "00118");
# $province is now:
# {
# region_code => 'IT-62',
# province_code => 'IT-RM',
# }
Supported countries
- Italy
-
This includes the Vatican and the Republic of San Marino.
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, with these key/value pairs:
{
region_code => $region_code,
province_code => $province_code,
}
If it cannot find the province, it returns undef if not.
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>
BUGS
Please report any bugs or feature requests to bug-geo-postcodetoprovince at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Geo-LookupPostcode. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
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.