NAME
Business::PLZ - Map German postal codes to German states
VERSION
version 0.1
SYNOPSIS
use Business::PLZ;
my $plz = Business::PLZ->new('12345'); # croaks on invalid code
print "$plz"; # stringify
$plz->state; # state or undef if not exist
$plz->iso_state; # state as full ISO code
DESCRIPTION
This module validates German postal codes and maps them to states.
METHODS
state
Returns the state ("Bundesland") of a postal code as ISO 3166-2 subdivision code. The country prefix 'DE-' (or 'AT-' is not included). Some postal codes belong to more than one state - in this case only one state is returned. A future version of this module may also return multiple states.
If no state was found (so the postal code likely does not exists), this method returns undef. The method 'exists' is based on this lookup.
To get more information about a state, you can use Locale::SubCountry:
$state_code = $plz->state;
$state_name = Locale::SubCountry->new('DE')->full_name( $state_code );
iso_state
Returns the state of a postal code as ISO 3166-2 subdivision code, including country prefix.
exists
Returns whether the postal code is assigned. This is exactely the case if it can be mapped to a state.
SEE ALSO
There are some country-specific modules to handle postal codes, for instance PT::PostalCode and Business::DK::PO. Geo::PostalAddress contains regular expressions for postal codes of almost every country.
AUTHOR
Jakob Voss <voss@gbv.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jakob Voss <voss@gbv.de>.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.