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.