Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Number-Phone CPAN distribution.

Report information
The Basics
Id: 64848
Status: rejected
Priority: 0/
Queue: Number-Phone

People
Owner: Nobody in particular
Requestors: MSTEVENS [...] cpan.org
Cc: dahae.neil [...] dianomi.com
michael.smith [...] dianomi.com
michael.stevens [...] dianomi.com
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.8
Fixed in: (no value)



CC: michael.stevens [...] dianomi.com,michael.smith [...] dianomi.com, dahae.neil [...] dianomi.com
Subject: Number::Phone rejects numbers when country specified
Number::Phone rejects this: my $phone = Number::Phone->new("uk", "44 7910 359005"); but accepts this: my $phone = Number::Phone->new("44 7910 359005"); I propose that both or neither should work.
Being annoying, have you had a chance to look at this?
This can't be done generically. Consider what would happen if OFCOM were to start allocating numbers in the 044 range. And even though OFCOM haven't yet done this for UK numbers, I can't be sure that other countries won't ever do this.
On Tue Jul 19 18:04:03 2011, DCANTRELL wrote: Show quoted text
> This can't be done generically. Consider what would happen if OFCOM > were to start allocating > numbers in the 044 range. And even though OFCOM haven't yet done this > for UK numbers, I > can't be sure that other countries won't ever do this.
How would you use Number::Phone to determine if a potentially UK number is valid? At the moment it looks like the best technique would be to try to recognise the (44) section and strip it off before passing to Number::Phone.
Show quoted text
> How would you use Number::Phone to determine if a potentially UK number > is valid? > > At the moment it looks like the best technique would be to try to > recognise the (44) section and strip it off before passing to > Number::Phone.
IF you don't explicitly tell the module that it's a UK number, then that's what it does. If you do tell it that it's a UK number, then it believes you and, if the number begins with 4, it correctly tells you that it's invalid. Consider the case of Germany, country code 49. There are *lots* of German area codes that also begin with 49, so we can't just assume that when you've already told the module that you're passing it a German number, that any leading 49 can be stripped off. What you are proposing is that the module accept random nonsense arguments and magically figure out what you really mean.