Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Foreign Postal Addresses

by aardvark (Pilgrim)
on Oct 10, 2001 at 03:05 UTC ( [id://117891]=perlquestion: print w/replies, xml ) Need Help??

aardvark has asked for the wisdom of the Perl Monks concerning the following question:

A project I am woking on requires me to display lots of postal addresses for many countries. All of the addresses are entered into a common template. But displaying this info in the correct format for a given country is a problem. Each country has it's own format and I want to be geographically correct in the way it is displayed. Many countries use a similar format

address 1
address 2
address 3
city, (state or province) postal code
country

But I am finding some countries that use a different order:

address 1
address 2
address 3
city postal code, country

address 1
address 2
address 3
postal code city, country

I'm sure that each country has it's own standard address format. Has anybody found a module that incorporates all this logic? So given a country name (or country code) the module outputs the correct format?

Also if any of you have the address for the Taliban in Afghanistan, please give it to me, I'd like to send them a big punch in the mouth.

Get Strong Together!!

Replies are listed 'Best First'.
Re: Foreign Postal Addresses
by aardvark (Pilgrim) on Oct 10, 2001 at 04:28 UTC
    Update:
    chromatic was nice enough to point out the correct module in a /msg to me.

    The module I was looking for is Lingua::EN::AddressParse .

    I overlooked it in my search of the CPAN. Thanks for helping me out chromatic.

    Get Strong Together!!

      Not exactly a Perl thing, but I beg you (everyone, not just Chromatic), if you are collecting addresses online, to consider how different nationalities use words to describe different parts of an address. For example:
      • most non-Americans have no idea what a zip code is.
      • the word "city" hasa completely different meaning in the UK from in the US. (When I am asked for my "city" my response is "I don't live in a city".)
      Also don't put in validation that will exclude non-US addresses e.g.
      • zip code validation
      • state abbreviation validation
      • US phone number validation.
      Just because it can be done doesn't mean you have to do it!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://117891]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-19 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found