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

I ran across Gisle Aas "Norway" module at CPAN. I do similar things in my different projects, and could bundle them as "Sweden". Are there any other projects like this going on? The category 13_Internationalization_Locale on CPAN is not exactly flooding..

Gisles "use No;" handles validating "personnummer" (sort of a Social Security Number, but with greater use), sorting, bankaccount number validation, holidays, telephone costs.

Are there other "country" modules out there hidning, that I could steal ideas from?

Replies are listed 'Best First'.
Re: Modules for countries
by tadman (Prior) on Aug 13, 2001 at 22:25 UTC
    It would really come in handy if there were a single module, or a single module collection, that could be used to validate this kind of thing. There have been occasions in the past where, when validating data for integrity, I have been at a loss as to what might be valid and what might be invalid.

    A few ideas:
    • Telephone numbers, such that they are both "validated" and optionally cleaned up into the "official" format.
    • State, province, district, parish, or other political sub-unit listing, with appropriate abbreviations, and common misspellings linked to proper spellings (i.e. 'KT' for Kentucky to 'KY', 'QC' for Quebec to 'PQ')
    • Postal codes, plus any secondary validation that can be performed, such as linking geographic region with the code (i.e. 10001 is in NY, 90210 is in CA)
      It would be nice with an Interface (Java speak) that could be implemented for different countries. Dates, telephone numbers, addresses, holidays, sorting are general things. Postal codes that maps to regions and cities may also be a general thing. But our Swedish "personnummer" (personal number) is not a thing that exists everywhere. So the base class could list the general things and lett every country module add it's own special methods.

      And, as Hanamaki wrote, namespace needs to be worked out.

      Anyone know if a project like this exists for other languages? How about Python?
Re: Modules for countries
by Hanamaki (Chaplain) on Aug 13, 2001 at 22:25 UTC
    Talking about countries, charsets and languages CPAN is still a real mess!

    Some Country stuff I know of:
    Data::Address::Standardize (U.S. postal addresses)
    Geography::USStates (US States)
    Geography::States (USA, Brazil, Canada, The Netherlands, and Australia.)
    Locale::US (US States)

    Wooow! "Locale::US" is just for looking up US-States and there 2 letter codes ...thats close to namespace robbery.

    Hanamaki
      Wooow! "Locale::US" is just for looking up US-States and there 2 letter codes ...thats close to namespace robbery.
      I wrote that module. The Date namespace is about to be well-cleaned up because they just created a datetime mailing list at perl.org to discuss name and code unification ideas.

      the Locale namespace is nowhere near as nice as of yet. Sigh.

Re: Modules for countries
by davorg (Chancellor) on Aug 14, 2001 at 12:27 UTC