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: 61177
Status: resolved
Priority: 0/
Queue: Number-Phone

People
Owner: Nobody in particular
Requestors: WIRELESSD [...] cpan.org
Cc:
AdminCc:

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



Subject: Trouble parsing international phone numbers
test one works fine for the uk, 2 for germany and 3 for china fail, they can be looked up on: http://www.fonefinder.net/ correctly. #!/usr/bin/perl use warnings; use strict; use Number::Phone; my $test1 = Number::Phone->new('442087712924'); print "1: " . $test1->country_code . "\n"; my $test2 = Number::Phone->new('491774497319'); print "2: " . $test2->country_code . "\n"; my $test3 = Number::Phone->new('0118668118541'); print "3: " . $test3->country_code . "\n";
On Wed Sep 08 15:20:53 2010, WIRELESSD wrote: Show quoted text
> test one works fine for the uk, 2 for germany and 3 for china fail, they > can be looked up on: http://www.fonefinder.net/ correctly. > > #!/usr/bin/perl > use warnings; > use strict; > use Number::Phone; > > my $test1 = Number::Phone->new('442087712924'); > print "1: " . $test1->country_code . "\n"; > > my $test2 = Number::Phone->new('491774497319'); > print "2: " . $test2->country_code . "\n"; > > my $test3 = Number::Phone->new('0118668118541'); > print "3: " . $test3->country_code . "\n";
Number 2 may be a bug - I'll look into it. It's probably because there's no Number::Phone::DE module. Number 3 isn't a bug, because there are no country codes beginning with 0. You appear to have prepended your local "here comes an international number" prefix. If I were to support that (which I'm not, because some countries use 8, or 99, or 119, or ... which would interfere with properly detecting some phone numbers) then I'd only support 00, as that's the ITU-T E.164 recommended prefix (in section 12 of the standard) and it doesn't conflict with any country codes.
Show quoted text
> my $test2 = Number::Phone->new('491774497319'); > print "2: " . $test2->country_code . "\n";
Strictly speaking, this isn't a bug - it's documented that passing in a bogus code, or one for a country for which no supporting module is available, will return undef from the constructor. This is, however, a silly default and I'm changing it.
Version 1.8 on its way to the CPAN