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   1822 use base qw(Number::Phone::StubCountry);
  3         8  
  3         374  
21              
22 3     3   28 use strict;
  3         14  
  3         69  
23 3     3   19 use warnings;
  3         5  
  3         79  
24 3     3   19 use utf8;
  3         9  
  3         43  
25             our $VERSION = 1.20230307181419;
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 30 my $class = shift;
52 14         28 my $number = shift;
53 14         107 $number =~ s/(^\+45|\D)//g;
54 14         96 my $self = bless({ country_code => '45', number => $number, formatters => $formatters, validators => $validators, }, $class);
55 14 100       66 return $self->is_valid() ? $self : undef;
56             }
57             1;