Skip to content

Commit

Permalink
Merge branch 'master' into smaller-database and deconflictify
Browse files Browse the repository at this point in the history
  • Loading branch information
DrHyde committed Apr 8, 2021
2 parents 529fcc4 + 62210a8 commit 5fd2d09
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux-normal-build.yml
Expand Up @@ -23,10 +23,10 @@ jobs:
perl -v
perl -MData::Dumper -e 'eval "use Number::Phone"; if(!$@) { print "Number::Phone is already installed, argh\n".Dumper(\%INC); exit(1) } else { print "Number::Phone not yet installed, hurrah\n"; exit(0) }'
cpanm --quiet --notest ExtUtils::MakeMaker Test::Pod Test::Pod::Coverage parent
cpanm --quiet --notest File::ShareDir::Install XML::XPath Data::CompactReadonly Digest::MD5 File::Find::Rule Spreadsheet::XLSX Text::CSV_XS LWP::Protocol::https
cpanm --quiet --notest Data::Dumper::Concise File::ShareDir::Install XML::XPath Data::CompactReadonly Digest::MD5 File::Find::Rule Spreadsheet::XLSX Text::CSV_XS LWP::Protocol::https
cpanm --quiet --notest --installdeps .
./build-data.sh
perl Makefile.PL
make test TEST_VERBOSE=1
make install
perl -MData::Dumper -MNumber::Phone -e 'if(Number::Phone->new("+447979866975")->operator() =~ /vodafone/i) { print "N::P::UK built/installed correctly\n".Dumper(\%INC); exit(0) } else { print "N::P::UK build/install failed\n"; exit(1) }'
perl -MData::Dumper::Concise -MNumber::Phone -e 'if(Number::Phone->new("+447979866975")->operator() =~ /vodafone/i) { print "N::P::UK built/installed correctly\n".Dumper(\%INC); exit(0) } else { print "N::P::UK build/install failed\n"; exit(1) }'
4 changes: 2 additions & 2 deletions .github/workflows/linux-without_uk-build.yml
Expand Up @@ -23,10 +23,10 @@ jobs:
perl -v
perl -MData::Dumper -e 'eval "use Number::Phone"; if(!$@) { print "Number::Phone is already installed, argh\n".Dumper(\%INC); exit(1) } else { print "Number::Phone not yet installed, hurrah\n"; exit(0) }'
cpanm --quiet --notest ExtUtils::MakeMaker Test::Pod Test::Pod::Coverage parent
cpanm --quiet --notest File::ShareDir::Install XML::XPath Data::CompactReadonly Digest::MD5 File::Find::Rule Spreadsheet::XLSX Text::CSV_XS LWP::Protocol::https
cpanm --quiet --notest Data::Dumper::Concise File::ShareDir::Install XML::XPath Data::CompactReadonly Digest::MD5 File::Find::Rule Spreadsheet::XLSX Text::CSV_XS LWP::Protocol::https
cpanm --quiet --notest --installdeps .
./build-data.sh
perl Makefile.PL --without_uk
make test TEST_VERBOSE=1
make install
perl -MData::Dumper -MNumber::Phone -e 'if(Number::Phone->new("+447979866975")->isa("Number::Phone::StubCountry::GB")) { print "N::P built/installed correctly without N::P::UK\n".Dumper(\%INC); exit(0) } else { print "N::P build/install failed\n"; exit(1) }'
perl -MData::Dumper::Concise -MNumber::Phone -e 'if(Number::Phone->new("+447979866975")->isa("Number::Phone::StubCountry::GB")) { print "N::P built/installed correctly without N::P::UK\n".Dumper(\%INC); exit(0) } else { print "N::P build/install failed\n"; exit(1) }'
6 changes: 6 additions & 0 deletions CHANGELOG
@@ -1,5 +1,11 @@
XXXX-XX-XX XXXXXX Switch to Data::CompactReadonly for UK database

XXXX-XX-XX XXXXXX Data updates;
Add deprecation warning for platforms with 32 bit int (support will
go away some time after 2023-06-01 with no further warning)

2021-03-09 3.7002 Data updates

