| 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::HR; | ||||||||||
| 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 $2 $3', | ||||||||||
| 30 | 'leading_digits' => '6[01]', | ||||||||||
| 31 | 'national_rule' => '0$1', | ||||||||||
| 32 | 'pattern' => '(\\d{2})(\\d{2})(\\d{3})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2 $3', | ||||||||||
| 36 | 'leading_digits' => '8', | ||||||||||
| 37 | 'national_rule' => '0$1', | ||||||||||
| 38 | 'pattern' => '(\\d{3})(\\d{2})(\\d{2,3})' | ||||||||||
| 39 | }, | ||||||||||
| 40 | { | ||||||||||
| 41 | 'format' => '$1 $2 $3', | ||||||||||
| 42 | 'leading_digits' => '1', | ||||||||||
| 43 | 'national_rule' => '0$1', | ||||||||||
| 44 | 'pattern' => '(\\d)(\\d{4})(\\d{3})' | ||||||||||
| 45 | }, | ||||||||||
| 46 | { | ||||||||||
| 47 | 'format' => '$1 $2 $3', | ||||||||||
| 48 | 'leading_digits' => ' | ||||||||||
| 49 | 6| | ||||||||||
| 50 | 7[245] | ||||||||||
| 51 | ', | ||||||||||
| 52 | 'national_rule' => '0$1', | ||||||||||
| 53 | 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})' | ||||||||||
| 54 | }, | ||||||||||
| 55 | { | ||||||||||
| 56 | 'format' => '$1 $2 $3', | ||||||||||
| 57 | 'leading_digits' => '9', | ||||||||||
| 58 | 'national_rule' => '0$1', | ||||||||||
| 59 | 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})' | ||||||||||
| 60 | }, | ||||||||||
| 61 | { | ||||||||||
| 62 | 'format' => '$1 $2 $3', | ||||||||||
| 63 | 'leading_digits' => '[2-57]', | ||||||||||
| 64 | 'national_rule' => '0$1', | ||||||||||
| 65 | 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})' | ||||||||||
| 66 | }, | ||||||||||
| 67 | { | ||||||||||
| 68 | 'format' => '$1 $2 $3', | ||||||||||
| 69 | 'leading_digits' => '8', | ||||||||||
| 70 | 'national_rule' => '0$1', | ||||||||||
| 71 | 'pattern' => '(\\d{3})(\\d{3})(\\d{3})' | ||||||||||
| 72 | } | ||||||||||
| 73 | ]; | ||||||||||
| 74 | |||||||||||
| 75 | 2 | my $validators = { | |||||||||
| 76 | 'fixed_line' => ' | ||||||||||
| 77 | 1\\d{7}| | ||||||||||
| 78 | (?: | ||||||||||
| 79 | 2[0-3]| | ||||||||||
| 80 | 3[1-5]| | ||||||||||
| 81 | 4[02-47-9]| | ||||||||||
| 82 | 5[1-3] | ||||||||||
| 83 | )\\d{6,7} | ||||||||||
| 84 | ', | ||||||||||
| 85 | 'geographic' => ' | ||||||||||
| 86 | 1\\d{7}| | ||||||||||
| 87 | (?: | ||||||||||
| 88 | 2[0-3]| | ||||||||||
| 89 | 3[1-5]| | ||||||||||
| 90 | 4[02-47-9]| | ||||||||||
| 91 | 5[1-3] | ||||||||||
| 92 | )\\d{6,7} | ||||||||||
| 93 | ', | ||||||||||
| 94 | 'mobile' => ' | ||||||||||
| 95 | 9(?: | ||||||||||
| 96 | (?: | ||||||||||
| 97 | 0[1-9]| | ||||||||||
| 98 | [12589]\\d | ||||||||||
| 99 | )\\d\\d| | ||||||||||
| 100 | 7(?: | ||||||||||
| 101 | [0679]\\d\\d| | ||||||||||
| 102 | 5(?: | ||||||||||
| 103 | [01]\\d| | ||||||||||
| 104 | 44| | ||||||||||
| 105 | 55| | ||||||||||
| 106 | 77| | ||||||||||
| 107 | 9[5-79] | ||||||||||
| 108 | ) | ||||||||||
| 109 | ) | ||||||||||
| 110 | )\\d{4}| | ||||||||||
| 111 | 98\\d{6} | ||||||||||
| 112 | ', | ||||||||||
| 113 | 'pager' => '', | ||||||||||
| 114 | 'personal_number' => '7[45]\\d{6}', | ||||||||||
| 115 | 'specialrate' => '( | ||||||||||
| 116 | 6[01459]\\d{6}| | ||||||||||
| 117 | 6[01]\\d{5} | ||||||||||
| 118 | )|( | ||||||||||
| 119 | 62\\d{6,7}| | ||||||||||
| 120 | 72\\d{6} | ||||||||||
| 121 | )', | ||||||||||
| 122 | 'toll_free' => '80\\d{5,7}', | ||||||||||
| 123 | 'voip' => '' | ||||||||||
| 124 | }; | ||||||||||
| 125 | 2 | my %areanames = (); | |||||||||
| 126 | 2 | $areanames{en} = {"38552", "Istra", | |||||||||
| 127 | "38520", "Dubrovnik\-Neretva", | ||||||||||
| 128 | "38523", "Zadar", | ||||||||||
| 129 | "38547", "Karlovac", | ||||||||||
| 130 | "38535", "Brod\-Posavina", | ||||||||||
| 131 | "38522", "Šibenik\-Knin", | ||||||||||
| 132 | "38553", "Lika\-Senj", | ||||||||||
| 133 | "38531", "Osijek\-Baranja", | ||||||||||
| 134 | "3851", "Zagreb", | ||||||||||
| 135 | "38551", "Primorsko\-goranska", | ||||||||||
| 136 | "38544", "Sisak\-Moslavina", | ||||||||||
| 137 | "38533", "Virovitica\-Podravina", | ||||||||||
| 138 | "38549", "Krapina\-Zagorje", | ||||||||||
| 139 | "38532", "Vukovar\-Srijem", | ||||||||||
| 140 | "38521", "Split\-Dalmatia", | ||||||||||
| 141 | "38534", "Požega\-Slavonia", | ||||||||||
| 142 | "38548", "Koprivnica\-Križevci", | ||||||||||
| 143 | "38540", "Međimurje", | ||||||||||
| 144 | "38543", "Bjelovar\-Bilogora", | ||||||||||
| 145 | "38542", "Varaždin",}; | ||||||||||
| 146 | 2 | my $timezones = { | |||||||||
| 147 | '' => [ | ||||||||||
| 148 | 'Europe/Zagreb' | ||||||||||
| 149 | ] | ||||||||||
| 150 | }; | ||||||||||
| 151 | |||||||||||
| 152 | 19 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 153 | 19 | my $class = shift; | |||||||||
| 154 | 19 | my $number = shift; | |||||||||
| 155 | 19 | $number =~ s/(^\+385|\D)//g; | |||||||||
| 156 | 19 | my $self = bless({ country_code => '385', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 157 | 19 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 158 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 159 | 1 | $self = bless({ country_code => '385', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 160 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 161 | } | ||||||||||
| 162 | 2 | 1; | |||||||||