Is there a phone number validator for all countries for Perl?

I am doing web development with Perl. I need to do a phone number check for all countries. Is there an open source Perl module that can do the following?

For example: country = Malaysia, if the user enters the phone number = +60127008007, after confirmation, he returns this is a valid mobile phone number in Malaysia, where: In local Malaysia we call: 0127008007 directly. "+6" is the international code.

If the user's phone number = +600127008007, it returns an invalid phone number. Since locally in Malaysia there is no such number as: 00127008007.

Any free module, how can this be done in CPAN or otherwise?

+3
source share
7 answers

Look at the number :: Phone :: NANP ( lNumber :: Phone :: NANP ). I think you will add new subclasses for uncovered countries.

+9
source

Validation assumes that you know more than the person entering the data, but in this case you do not. Let me say that I am an American, working a long-term contract in Canada. I saved my mobile phone because the company I'm working on pays for roaming charges. When I visit your site and enter my American cell phone number, and the Canadian address confirms your script check, it is not valid if it is not. This leads to customer confusion and anger.

( , ) , ( ) ( ) , . / , . , Festival, , -, . , , .

+8

, , .

, . , , .

? , ? , - "555-5555 (ask for Steve)" "555-5555 ( 123)" - ? , , , ?

. .:)

+3

.

:

  • ( 1 3 )
  • ( 3 , 1 5 )
  • ( 6 8 , 4 13 )

, 6 21 , . =)

, , . , (, , ), : " ?"

+1

- libphonenumber Perl, .

JavaScript .

Ruby, PHP Python. ++ .

: http://code.google.com/p/libphonenumber/ , .

0

. Domchi: :

  • (, WANTS )
  • (, )

- № 1, , , , .

- № 2, , . , , № 1, . , .

, №1, . , - .

0
source

I don't know Perl, but this semme is the perfect use case for Regexp.

But in any case, you will need one for each country, and obviously this may not include any country in the world, but you can find phone templates here .

-2
source

Source: https://habr.com/ru/post/1704827/


All Articles