blib/lib/Number/Phone/StubCountry/KR.pm

filter: Statementstmt 100% 28 / 28 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 97.3% 37 / 38 CC 3 SCAR 6.2
CC
3
Cov
97%
new
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« blib/lib/Number/Phone/StubCountry/KP.pm ↑ Summary blib/lib/Number/Phone/StubCountry/LB.pm »
1 # automatically generated file, don't edit
2  
3  
4  
5 # Copyright 2026 David Cantrell, derived from data from libphonenumber
6 # http://code.google.com/p/libphonenumber/
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #
12 # http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 package Number::Phone::StubCountry::KR;
20 2 ▶use base qw(Number::Phone::StubCountry);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 2 our $VERSION = 1.20260904101550;
26  
27 2 my $formatters = [
28 {
29 'format' => '$1',
30 'intl_format' => 'NA',
31 'leading_digits' => '1[016-9]114',
32 'national_rule' => '0$1',
33 'pattern' => '(\\d{5})'
34 },
35 {
36 'format' => '$1-$2',
37 'leading_digits' => '
38 (?:
39 3[1-3]|
40 [46][1-4]|
41 5[1-5]
42 )1
43 ',
44 'national_rule' => '0$1',
45 'pattern' => '(\\d{2})(\\d{3,4})'
46 },
47 {
48 'format' => '$1-$2',
49 'leading_digits' => '1',
50 'pattern' => '(\\d{4})(\\d{4})'
51 },
52 {
53 'format' => '$1-$2-$3',
54 'leading_digits' => '2',
55 'national_rule' => '0$1',
56 'pattern' => '(\\d)(\\d{3,4})(\\d{4})'
57 },
58 {
59 'format' => '$1-$2-$3',
60 'leading_digits' => '
61 [36]0|
62 8
63 ',
64 'national_rule' => '0$1',
65 'pattern' => '(\\d{2})(\\d{3})(\\d{4})'
66 },
67 {
68 'format' => '$1-$2-$3',
69 'leading_digits' => '
70 [1346]|
71 5[1-5]
72 ',
73 'national_rule' => '0$1',
74 'pattern' => '(\\d{2})(\\d{3,4})(\\d{4})'
75 },
76 {
77 'format' => '$1-$2-$3',
78 'leading_digits' => '[57]',
79 'national_rule' => '0$1',
80 'pattern' => '(\\d{2})(\\d{4})(\\d{4})'
81 },
82 {
83 'format' => '$1 $2 $3',
84 'intl_format' => 'NA',
85 'leading_digits' => '0030',
86 'pattern' => '(\\d{5})(\\d{3})(\\d{3})'
87 },
88 {
89 'format' => '$1-$2-$3',
90 'leading_digits' => '5',
91 'national_rule' => '0$1',
92 'pattern' => '(\\d{2})(\\d{5})(\\d{4})'
93 },
94 {
95 'format' => '$1 $2 $3',
96 'intl_format' => 'NA',
97 'pattern' => '(\\d{5})(\\d{3,4})(\\d{4})'
98 },
99 {
100 'format' => '$1 $2 $3 $4',
101 'intl_format' => 'NA',
102 'pattern' => '(\\d{5})(\\d{2})(\\d{3})(\\d{4})'
103 }
104 ];
105  
106 2 my $validators = {
107 'fixed_line' => '
108 (?:
109 2|
110 3[1-3]|
111 [46][1-4]|
112 5[1-5]
113 )[1-9]\\d{6,7}|
114 (?:
115 3[1-3]|
116 [46][1-4]|
117 5[1-5]
118 )1\\d{2,3}
119 ',
120 'geographic' => '
121 (?:
122 2|
123 3[1-3]|
124 [46][1-4]|
125 5[1-5]
126 )[1-9]\\d{6,7}|
127 (?:
128 3[1-3]|
129 [46][1-4]|
130 5[1-5]
131 )1\\d{2,3}
132 ',
133 'mobile' => '
134 1(?:
135 05(?:
136 [0-8]\\d|
137 9[0-6]
138 )|
139 22[13]\\d
140 )\\d{4,5}|
141 1(?:
142 0[0-46-9]|
143 [16-9]\\d|
144 2[013-9]
145 )\\d{6,7}
146 ',
147 'pager' => '15\\d{7,8}',
148 'personal_number' => '50\\d{8,9}',
149 'specialrate' => '(60[2-9]\\d{6})|(
150 1(?:
151 5(?:
152 22|
153 33|
154 44|
155 66|
156 77|
157 88|
158 99
159 )|
160 6(?:
161 [07]0|
162 44|
163 6[0168]|
164 88
165 )|
166 8(?:
167 00|
168 33|
169 55|
170 77|
171 99
172 )
173 )\\d{4}
174 )',
175 'toll_free' => '
176 00(?:
177 308\\d{6,7}|
178 798\\d{7,9}
179 )|
180 (?:
181 00368|
182 [38]0
183 )\\d{7}
184 ',
185 'voip' => '70\\d{8}'
186 };
187 2 my %areanames = ();
188 2 $areanames{ko} = {"8232", "인천",
189 "8263", "전북",
190 "8261", "전남",
191 "822", "서울",
192 "8242", "대전",
193 "8253", "대구",
194 "8251", "부산",
195 "8264", "제주",
196 "8254", "경북",
197 "8262", "광주",
198 "8243", "충북",
199 "8241", "충남",
200 "8233", "강원",
201 "8231", "경기",
202 "8252", "울산",
203 "8255", "경남",
204 "8244", "세종",};
205 2 $areanames{en} = {"8244", "Sejong\ City",
206 "8233", "Gangwon",
207 "8262", "Gwangju",
208 "8241", "Chungnam",
209 "8231", "Gyeonggi",
210 "8243", "Chungbuk",
211 "8252", "Ulsan",
212 "8255", "Gyeongnam",
213 "8264", "Jeju",
214 "8254", "Gyeongbuk",
215 "8263", "Jeonbuk",
216 "8261", "Jeonnam",
217 "822", "Seoul",
218 "8232", "Incheon",
219 "8242", "Daejeon",
220 "8253", "Daegu",
221 "8251", "Busan",};
222 2 my $timezones = {
223 '' => [
224 'Asia/Seoul'
225 ]
226 };
227  
228 25 ▶ sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
229 25 my $class = shift;
230 25 my $number = shift;
231 25 $number =~ s/(^\+82|\D)//g;
232 25 my $self = bless({ country_code => '82', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class);
233 25 ▶ return $self if ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_valid 24 1 25
234 1 $number =~ s/^(?:0(8(?:[1-46-8]|5\d\d))?)//;
235 1 $self = bless({ country_code => '82', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
236 1 ▶ return $self->is_valid() ? $self : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->is_valid ? : 0 1 1
237 }
238 2 1;
« blib/lib/Number/Phone/StubCountry/KP.pm ↑ Summary blib/lib/Number/Phone/StubCountry/LB.pm »