The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Number::Phone::Formatter::NationalDigits - A Number::Phone formatter for the national digits only.

VERSION

version 0.01

SYNOPSIS

 # option 1: use with Number::Phone
 #
 # prints 2087712924
 my $number = Number::Phone->new('+44 20 8771 2924');
 print $number->format_using('NationalDigits');

 # Option 2: use standaline, without Number::Phone
 #
 # prints: 2087712924
 #
 print Number::Phone::Formatter::NationalDigits->format('+44 20 8771 2924');

DESCRIPTION

This is a formatter that will format an E.123 formatted number (e.g. from Number::Phone) as the National portion of the number, with all non-digits removed. This is the same thing that Number::Phone::Formatter::Raw does, except you can install this module without installing the entire Number::Phone package, which is quite large. If you merely need to format E.123 phone numbers as raw national digits, and you don't want to install the entirety of Number::Phone, then this is the module for you. Otherwise you should probably just stick with Number::Phone::Formatter::Raw.

This module can be used with Number::Phone, or, as a standalone module.

METHODS

format($number)

This is the only method. It takes an E.123 international format string as its only argument and reformats it as the national portion of the number with all non-digits removed. For example:

 +44 20 8771 2924 -> 2087712924
 +1 212 334 0611  -> 2123340611

SOURCE

The development version is on github at https://github.com/mschout/perl-number-phone-formatter-nationaldigits and may be cloned from git://github.com/mschout/perl-number-phone-formatter-nationaldigits.git

BUGS

Please report any bugs or feature requests to bug-number-phone-formatter-nationaldigits@rt.cpan.org or through the web interface at: http://rt.cpan.org/Public/Dist/Display.html?Name=Number-Phone-Formatter-NationalDigits

AUTHOR

Michael Schout <mschout@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Michael Schout.

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