2021-02-04 3.7001 Data from OFCOM/CNAC/NPA/localcallingguide.com squirreled
away during builds for greater reproducibility;
Data updates
Expand Down
2 changes: 2 additions & 0 deletions Makefile.PL
Expand Up @@ -49,6 +49,7 @@ WriteMakefile(
PREREQ_PM => {
'Cwd' => 0,
'Data::CompactReadonly' => '0.0.3',
'Data::Dumper::Concise' => 0,
'Devel::CheckOS' => '1.83',
'Digest::MD5' => 0,
'File::Basename' => 0,
Expand All @@ -61,6 +62,7 @@ WriteMakefile(
'Test::Differences' => 0.62,
'Test::More' => '0.96', # need done_testing (0.88) and subtests (0.95_01)
'Test::utf8' => 0,
'Test::Warnings' => 0,
},
dist => {
PREOP => "./build-data.sh --previouslibphonenumbertag"
Expand Down
1 change: 0 additions & 1 deletion build-data.country-mapping
Expand Up @@ -6,7 +6,6 @@

use strict;
use warnings;
use Data::Dumper; local $Data::Dumper::Indent = 2;

# use lib 'lib';
# use Number::Phone::NANP::Data;
Expand Down
1 change: 0 additions & 1 deletion build-data.nanp
Expand Up @@ -9,7 +9,6 @@ use warnings;
use LWP::UserAgent;
use XML::XPath;
use Text::CSV_XS;
use Data::Dumper;local $Data::Dumper::Indent = 1;

use lib 'lib';
use Number::Phone::Country qw(noexport);
Expand Down
4 changes: 0 additions & 4 deletions build-data.uk
Expand Up @@ -5,7 +5,6 @@ use warnings;

use Data::CompactReadonly;
use Digest::MD5 'md5_base64';
use Data::Dumper;
use File::Find::Rule;
use Spreadsheet::XLSX;
use Text::CSV_XS;
Expand All @@ -31,9 +30,6 @@ foreach my $xlsfile (File::Find::Rule->name('*.xlsx')->in('data-files')) {
print "Working on $xlsfile\n";
my $parser = Spreadsheet::XLSX->new($xlsfile);

# use Data::Dumper; local $Data::Dumper::Indent = 1;
# die(Dumper($parser));

my $worksheet = $parser->{Worksheet}->[0];
my ( $row_min, $row_max ) = $worksheet->row_range();
my ( $col_min, $col_max ) = $worksheet->col_range();
Expand Down
1 change: 0 additions & 1 deletion build-tests.pl
Expand Up @@ -6,7 +6,6 @@

use strict;
use warnings;
use Data::Dumper; local $Data::Dumper::Indent = 2;
use XML::XPath;

$| = 1;
Expand Down
8 changes: 7 additions & 1 deletion lib/Number/Phone.pm
Expand Up @@ -14,7 +14,7 @@ use Number::Phone::Data;
use Number::Phone::StubCountry;

# MUST be in format N.NNNN, see https://github.com/DrHyde/perl-modules-Number-Phone/issues/58
our $VERSION = '3.7001';
our $VERSION = '3.7002';

my $NOSTUBS = 0;
sub import {
Expand All @@ -25,6 +25,10 @@ sub import {
}
}

if(~0 == 4294967295) {
warn("Your perl only supports 32 bit ints; Number::Phone will require 64 bit ints from some time after 2023-06-01");
}

sub _find_data_file {
my $wanted = shift;

Expand Down Expand Up @@ -201,6 +205,8 @@ As of version 3.6000 the C<areaname> method pays attention to your locale
settings and so you might start getting locale-appropriate versions of
areanames instead of what you used to get.
64 bit ints will be required some time after 2023-06-01.
=head1 COMPATIBILTY WITH libphonenumber
libphonenumber is a similar project for other languages, maintained
Expand Down
17 changes: 17 additions & 0 deletions t/deprecations.t
@@ -0,0 +1,17 @@
use strict;
use warnings;

use Data::Dumper::Concise;
use Test::More;
use Test::Warnings qw(warning);

if(~0 == 4294967295) {
my $warning = warning { use_ok 'Number::Phone' };
like(
$warning,
qr/32 bit/,
"warned about 32 bit support going away"
) || diag(Dumper($warning));
}

done_testing();
2 changes: 1 addition & 1 deletion t/inc/common-nanp_and_libphonenumber_tests.pl
Expand Up @@ -127,7 +127,7 @@
skip_if_libphonenumber("Stubs don't support operator", 1, sub {
is($CLASS->new('+1 416 392 2489')->operator(), 'Bell Canada', "Canada");

is($CLASS->new('+1 216 208 0000')->operator(), 'ONVOY, LLC - OH',
is($CLASS->new('+1 216 208 0000')->operator(), 'ONVOY LLC - OH',
"Unicode en-dash in some US data converted to hyphen");

my @codes_seen = ();
Expand Down

0 comments on commit 5fd2d09

Please sign in to comment.