GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Number::Phone::JP(3) User Contributed Perl Documentation Number::Phone::JP(3)

Number::Phone::JP - Validate Japanese phone numbers

 use Number::Phone::JP;
 
 my $tel = Number::Phone::JP->new('012', '34567890');
 print "This is valid!!\n" if $tel->is_valid_number;
 
 $tel->set_number('098 7654 3210');
 print "This is valid!!\n" if $tel->is_valid_number;
 
 $tel->import(qw(mobile PHS));
 $tel->set_number('090-0123-4567');
 print "This is valid!!\n" if $tel->is_valid_number;

Number::Phone::JP is a simple module to validate Japanese phone number formats. The Japanese phone numbers are regulated by Ministry of Internal Affairs and Communications of Japan. You can validate what a target number is valid from this regulation point of view.

There are many categories for type of telephones in Japan. This module is able to be used narrowed down to the type of phones.

This module only validates what a phone number agrees on the regulation. Therefore, it does NOT validate what a phone number actually exists.

This validation needs only an area (or category) prefix and behind it. The separator of number behind the prefix is ignored.

This method constructs the Number::Phone::JP instance. you can put some argument of a phone number to it. It needs a two stuff for validation, area prefix (or carrier's prefix) and following (means local-area prefix, subscriber's number, and something).

If you put only one argument, this module will separate it by the first non-number character. And it will be ignored any non-number characters.

It exists to select what categories is used for validation. You should pass some specified categories to this method.

Categories list is as follows:

 Class1   ... Class1 undertaking associations
 Class2   ... Class2 undertaking associations
 Freedial ... Freedials
 Home     ... Household phones
 IPPhone  ... IP phones
 Mobile   ... Mobile phones
 Pager    ... Pager (called "pocketbell")
 PHS      ... Personal Handy-phone Systems
 Q2       ... Dial Q2 services
 United   ... United phone number
 FMC      ... Fixed Mobile Convergence
              (was started in 2007 in Japan)
 UPT      ... Universal Personal Telecommunication
              (was merged to FMC category in 2007 in Japan.
               this class works same as FMC.
               it's left for backward compatibility.)

The category's names are ignored case. Actually, the import method calls others "Number::Phone::JP::Table::"Category module and import this. The default importing table, "Number::Phone::JP::Table" module is including all the categories table.

For importing, you can import by calling this method, and you can import by calling this module with some arguments.

 Example:
  # by calling import method
  use Number::Phone::JP; # import all the categories (default)
  my $tel = Number::Phone::JP->new->import(qw(mobile PHS));
 
  # by calling this module
  use Number::Phone::JP qw(Mobile Phs);
  my $tel = Number::Phone::JP->new; # same as above

Set/change the target phone number. The syntax of arguments for this method is same as "new()" method (see above).

This method validates what the already set number is valid on your specified categories. It returns true if the number is valid, and returns false if the number is invalid.

Simply you can call "is_valid()" method instead of "is_valid_number".

It checks that is the prefix of the number which you set is used for mobile numbers. It just checks only prefix.

It checks that is the prefix of the number which you set is used for pager (a.k.a pocketbell) numbers. It just checks only prefix.

It checks that is the prefix of the number which you set is used for IP phone numbers. It just checks only prefix.

It checks that is the prefix of the number which you set is used for IP tollfree (a.k.a. freedial) numbers. It just checks only prefix.

It checks that is the prefix of the number which you set is used for specialrate (a.k.a. dial Q2) numbers. It just checks only prefix.

The numeric code for Japan. Just returns 81. Note that there is *no* + sign.

Return a sanely formatted version of the number, complete with IDD code, eg for the Japanese number 090-0123-4567 it would return +81 90 01234567.

Following methods are not implemented on this module. It just returns undef.

 use Number::Phone::JP qw(mobile phs);
 
 my $tel = Number::Phone::JP->new;
 open FH, 'customer.list' or die "$!";
 while (<FH>) {
     chomp;
     unless ($tel->set_number($_)->is_valid_number) {
         print "$_ is invalid number\n"
     }
 }
 close FH;

Koichi Taniguchi (a.k.a. nipotan) <taniguchi@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Number::Phone::JP::Table
2019-06-05 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.