Number::Phone

Number::Phone and friends

Latest version: 4.0005 registry icon
Maintenance score
100
Safety score
100
Popularity score
16
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
4.0005 0 0 0 0 0
4.0004 0 0 0 0 0
4.0003 0 0 0 0 0
4.0002 0 0 0 0 0
4.0001 0 0 0 0 0
4.0000 0 0 0 0 0
3.9002 0 0 0 0 0
3.9001 0 0 0 0 0
3.9000 0 0 0 0 0
3.8007 0 0 0 0 0
3.8006 0 0 0 0 0
3.8005 0 0 0 0 0
3.8004 0 0 0 0 0
3.8003 0 0 0 0 0
3.8002 0 0 0 0 0
3.8001 0 0 0 0 0
3.8000 0 0 0 0 0
3.7003 0 0 0 0 0
3.7002 0 0 0 0 0
3.7001 0 0 0 0 0
3.7000 0 0 0 0 0
3.6006 0 0 0 0 0
3.6005 0 0 0 0 0
3.6004 0 0 0 0 0
3.6003 0 0 0 0 0
3.6002 0 0 0 0 0
3.6001 0 0 0 0 0
3.6000 0 0 0 0 0
3.5001 0 0 0 0 0
3.5000 0 0 0 0 0
3.4006 0 0 0 0 0
3.4005 0 0 0 0 0
3.4004 0 0 0 0 0
3.4003 0 0 0 0 0
3.4002 0 0 0 0 0
3.4001 0 0 0 0 0
3.4000 0 0 0 0 0
3.3000 0 0 0 0 0
3.2001 0 0 0 0 0
3.2000 0 0 0 0 0
3.0014 0 0 0 0 0
3.0013 0 0 0 0 0
3.0012 0 0 0 0 0
3.0011 0 0 0 0 0
3.0010 0 0 0 0 0
3.0009 0 0 0 0 0
3.0008 0 0 0 0 0
3.0007 0 0 0 0 0
3.0006 0 0 0 0 0
3.0005 0 0 0 0 0
3.0004 0 0 0 0 0
3.0003 0 0 0 0 0
3.0002 0 0 0 0 0
3.1 0 0 0 0 0
3.0001 0 0 0 0 0
3.8099_02 0 0 0 0 0
3.8099_01 0 0 0 0 0
3.4001_04 0 0 0 0 0
3.4001_03 0 0 0 0 0
3.4001_02 0 0 0 0 0
3.4001_01 0 0 0 0 0
3.0 0 0 0 0 0
2.2003 0 0 0 0 0
2.2002 0 0 0 0 0
2.2001 0 0 0 0 0
2.0002 0 0 0 0 0
2.2 0 0 0 0 0
2.0001 0 0 0 0 0
2.1 0 0 0 0 0
2.0 0 0 0 0 0
1.8006 0 0 0 0 0
1.8005 0 0 0 0 0
1.8003 0 0 0 0 0
1.8002 0 0 0 0 0
1.8001 0 0 0 0 0
1.7101 0 0 0 0 0
1.7004 0 0 0 0 0
1.7003 0 0 0 0 0
1.7002 0 0 0 0 0
1.7001 0 0 0 0 0
1.5601 0 0 0 0 0
1.4004 0 0 0 0 0
1.4003 0 0 0 0 0
1.4002 0 0 0 0 0
1.4001 0 0 0 0 0
1.3004 0 0 0 0 0
1.3003 0 0 0 0 0
1.3002 0 0 0 0 0
1.3001 0 0 0 0 0
1.2001 0 0 0 0 0
1.581 0 0 0 0 0
1.71 0 0 0 0 0
1.58 0 0 0 0 0
1.57 0 0 0 0 0
1.56 0 0 0 0 0
1.55 0 0 0 0 0
1.54 0 0 0 0 0
1.53 0 0 0 0 0
1.52 0 0 0 0 0
1.51 0 0 0 0 0
1.9 0 0 0 0 0
1.8 0 0 0 0 0
1.7 0 0 0 0 0
1.6 0 0 0 0 0
1.5 0 0 0 0 0
1.4 0 0 0 0 0
1.3 0 0 0 0 0
1.2 0 0 0 0 0
1.1 0 0 0 0 0
1.0 0 0 0 0 0

