[Dub-pm] Phone numbers

David Cantrell david at cantrell.org.uk
Tue Oct 19 09:21:29 CDT 2004

On Tue, Oct 19, 2004 at 02:36:32PM +0100, Dermot McNally wrote:

> What the other folks said about 048, stands, but there's a snag trying 
> to incorporate enough clevers to handle this into 
> Number::Phone::Country. The lookup expects the number you provide to be 
> in full international format. Arguably, the number +353-48-12345678 is 
> only a pseudo-international number, as I'm not sure if you can dial it 
> from anywhere outside ROI.

I'll have to try it.  Anyone got a company in the north that they
particularly hate and whose time I can waste trying it out? :-)

> What are you planning? To have numbers of that format as well as the 
> +44-28-12345678 equivalent map to a mock-ISO code for NI?

Look at the source for N::P::Country, and how he handles the craziness
that is +1.  I'd handle +353 the same way.  And +7, +34, and +39.

> FWIW, a while ago I went looking for some modules that would help me 
> process phone numbers and help me to decompose them into their 
> constituent country, area and base number. (Which is hard without 
> country-specific logic to tell you how to infer the area code). I ended 
> up growing my own for the most part. My work in progress also has - 
> unlike Number::Phone::Country - the concept of where-in-the-world you 
> are running it from, which was designed to allow you to render numbers 
> in your own country according to local convention. Oh, it supports 
> pretty-printing with support for national norms.

Check out my Number::Phone base class, and Number::Phone::UK for an
example that uses it.  Yes, you need country-specific logic.  Lots of
it.  And for most countries, a database.

The authors of some of the other Number::Phone::* modules are very
slowly moving over to that new API, but implementations for more
countries are more than welcome :-)

David Cantrell | http://www.cantrell.org.uk/david

    Deck of Cards: $1.29.
    "101 Solitaire Variations" book: $6.59.
    Cheap replacement for the one thing Windows is good at: priceless
        -- Shane Lazarus

More information about the Dublin-pm mailing list