Commit bf34039e authored by Angel Abad's avatar Angel Abad

New upstream version 3.4000

parents e6ccd250 261e881c
2017-03-14 3.4000 Changed Kosovo's placeholder country-code from KOS to XK;
+383 (Kosovo) is now a special-case for validation
(see https://github.com/DrHyde/perl-modules-Number-Phone/issues/66);
Data updates
2016-12-06 3.3000 Implemented is_drama
(see https://github.com/DrHyde/perl-modules-Number-Phone/pull/61);
NANP modules now know about is_tollfree, is_specialrate and
......@@ -11,6 +16,7 @@
More comprehensive testing of stubs, and resulting bug-fixes for
territories that appear as part of another's number plan, such
as enormous Kazakhstan and tiny Tristan da Cunha;
Data updates
2016-09-07 3.2001 Data updates
......
......@@ -4,7 +4,7 @@
"unknown"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001",
"generated_by" : "ExtUtils::MakeMaker version 7.1001, CPAN::Meta::Converter version 2.150005",
"license" : [
"unknown"
],
......@@ -49,5 +49,6 @@
"url" : "https://github.com/DrHyde/perl-modules-Number-Phone"
}
},
"version" : "3.3000"
"version" : "3.4000",
"x_serialization_backend" : "JSON::PP version 2.27300"
}
......@@ -7,7 +7,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001'
generated_by: 'ExtUtils::MakeMaker version 7.1001, CPAN::Meta::Converter version 2.150005'
license: unknown
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
......@@ -26,4 +26,5 @@ requires:
resources:
bugtracker: https://github.com/DrHyde/perl-modules-Number-Phone/issues
repository: https://github.com/DrHyde/perl-modules-Number-Phone
version: '3.3000'
version: '3.4000'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
......@@ -8,7 +8,7 @@ use Number::Phone::Country qw(noexport);
use Number::Phone::StubCountry;
# MUST be in format N.NNNN, see https://github.com/DrHyde/perl-modules-Number-Phone/issues/58
our $VERSION = '3.3000';
our $VERSION = '3.4000';
my $NOSTUBS = 0;
sub import {
......@@ -134,9 +134,10 @@ Early versions of this module allowed what are now object methods
to also be called as class methods or even as functions. This was a
bad design decision. Use of those calling conventions was deprecated
in version 2.0, released in January 2012, and started to emit
warnings.
warnings. All code to support those calling conventions has now been removed.
All code to support those calling conventions has now been removed.
Until 2017 we ued KOS for the country code for Kosovo, that has now changed to
XK. See L<Number::Phone::Country>.
=head1 COMPATIBILTY WITH libphonenumber
......@@ -159,6 +160,16 @@ of Number::Phone that will use the libphonenumber-derived stub classes even
when extra data is available in, for example, Number::Phone::UK. You might
want to do this for compatibility or performance. Number::Phone::UK is quite slow, because it uses a huge database for some of its features.
=head1 SPECIAL CASE FOR KOSOVO
Kosovo has been allocated country code +383, and it is apparently in use as of
March 2017, but no number plan has been published and libphonenumber has no
data. Therefore *all* +383 numbers will be considered valid. This is strictly
speaking the wrong thing to do, but the alternative is to consider them all
invalid, which is just as wrong. This will no doubt change in the future.
See L<https://github.com/DrHyde/perl-modules-Number-Phone/issues/66> and
L<https://github.com/googlei18n/libphonenumber/issues/1486>.
=cut
sub _new_args {
......@@ -215,7 +226,8 @@ sub _make_stub_object {
return bless({
country_code => $country_idd,
country => $country_name,
is_valid => undef,
# Kosovo special case
is_valid => ($country_idd eq '383') ? 1 : undef,
number => $local_number,
}, 'Number::Phone::StubCountry');
}
......
......@@ -5,7 +5,7 @@ use Number::Phone::Country::Data;
# *_codes are global so we can mock in some tests
use vars qw($VERSION %idd_codes %prefix_codes);
$VERSION = 1.91;
$VERSION = 1.92;
my $use_uk = 0;
sub import {
......@@ -194,9 +194,11 @@ off by passing the 'noexport' constant when you use the module.
Also be aware that the ISO code for the United Kingdom is GB, not UK. If
you would prefer UK, pass the 'uk' constant.
I have put in number ranges for Kosovo, which does not yet have an ISO
country code. I have used KOS, as that is used by the UN Development
Programme. This may change in the future.
I have put in number ranges for Kosovo, which does not yet have an ISO country
code. I have used XK, as that is the de facto standard as used by numerous
international bodies such as the European Commission and the IMF. I previously
used KOS, as used by the UN Development Programme. This may change again in
the future.
=head1 FUNCTIONS
......@@ -229,7 +231,7 @@ country.
=item phone2country($phone)
Returns the ISO country code (or KOS for Kosovo) for a phone number.
Returns the ISO country code (or XK for Kosovo) for a phone number.
eg, for +441234567890 it returns 'GB' (or 'UK' if you've told it to).
=item phone2country_and_idd($phone)
......
......@@ -43,17 +43,18 @@ $VERSION = '1.6';
359 => 'BG', 36 => 'HU', 370 => 'LT', 371 => 'LV',
372 => 'EE', 373 => 'MD', 374 => 'AM', 375 => 'BY',
376 => 'AD', 377 => 'MC',
37744 => 'KOS', # from http://en.wikipedia.org/wiki/List_of_country_calling_codes#At_a_glance
37745 => 'KOS',
38128 => 'KOS',
38129 => 'KOS',
38138 => 'KOS',
38139 => 'KOS',
38643 => 'KOS',
38649 => 'KOS',
37744 => 'XK', # from http://en.wikipedia.org/wiki/List_of_country_calling_codes#At_a_glance
37745 => 'XK',
38128 => 'XK',
38129 => 'XK',
38138 => 'XK',
38139 => 'XK',
38643 => 'XK',
38649 => 'XK',
378 => 'SM', 379 => 'VA',
380 => 'UA', 381 => 'RS',
382 => 'ME', 385 => 'HR',
383 => 'XK',
386 => 'SI',
387 => 'BA',
389 => 'MK', 39 => ['IT', 'VA'], 3966982 => 'VA',
......
......@@ -21,7 +21,7 @@
use strict;
use warnings;
use vars qw(%areanames %fixed_line_regexes %mobile_regexes);
our $VERSION = 1.20161206201828;
our $VERSION = 1.20170314173050;
......@@ -651,7 +651,7 @@ our $VERSION = 1.20161206201828;
'1205991' => "Birmingham\,\ AL",
'1205995' => "Birmingham\,\ AL",
'1205996' => "Birmingham\,\ AL",
'1206' => "Washington",
'1206' => "Washington\ State",
'1206215' => "Seattle\,\ WA",
'1206217' => "Seattle\,\ WA",
'1206223' => "Seattle\,\ WA",
......@@ -3373,7 +3373,7 @@ our $VERSION = 1.20161206201828;
'1252977' => "Rocky\ Mount\,\ NC",
'1252985' => "Rocky\ Mount\,\ NC",
'1252986' => "Hatteras\,\ NC",
'1253' => "Washington",
'1253' => "Washington\ State",
'1253200' => "Puyallup\,\ WA",
'1253236' => "Kent\,\ WA",
'1253265' => "Gig\ Harbor\,\ WA",
......@@ -4488,6 +4488,7 @@ our $VERSION = 1.20161206201828;
'1281997' => "Pearland\,\ TX",
'1281998' => "Pasadena\,\ TX",
'1281999' => "Houston\,\ TX",
'1283' => "Ohio",
'1289' => "Ontario",
'1289240' => "Oshawa\,\ ON",
'1289296' => "Niagara\ Falls\,\ ON",
......@@ -8230,7 +8231,7 @@ our $VERSION = 1.20161206201828;
'1352872' => "Gainesville\,\ FL",
'1352873' => "Ocala\,\ FL",
'1352955' => "Gainesville\,\ FL",
'1360' => "Washington",
'1360' => "Washington\ State",
'1360210' => "Camas\,\ WA",
'1360213' => "Vancouver\,\ WA",
'1360221' => "Langley\,\ WA",
......@@ -11910,7 +11911,7 @@ our $VERSION = 1.20161206201828;
'1423979' => "Johnson\ City\,\ TN",
'1423989' => "Bristol\,\ TN",
'1424' => "California",
'1425' => "Washington",
'1425' => "Washington\ State",
'1425204' => "Renton\,\ WA",
'1425212' => "Everett\,\ WA",
'1425222' => "Fall\ City\,\ WA",
......@@ -12370,6 +12371,7 @@ our $VERSION = 1.20161206201828;
'1440998' => "Ashtabula\,\ OH",
'1441292' => "Hamilton",
'1441295' => "Hamilton",
'1442' => "California",
'1443' => "Maryland",
'1443394' => "Owings\ Mills\,\ MD",
'1443438' => "Baltimore\,\ MD",
......@@ -12554,6 +12556,7 @@ our $VERSION = 1.20161206201828;
'1450968' => "Terrebonne\,\ QC",
'1450974' => "Saint\-Eustache\,\ QC",
'1450991' => "Granby\,\ QC",
'1458' => "Oregon",
'1463' => "Indiana",
'1469' => "Texas",
'1469232' => "Dallas\,\ TX",
......@@ -12567,6 +12570,8 @@ our $VERSION = 1.20161206201828;
'1469752' => "Plano\,\ TX",
'1469916' => "Dallas\,\ TX",
'1469952' => "McKinney\,\ TX",
'1470' => "Georgia",
'1475' => "Connecticut",
'1478' => "Georgia",
'1478218' => "Perry\,\ GA",
'1478225' => "Warner\ Robins\,\ GA",
......@@ -14131,7 +14136,7 @@ our $VERSION = 1.20161206201828;
'1508997' => "New\ Bedford\,\ MA",
'1508998' => "New\ Bedford\,\ MA",
'1508999' => "New\ Bedford\,\ MA",
'1509' => "Washington",
'1509' => "Washington\ State",
'1509216' => "Spokane\,\ WA",
'1509225' => "Yakima\,\ WA",
'1509226' => "Newman\ Lake\,\ WA",
......@@ -16068,6 +16073,9 @@ our $VERSION = 1.20161206201828;
'1530934' => "Willows\,\ CA",
'1530938' => "Weed\,\ CA",
'1530993' => "Loyalton\,\ CA",
'1531' => "Nebraska",
'1534' => "Wisconsin",
'1539' => "Oklahoma",
'1540' => "Virginia",
'1540206' => "Roanoke\,\ VA",
'1540213' => "Staunton\,\ VA",
......@@ -21557,6 +21565,8 @@ our $VERSION = 1.20161206201828;
'1678973' => "Atlanta\,\ GA",
'1678974' => "Atlanta\,\ GA",
'1678985' => "Lawrenceville\,\ GA",
'1680' => "New\ York",
'1681' => "West\ Virginia",
'1682' => "Texas",
'1682518' => "Mansfield\,\ TX",
'1682622' => "Mansfield\,\ TX",
......@@ -25727,6 +25737,7 @@ our $VERSION = 1.20161206201828;
'1760966' => "Oceanside\,\ CA",
'1760967' => "Oceanside\,\ CA",
'1760995' => "Hesperia\,\ CA",
'1762' => "Georgia",
'1763' => "Minnesota",
'1763205' => "Minneapolis\,\ MN",
'1763208' => "Minneapolis\,\ MN",
......@@ -36271,7 +36282,7 @@ $mobile_regexes{BB} = '246(?:2(?:[356]\d|4[0-57-9]|8[0-79])|45\d|8(?:[2-5]\d|83)
$fixed_line_regexes{BM} = '441(?:2(?:02|23|61|[3479]\d)|[46]\d{2}|5(?:4\d|60|89)|824)\d{4}';
$mobile_regexes{BM} = '441(?:[37]\d|5[0-39])\d{5}';
$fixed_line_regexes{BS} = '242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[3467]|8[0-4]|9[2-467])|461|502|6(?:0[1-3]|12|7[67]|8[78]|9[89])|7(?:02|88))\d{4}';
$mobile_regexes{BS} = '242(?:3(?:5[79]|[79]5)|4(?:[2-4][1-9]|5[1-8]|6[2-8]|7\d|81)|5(?:2[45]|3[35]|44|5[1-9]|65|77)|6[34]6|727)\d{4}';
$mobile_regexes{BS} = '242(?:3(?:5[79]|[79]5)|4(?:[2-4][1-9]|5[1-8]|6[2-8]|7\d|81)|5(?:2[45]|3[35]|44|5[1-9]|65|77)|6[34]6|7(?:27|38)|8(?:0[1-9]|1[02-9]|2\d|99))\d{4}';
$fixed_line_regexes{DM} = '767(?:2(?:55|66)|4(?:2[01]|4[0-25-9])|50[0-4]|70[1-3])\d{4}';
$mobile_regexes{DM} = '767(?:2(?:[234689]5|7[5-7])|31[5-7]|61[2-7])\d{4}';
$fixed_line_regexes{GD} = '473(?:2(?:3[0-2]|69)|3(?:2[89]|86)|4(?:[06]8|3[5-9]|4[0-49]|5[5-79]|68|73|90)|63[68]|7(?:58|84)|800|938)\d{4}';
......@@ -36290,8 +36301,8 @@ $fixed_line_regexes{SX} = '7215(?:4[2-8]|8[239]|9[056])\d{4}';
$mobile_regexes{SX} = '7215(?:1[02]|2\d|5[034679]|8[014-8])\d{4}';
$fixed_line_regexes{TC} = '649(?:712|9(?:4\d|50))\d{4}';
$mobile_regexes{TC} = '649(?:2(?:3[129]|4[1-7])|3(?:3[1-389]|4[1-8])|4[34][1-3])\d{4}';
$fixed_line_regexes{TT} = '868(?:2(?:01|2[1-6]|3[1-5])|6(?:0[79]|1[02-8]|2[1-9]|[3-69]\d|7[0-79])|82[124])\d{4}';
$mobile_regexes{TT} = '868(?:2(?:[789]\d)|3(?:0[1-9]|1[02-9]|[2-9]\d)|4[6-9]\d|6(?:20|78|8\d)|7(?:0[1-9]|1[02-9]|[2-9]\d))\d{4}';
$fixed_line_regexes{TT} = '868(?:2(?:01|[23]\d)|6(?:0[79]|1[02-8]|2[1-9]|[3-69]\d|7[0-79])|82[124])\d{4}';
$mobile_regexes{TT} = '868(?:2(?:6[6-9]|[789]\d)|3(?:0[1-9]|1[02-9]|[2-9]\d)|4[6-9]\d|6(?:20|78|8\d)|7(?:0[1-9]|1[02-9]|[2-9]\d))\d{4}';
$fixed_line_regexes{VC} = '784(?:266|3(?:6[6-9]|7\d|8[0-24-6])|4(?:38|5[0-36-8]|8[0-8])|5(?:55|7[0-2]|93)|638|784)\d{4}';
$mobile_regexes{VC} = '784(?:4(?:3[0-4]|5[45]|89|9[0-58])|5(?:2[6-9]|3[0-4]))\d{4}';
$fixed_line_regexes{VG} = '284(?:(?:229|4(?:22|9[45])|774|8(?:52|6[459]))\d{4}|496[0-5]\d{3})';
......@@ -22,23 +22,23 @@ use base qw(Number::Phone::StubCountry);
use strict;
use warnings;
use utf8;
our $VERSION = 1.20161206201831;
our $VERSION = 1.20170314173053;
my $formatters = [];
my $validators = {
'pager' => '',
'voip' => '',
'geographic' => '
6[2-467]\\d{3}
',
'fixed_line' => '
6[2-467]\\d{3}
',
'toll_free' => '',
'mobile' => '4\\d{4}',
'pager' => '',
'specialrate' => '([01589]\\d{5})',
'geographic' => '
6[2-467]\\d{3}
',
'personal_number' => '',
'specialrate' => '([01589]\\d{5})'
'toll_free' => ''
};
my %areanames = (
2471 => "Georgetown",
......
......@@ -22,30 +22,30 @@ use base qw(Number::Phone::StubCountry);
use strict;
use warnings;
use utf8;
our $VERSION = 1.20161206201831;
our $VERSION = 1.20170314173053;
my $formatters = [
{
'pattern' => '(\\d{3})(\\d{3})',
'leading_digits' => '
[137-9]|
6[0-8]
'
',
'pattern' => '(\\d{3})(\\d{3})'
},
{
'pattern' => '(\\d{4})(\\d{4})',
'leading_digits' => '180[02]'
'leading_digits' => '180[02]',
'pattern' => '(\\d{4})(\\d{4})'
},
{
'pattern' => '(\\d{3})(\\d{3})(\\d{3})',
'leading_digits' => '690'
'leading_digits' => '690',
'pattern' => '(\\d{3})(\\d{3})(\\d{3})'
}
];
my $validators = {
'specialrate' => '([19]\\d{5})',
'geographic' => '[78]\\d{5}',
'personal_number' => '',
'pager' => '',
'toll_free' => '180[02]\\d{4}',
'mobile' => '
(?:
3\\d|
......@@ -55,10 +55,10 @@ my $validators = {
)
)\\d{4}
',
'toll_free' => '180[02]\\d{4}',
'voip' => '',
'specialrate' => '([19]\\d{5})',
'fixed_line' => '[78]\\d{5}',
'geographic' => '[78]\\d{5}'
'pager' => '',
'voip' => ''
};
sub new {
......
......@@ -22,20 +22,20 @@ use base qw(Number::Phone::StubCountry);
use strict;
use warnings;
use utf8;
our $VERSION = 1.20161206201831;
our $VERSION = 1.20170314173053;
my $formatters = [
{
'leading_digits' => '[2-4679][2-8]',
'pattern' => '([2-4679])(\\d{3})(\\d{4})'
'pattern' => '([2-4679])(\\d{3})(\\d{4})',
'leading_digits' => '[2-4679][2-8]'
},
{
'leading_digits' => '5',
'pattern' => '(5\\d)(\\d{3})(\\d{4})'
},
{
'pattern' => '([479]00)(\\d)(\\d{5})',
'leading_digits' => '[479]0'
'leading_digits' => '[479]0',
'pattern' => '([479]00)(\\d)(\\d{5})'
},
{
'leading_digits' => '
......@@ -47,17 +47,17 @@ my $formatters = [
];
my $validators = {
'mobile' => '5[024-68]\\d{7}',
'fixed_line' => '[2-4679][2-8]\\d{6}',
'voip' => '',
'pager' => '',
'personal_number' => '',
'geographic' => '[2-4679][2-8]\\d{6}',
'toll_free' => '
400\\d{6}|
800\\d{2,9}
',
'voip' => '',
'geographic' => '[2-4679][2-8]\\d{6}',
'fixed_line' => '[2-4679][2-8]\\d{6}',
'specialrate' => '(700[05]\\d{5})|(900[02]\\d{5})|(600[25]\\d{5})',
'personal_number' => '',
'pager' => ''
'mobile' => '5[024-68]\\d{7}'
};
sub new {
......
......@@ -22,7 +22,7 @@ use base qw(Number::Phone::StubCountry);
use strict;
use warnings;
use utf8;
our $VERSION = 1.20161206201831;
our $VERSION = 1.20170314173053;
my $formatters = [
{
......@@ -34,9 +34,7 @@ my $formatters = [
];
my $validators = {
'personal_number' => '',
'pager' => '',
'specialrate' => '',
'voip' => '',
'fixed_line' => '
(?:
......@@ -45,6 +43,14 @@ my $validators = {
6[0-5]
)[2-9]\\d{6}
',
'specialrate' => '',
'mobile' => '
7(?:
[014-9]\\d{7}|
2[89]\\d{6}
)
',
'toll_free' => '',
'geographic' => '
(?:
[25][0-8]|
......@@ -52,13 +58,7 @@ my $validators = {
6[0-5]
)[2-9]\\d{6}
',
'mobile' => '
7(?:
[014-9]\\d{7}|
2[89]\\d{6}
)
',
'toll_free' => ''
'personal_number' => ''
};
my %areanames = (
9320 => "Kabul",
......
......@@ -22,7 +22,7 @@ use base qw(Number::Phone::StubCountry);
use strict;
use warnings;
use utf8;
our $VERSION = 1.20161206201831;
our $VERSION = 1.20170314173053;
my $formatters = [
{
......@@ -34,35 +34,6 @@ my $formatters = [
];
my $validators = {
'fixed_line' => '
268(?:
4(?:
6[0-38]|
84
)|
56[0-2]
)\\d{4}
',
'geographic' => '
268(?:
4(?:
6[0-38]|
84
)|
56[0-2]
)\\d{4}
',
'voip' => '26848[01]\\d{4}',
'toll_free' => '
8(?:
00|
44|
55|
66|
77|
88
)[2-9]\\d{6}
',
'mobile' => '
268(?:
464|
......@@ -75,6 +46,7 @@ my $validators = {
)
)\\d{4}
',
'specialrate' => '(900[2-9]\\d{6})',
'personal_number' => '
5(?:
00|
......@@ -86,8 +58,37 @@ my $validators = {
88
)[2-9]\\d{6}
',
'geographic' => '
268(?:
4(?:
6[0-38]|
84
)|
56[0-2]
)\\d{4}
',
'toll_free' => '
8(?:
00|
33|
44|
55|
66|
77|
88
)[2-9]\\d{6}
',
'voip' => '26848[01]\\d{4}',
'pager' => '26840[69]\\d{4}',
'specialrate' => '(900[2-9]\\d{6})'
'fixed_line' => '
268(?:
4(?:
6[0-38]|
84
)|
56[0-2]
)\\d{4}
'
};
use Number::Phone::NANP::Data;
sub areaname {
......
......@@ -22,7 +22,7 @@ use base qw(Number::Phone::StubCountry);
use strict;
use warnings;
use utf8;
our $VERSION = 1.20161206201831;
our $VERSION = 1.20170314173053;
my $formatters = [
{
......@@ -34,35 +34,16 @@ my $formatters = [
];
my $validators = {
'mobile' => '
264(?:
235|
476|
5(?:
3[6-9]|
8[1-4]
)|
7(?:
29|
72
)
)\\d{4}
',
'toll_free' => '
8(?:
00|
33|
44|
55|
66|
77|
88
)[2-9]\\d{6}
',
'fixed_line' => '
2644(?:
6[12]|
9[78]
)\\d{4}
',
'geographic' => '
2644(?:
......@@ -70,9 +51,6 @@ my $validators = {
9[78]
)\\d{4}
',
'voip' => '',
'specialrate' => '(900[2-9]\\d{6})',
'pager' => '',
'personal_number' => '
5(?:
00|
......@@ -83,7 +61,30 @@ my $validators = {
77|
88
)[2-9]\\d{6}
'
',
'specialrate' => '(900[2-9]\\d{6})',
'mobile' => '
264(?:
235|
476|
5(?:
3[6-9]|
8[1-4]
)|