Normal/Config/AreaCodes.pm

filter: Statementstmt 94.1% 16 / 17 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 84.0% 21 / 25 CC 3 SCAR 8.0
CC
3
Cov
81%
_data
3.4
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« Normal/Config/AddressStem.pm ↑ Summary Normal/Config/TitleStem.pm »
1 package String::Normal::Config::AreaCodes;
2 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 9 ▶use String::Normal::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 1 ▶sub _data {
Subroutine _data: called CC=3 SCAR=12.3
9 1 my %params = @_;
10  
11 1 my $fh;
12 1 ▶ if ($params{area_codes}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{'area_codes'}) { } 0 1 1
13 0 ▶ open $fh, $params{area_codes} or die "Can't read '$params{area_codes}' $!\n";
Branch: 1 branch
BranchTrueFalseTotal
open $fh, $params{"area_codes"} or die qq[Can't read '$params{"area_codes"}' $!\n] 0 0 0
14 } else {
15 1 $fh = *DATA;
16 }
17  
18 1 chomp( my @codes = <$fh> );
19 1 return \@codes;
20 }
21  
22 9 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<< <jeffa at cpan.org> >>
45  
46 =head1 LICENSE AND COPYRIGHT
47  
48 Copyright 2024 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<http://www.perlfoundation.org/artistic_license_2_0>
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__
« Normal/Config/AddressStem.pm ↑ Summary Normal/Config/TitleStem.pm »