File Coverage

blib/lib/Number/Phone/Formatter/NationallyPreferredIntl.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 20 20 100.0


line stmt bran cond sub pod time code
1             package Number::Phone::Formatter::NationallyPreferredIntl;
2              
3 2     2   944 use strict;
  2         6  
  2         70  
4 2     2   14 use warnings;
  2         5  
  2         66  
5 2     2   12 use parent 'Number::Phone::Formatter';
  2         9  
  2         20  
6 2     2   132 use Scalar::Util qw(reftype);
  2         4  
  2         247  
7              
8             our $VERSION = '1.0';
9              
10             sub format {
11 8     8 1 28 my ($class, $number, $object) = @_;
12              
13 8         32 $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