Stability
Latest release:

4.0005 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

Artistic-1.0   -   Artistic License 1.0

Not a wildcard

Not proprietary

OSI Compliant


GPL-1.0-or-later   -   GNU General Public License v1.0 or later

Not a wildcard

Not proprietary

OSI Compliant



Written in perl On the CPAN Linux build status FreeBSD build status MacOS build status Windows build status Test coverage Github issues

Description

This is a large suite of perl modules for parsing and dealing with phone numbers. For most countries it provides functionality broadly similar to Google's libphonenumber.

For some NANP countries (mostly north America and the Caribbean; all those countries in the +1 country code) some extra information is available, in particular numbers in ranges like such as +1 800 are not just assumed to be US numbers like what libphonenumber does, and information may be available on which telco a number is assigned to.

For the UK (and its nearby dependencies) even more is available, including an approximate location for many geographic numbers, and detection of fake numbers assigned for use in drama.

Installation as a user

If you just want to use the code, then install from the CPAN in the usual fashion:

cpanm Number::Phone

or

cpan Number::Phone

If you are short on disk space then you might want to consider installing it without the extra information for the UK. You will still get support for everything libphonenumber can do, but will save about 100MB of disk space. Installation like this is a bit more involved:

cpanm --look Number::Phone

that will download and unpack the most recent version, and open a shell in the directory into which it was unpacked. Then:

cpanm --installdeps .
perl Makefile.PL --without_uk
make test
make install
exit

Installation as a developer

If you want to work on the code then you will need to run the build script after checking the code out of git:

./build-data.sh

That script will need several extra dependencies that aren't listed in Makefile.PL. You can see them in the various CI tools' configuration files, such as .appveyor.yml. Once you've successfully built the data files (and some code modules that are auto-generated) you can run the tests to see if everything is OK:

perl Makefile.PL
make
make test

Note that you may get test failures if real-world data has changed in such a way as to contradict existing tests.

Structure

Number::Phone is a base class for parsing and dealing with phone numbers, and the entry point for using all the other modules.

Number::Phone::UK inherits methods from it, over-riding some with UK-specific implementations. The intention is that other people will write other country-specific classes exposing the same API. There are several examples on the CPAN.

Number::Phone::NANP implements functionality common to all NANP countries (those with international dialling code +1), and Number::Phone::NANP::XX implement some minor details for each individual country in that region.

Number::Phone::StubCountry::* are automatically generated from Google's libphonenumber project's data. They do not support all the features of Number::Phone, but will support many use-cases and should "fail gracefully" if you try to use unsupported features. They will be used if a more fully-featured module is not available. For example if you want Number::Phone to work with a French number it would use Number::Phone::StubCountry::FR unless the third-party Number::Phone::FR is installed.

Number::Phone::Country is a useful module which is used by the NANP modules. It was originally written by T. J. Mather but is now maintained by me.

There are a few Data.pm files at various places in the hierarchy. They either contain data or contain code for accessing data stored in other files.

Finally, Number::Phone::Lib will only use N::P::StubCountry::* modules, it won't use any more capable third-party modules. This may be preferred for speed or memory usage, and is a bit more compatible with libphonenumber's view of things.

You should not edit any file that exists but which git doesn't know about, there's a lot of auto-generated stuff here.

Data sources

The build script uses data from OFCOM, CNAC, the US's National Pooling Administrator, localcallingguide.com, and Google's libphonenumber.

There is also data derived manually from all of the above, and from the ITU, World Telephone Numbering Guide (treat this with caution, it seems to be no longer maintained), and Wikipedia.

Most of those disclaim any responsibility for errors in the data. I disclaim all responsibility for errors too, even if my code makes your PBX melt into a puddle of purple goo.