File Coverage

blib/lib/Number/Phone/StubCountry/DK.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 25 25 100.0


line stmt bran cond sub pod time code
1             # automatically generated file, don't edit
2              
3              
4              
5             # Copyright 2023 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::DK;
20 3     3   1613 use base qw(Number::Phone::StubCountry);
  3         12  
  3         325  
21              
22 3     3   26 use strict;
  3         11  
  3         69  
23 3     3   19 use warnings;
  3         8  
  3         76  
24 3     3   19 use utf8;
  3         6  
  3         22  
25             our $VERSION = 1.20230614174403;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3 $4',
30             'leading_digits' => '[2-9]',
31             'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})'
32             }
33             ];
34              
35             my $validators = {
36             'geographic' => '
37             (?:
38             [2-7]\\d|
39             8[126-9]|
40             9[1-46-9]
41             )\\d{6}
42             ',
43             'pager' => '',
44             'personal_number' => '',
45             'specialrate' => '(90\\d{6})',
46             'toll_free' => '80\\d{6}',
47             'voip' => ''
48             };
49              
50             sub new {
51 14     14 1 35 my $class = shift;
52 14         27 my $number = shift;
53 14         90 $number =~ s/(^\+45|\D)//g;
54 14         88 my $self = bless({ country_code => '45', number => $number, formatters => $formatters, validators => $validators, }, $class);
55 14 100       84 return $self->is_valid() ? $self : undef;
56             }
57             1;