NAME
    App::PhoneNumberUtils - Utilities related to phone numbers

VERSION
    This document describes version 0.002 of App::PhoneNumberUtils (from
    Perl distribution App-PhoneNumberUtils), released on 2021-06-03.

DESCRIPTION
    This distributions provides the following command-line utilities:

    *   normalize-phone-number

    *   phone-number-info

    *   phone-number-is-valid

FUNCTIONS
  normalize_phone_number
    Usage:

     normalize_phone_number(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Normalize phone number.

    Examples:

    *   Example #1:

         normalize_phone_number(phnum => "+442087712924"); # -> [200, "OK", "+44 20 8771 2924", {}]

    *   Example #2:

         normalize_phone_number(phnum => "+6281812345678"); # -> [200, "OK", "+62 818 1234 5678", {}]

    This utility uses Number::Phone to format the phone number, which
    supports country-specific formatting rules.

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   phnum* => *str*

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

  phone_number_info
    Usage:

     phone_number_info(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Show information about a phone number.

    Examples:

    *   Example #1:

         phone_number_info(phnum => "+442087712924");

        Result:

         [
           200,
           "OK",
           {
             areacode           => 20,
             areaname           => "London",
             country_code       => 44,
             format             => "+44 20 8771 2924",
             format_for_country => "+44 20 8771 2924",
             is_adult           => 0,
             is_allocated       => 1,
             is_corporate       => 0,
             is_drama           => 0,
             is_fixed_line      => undef,
             is_geographic      => 1,
             is_government      => undef,
             is_in_use          => undef,
             is_international   => undef,
             is_ipphone         => 0,
             is_isdn            => undef,
             is_mobile          => 0,
             is_network_service => 0,
             is_pager           => 0,
             is_personal        => 0,
             is_valid           => 1,
             location           => [51.38309, -0.336079],
             operator           => "BT",
             operator_ported    => undef,
             regulator          => "OFCOM, http://www.ofcom.org.uk/",
             subscriber         => 87712924,
           },
           {},
         ]

    *   Example #2:

         phone_number_info(phnum => "+6281812345678");

        Result:

         [
           200,
           "OK",
           {
             areacode           => undef,
             areaname           => undef,
             country_code       => 62,
             format             => "+62 818 1234 5678",
             format_for_country => "+62 818-1234-5678",
             is_adult           => undef,
             is_allocated       => undef,
             is_corporate       => undef,
             is_drama           => undef,
             is_fixed_line      => 0,
             is_geographic      => 0,
             is_government      => undef,
             is_in_use          => undef,
             is_international   => undef,
             is_ipphone         => undef,
             is_isdn            => undef,
             is_mobile          => 1,
             is_network_service => undef,
             is_pager           => undef,
             is_personal        => undef,
             is_valid           => 1,
             location           => undef,
             operator           => undef,
             operator_ported    => undef,
             regulator          => undef,
             subscriber         => undef,
           },
           {},
         ]

    This utility uses Number::Phone to get information for a phone number.
    For certain countries, the information provided can be pretty detailed
    including coordinate, whether the number is an adult line, and the
    operator name. For other countries, the information provided is more
    basic including whether a number is a mobile number.

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   phnum* => *str*

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

  phone_number_is_valid
    Usage:

     phone_number_is_valid(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Check whether phone number is valid.

    Examples:

    *   Example #1:

         phone_number_is_valid(phnum => "+442087712924"); # -> [200, "OK", 1, { "cmdline.exit_code" => 0 }]

    *   Example #2:

         phone_number_is_valid(phnum => "+4420877129240"); # -> [200, "OK", 0, { "cmdline.exit_code" => 1 }]

    *   Example #3:

         phone_number_is_valid(phnum => "+6281812345678"); # -> [200, "OK", 1, { "cmdline.exit_code" => 0 }]

    *   Example #4:

         phone_number_is_valid(phnum => "+6281812345"); # -> [200, "OK", 0, { "cmdline.exit_code" => 1 }]

    This utility uses Number::Phone to determine whether a phone number is
    valid.

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   phnum* => *str*

    *   quiet => *true*

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/App-PhoneNumberUtils>.

SOURCE
    Source repository is at
    <https://github.com/perlancar/perl-App-PhoneNumberUtils>.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    <https://rt.cpan.org/Public/Dist/Display.html?Name=App-PhoneNumberUtils>

    When submitting a bug or request, please include a test-file or a patch
    to an existing test-file that illustrates the bug or desired feature.

SEE ALSO
    Number::Phone

AUTHOR
    perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2021, 2018 by perlancar@cpan.org.

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

