« blib/lib/Number/Phone/Formatter/NationallyPreferredIntl.pm
↑ Summary
blib/lib/Number/Phone/NANP/AG.pm »
| 1 | package Number::Phone::Formatter::Raw; | ||
| 2 | |||
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 14 | ▶ | sub format { |
|
Subroutine
format: called CC=1 SCAR=0.0
Pod
documented
| |||
| 7 | 14 | my $class = shift; | |
| 8 | 14 | my $number = shift; | |
| 9 | 14 | $number =~ s/.*?\s//; | |
| 10 | 14 | $number =~ s/\D//g; | |
| 11 | 14 | return $number | |
| 12 | } | ||
| 13 | |||
| 14 | 2 | 1; | |
| 15 | |||
| 16 | =head1 NAME | ||
| 17 | |||
| 18 | Number::Phone::Formatter::Raw - simple formatter for E.123-formatted phone numbers | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | A simple formatter to extract "just the digits, ma'am" from an E.123-formatted phone number. | ||
| 23 | |||
| 24 | =head1 METHOD | ||
| 25 | |||
| 26 | =head2 format | ||
| 27 | |||
| 28 | This is the only method. It takes an E.123 international format string as its only argument, strips off the leading + and country code, and any whitespace, and returns what's left. For example ... | ||
| 29 | |||
| 30 | +44 20 8771 2924 -> 2087712924 | ||
| 31 | |||
| 32 | +1 212 334 0611 -> 2123340611 | ||
| 33 | |||
| 34 | =head1 AUTHOR, COPYRIGHT and LICENCE | ||
| 35 | |||
| 36 | Copyright 2026 David Cantrell E<lt>F<david@cantrell.org.uk>E<gt> | ||
| 37 | |||
| 38 | This software is free-as-in-speech software, and may be used, | ||
| 39 | distributed, and modified under the terms of either the GNU | ||
| 40 | General Public Licence version 2 or the Artistic Licence. It's | ||
| 41 | up to you which one you use. The full text of the licences can | ||
| 42 | be found in the files GPL2.txt and ARTISTIC.txt, respectively. | ||
| 43 | |||
| 44 | =cut | ||