line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Number::Phone::Formatter::NationallyPreferredIntl; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
993
|
use strict; |
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
66
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
64
|
|
5
|
2
|
|
|
2
|
|
15
|
use parent 'Number::Phone::Formatter'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
26
|
|
6
|
2
|
|
|
2
|
|
122
|
use Scalar::Util qw(reftype); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
234
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.0'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub format { |
11
|
8
|
|
|
8
|
1
|
23
|
my ($class, $number, $object) = @_; |
12
|
|
|
|
|
|
|
|
13
|
8
|
|
|
|
|
29
|
$class->_format($object, 0); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
1; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Number::Phone::Formatter::NationallyPreferredIntl - nationally-preferred format for international phone number |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
A formatter to output the international number in its nationally preferred format. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 METHOD |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 format |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This is the only method. It takes an E.123 international format string and a Number::Phone object, |
31
|
|
|
|
|
|
|
and outputs the nationally-preferred international representation of the phone number. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
+1 212 334 0611 -> +1 212-334-0611 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
Note that this uses data derived from libphonenumber, and if your object is |
36
|
|
|
|
|
|
|
not derived from that it will first create a temporary object. This may |
37
|
|
|
|
|
|
|
involve a small unexpected performance hit. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 AUTHOR, COPYRIGHT and LICENCE |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Copyright 2018 Matthew Somerville EFE |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This software is free-as-in-speech software, and may be used, |
44
|
|
|
|
|
|
|
distributed, and modified under the terms of either the GNU |
45
|
|
|
|
|
|
|
General Public Licence version 2 or the Artistic Licence. It's |
46
|
|
|
|
|
|
|
up to you which one you use. The full text of the licences can |
47
|
|
|
|
|
|
|
be found in the files GPL2.txt and ARTISTIC.txt, respectively. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=cut |