File Coverage

blib/lib/Number/Phone/StubCountry/OM.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::OM;
20 2     2   1220 use base qw(Number::Phone::StubCountry);
  2         10  
  2         232  
21              
22 2     2   18 use strict;
  2         8  
  2         53  
23 2     2   17 use warnings;
  2         12  
  2         54  
24 2     2   13 use utf8;
  2         4  
  2         13  
25             our $VERSION = 1.20230903131448;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2',
30             'leading_digits' => '[58]',
31             'pattern' => '(\\d{3})(\\d{4,6})'
32             },
33             {
34             'format' => '$1 $2',
35             'leading_digits' => '2',
36             'pattern' => '(\\d{2})(\\d{6})'
37             },
38             {
39             'format' => '$1 $2',
40             'leading_digits' => '[179]',
41             'pattern' => '(\\d{4})(\\d{4})'
42             }
43             ];
44              
45             my $validators = {
46             'fixed_line' => '2[1-6]\\d{6}',
47             'geographic' => '2[1-6]\\d{6}',
48             'mobile' => '
49             1505\\d{4}|
50             (?:
51             7(?:
52             [1289]\\d|
53             6[89]|
54             7[0-5]
55             )|
56             9(?:
57             0[1-9]|
58             [1-9]\\d
59             )
60             )\\d{5}
61             ',
62             'pager' => '',
63             'personal_number' => '',
64             'specialrate' => '(900\\d{5})',
65             'toll_free' => '
66             8007\\d{4,5}|
67             (?:
68             500|
69             800[05]
70             )\\d{4}
71             ',
72             'voip' => ''
73             };
74             my %areanames = ();
75             $areanames{en} = {"96824", "Muscat",
76             "96826", "Al\ Batinah\ \&\ Musandam",
77             "96825", "A\’Dakhliyah\,\ Al\ Sharqiya\ \&\ A\’Dhahira",
78             "96823", "Dhofar\ \&\ Al\ Wusta",};
79              
80             sub new {
81 13     13 1 31 my $class = shift;
82 13         27 my $number = shift;
83 13         87 $number =~ s/(^\+968|\D)//g;
84 13         87 my $self = bless({ country_code => '968', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
85 13 100       62 return $self->is_valid() ? $self : undef;
86             }
87             1;