File Coverage

blib/lib/Number/Phone/Formatter/Raw.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
1             package Number::Phone::Formatter::Raw;
2              
3 1     1   1121 use strict;
  1         82  
  1         39  
4 1     1   6 use warnings;
  1         2  
  1         141  
5              
6             sub format {
7 6     6 1 13 my $class = shift;
8 6         15 my $number = shift;
9 6         32 $number =~ s/.*?\s//;
10 6         41 $number =~ s/\D//g;
11 6         62 return $number
12             }
13              
14             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 2023 David Cantrell EFE
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