File Coverage

blib/lib/Number/Phone/Formatter/National.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::National;
2              
3 5     5   2699 use strict;
  5         24  
  5         156  
4 5     5   26 use warnings;
  5         14  
  5         159  
5 5     5   30 use parent 'Number::Phone::Formatter';
  5         14  
  5         36  
6 5     5   279 use Scalar::Util qw(reftype);
  5         12  
  5         585  
7              
8             our $VERSION = '1.0';
9              
10             sub format {
11 16     16 1 45 my ($class, $number, $object) = @_;
12              
13 16         60 $class->_format($object, 1);
14             }
15              
16             1;
17              
18             =head1 NAME
19              
20             Number::Phone::Formatter::National - formatter for nationally-formatted phone number
21              
22             =head1 DESCRIPTION
23              
24             A formatter to output the number in its national 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-formatted number.
32              
33             +1 212 334 0611 -> 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