File Coverage

blib/lib/String/Normal/Config/AreaCodes.pm
Criterion Covered Total %
statement 15 16 93.7
branch 1 4 25.0
condition n/a
subroutine 4 4 100.0
pod n/a
total 20 24 83.3


line stmt bran cond sub pod time code
1             package String::Normal::Config::AreaCodes;
2 9     9   29 use strict;
  9         8  
  9         185  
3 9     9   25 use warnings;
  9         7  
  9         151  
4              
5 9     9   26 use String::Normal::Config;
  9         6  
  9         828  
6              
7              
8             sub _data {
9 1     1   3 my %params = @_;
10              
11 1         1 my $fh;
12 1 50       2 if ($params{area_codes}) {
13 0 0       0 open $fh, $params{area_codes} or die "Can't read '$params{area_codes}' $!\n";
14             } else {
15 1         3 $fh = *DATA;
16             }
17              
18 1         132 chomp( my @codes = <$fh> );
19 1         11 return \@codes;
20             }
21              
22             1;
23              
24             =head1 NAME
25              
26             String::Normal::Config::AreaCodes;
27              
28             =head1 DESCRIPTION
29              
30             This package defines valid U.S. area codes.
31              
32             =head1 STRUCTURE
33              
34             One entry per line. Each entry should be exactly 3 digits with no other characters.
35             See C<__DATA__> section for examples.
36              
37             You can provide your own data by creating a text file containing your
38             values and provide the path to that file via the constructor:
39              
40             my $normalizer = String::Normal->new( area_codes => '/path/to/values.txt' );
41              
42             =head1 AUTHOR
43              
44             Jeff Anderson, C<< >>
45              
46             =head1 LICENSE AND COPYRIGHT
47              
48             Copyright 2016 Jeff Anderson.
49              
50             This program is free software; you can redistribute it and/or modify it
51             under the terms of the the Artistic License (2.0). You may obtain a
52             copy of the full license at:
53              
54             L
55              
56             Any use, modification, and distribution of the Standard or Modified
57             Versions is governed by this Artistic License. By using, modifying or
58             distributing the Package, you accept this license. Do not use, modify,
59             or distribute the Package, if you do not accept this license.
60              
61             If your Modified Version has been derived from a Modified Version made
62             by someone other than you, you are nevertheless required to ensure that
63             your Modified Version complies with the requirements of this license.
64              
65             This license does not grant you the right to use any trademark, service
66             mark, tradename, or logo of the Copyright Holder.
67              
68             This license includes the non-exclusive, worldwide, free-of-charge
69             patent license to make, have made, use, offer to sell, sell, import and
70             otherwise transfer the Package with respect to any patent claims
71             licensable by the Copyright Holder that are necessarily infringed by the
72             Package. If you institute patent litigation (including a cross-claim or
73             counterclaim) against any party alleging that the Package constitutes
74             direct or contributory patent infringement, then this Artistic License
75             to you shall terminate on the date that such litigation is filed.
76              
77             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
78             AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
79             THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
80             PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
81             YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
82             CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
83             CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
84             EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
85              
86             =cut
87              
88             __DATA__