Jakob Voß > Business-PLZ-0.11 > Business::PLZ

Download:
Business-PLZ-0.11.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.11   Source  

NAME ^

Business::PLZ - Validate German postal codes and map them to states

VERSION ^

version 0.11

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 Voß

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Jakob Voß.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: