| 1 | 12 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 12 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 12 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package Number::Phone::FR; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # $VERSION is limited to 2 digits after the dot | ||||||||||||||||||||||||||||
| 8 | # Other digits are reserved for ARCEP data versonning | ||||||||||||||||||||||||||||
| 9 | # in Number::Phone::FR::Full | ||||||||||||||||||||||||||||
| 10 | 12 | our $VERSION = '0.08'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 12 | ▶ | use Number::Phone; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 12 | ▶ | use parent 'Number::Phone'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 12 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 12 | ▶ | use Scalar::Util 'blessed'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 12 | my %pkg2impl; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # Select the implementation to use via "use Number::Phone::FR" | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | sub import | ||||||||||||||||||||||||||||
| 23 | { | ||||||||||||||||||||||||||||
| 24 | 68 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=8 SCAR=23.9
| |||||||||||||||||||||||||||||
| 25 | 68 | ▶ | croak "invalid sub-class" unless $class->isa(__PACKAGE__); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 68 | ▶ | if ($class eq __PACKAGE__) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 68 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | 8 | $class = $_[0]; | |||||||||||||||||||||||||||
| 29 | 8 | $class =~ s/^:?(.)/\U$1/; | |||||||||||||||||||||||||||
| 30 | 8 | substr($class, 0, 0) = __PACKAGE__.'::'; | |||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 8 | my $level = 0; | |||||||||||||||||||||||||||
| 33 | 8 | my $pkg; | |||||||||||||||||||||||||||
| 34 | 8 | ▶ | while (($pkg = (caller $level)[0]) =~ /^Number::Phone(?:::|$)/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | $level++; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | 8 | $pkg2impl{$pkg} = $class; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | # Load the class | ||||||||||||||||||||||||||||
| 40 | 8 | ▶ | eval "require $class; 1" or croak "$@\n"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | 8 | ▶ | $class->isa(__PACKAGE__) or croak "$class is not a valid class"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | } else { | ||||||||||||||||||||||||||||
| 44 | #croak "unexpected arguments for import" if @_; | ||||||||||||||||||||||||||||
| 45 | 0 | my $pkg = (caller)[0]; | |||||||||||||||||||||||||||
| 46 | 0 | ▶ | croak "$class is private" unless $pkg =~ m/^Number::Phone(?:::|$)/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 0 | $pkg2impl{$pkg} = $class; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | #END { | ||||||||||||||||||||||||||||
| 52 | # foreach (sort keys %pkg2impl) { | ||||||||||||||||||||||||||||
| 53 | # print STDERR "# $_ => $pkg2impl{$_}\n"; | ||||||||||||||||||||||||||||
| 54 | # } | ||||||||||||||||||||||||||||
| 55 | #} | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | # Select the implementation based on $pkg2impl | ||||||||||||||||||||||||||||
| 59 | sub _get_class | ||||||||||||||||||||||||||||
| 60 | { | ||||||||||||||||||||||||||||
| 61 | 744 | ▶ | my ($class) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_get_class: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||
| 62 | 744 | ▶ | return $class if defined $class && $class ne __PACKAGE__; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $class and $class ne __PACKAGE__
MC/DC0%0/2
defined $class and $class ne __PACKAGE__
defined $class
$class ne __PACKAGE__
Truth table66%2/3
A and B
A= defined $classB= $class ne __PACKAGE__
| |||||||||||||||||||||||||||||
| 63 | 744 | my $level = 0; | |||||||||||||||||||||||||||
| 64 | 744 | my ($pkg, $impl); | |||||||||||||||||||||||||||
| 65 | 744 | ▶ | while ($pkg = (caller $level)[0]) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 2142 | $impl = $pkg2impl{$pkg}; | |||||||||||||||||||||||||||
| 67 | 2142 | ▶ | return $impl if defined $impl; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 68 | 1648 | $level++; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | # Default implementation | ||||||||||||||||||||||||||||
| 71 | 250 | return __PACKAGE__; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 12 | use constant RE_SUBSCRIBER => | |||||||||||||||||||||||||||
| 76 | qr{ | ||||||||||||||||||||||||||||
| 77 | \A | ||||||||||||||||||||||||||||
| 78 | (?: | ||||||||||||||||||||||||||||
| 79 | \+33 # Préfixe international (+33 numéro) | ||||||||||||||||||||||||||||
| 80 | | (?:3651)? | ||||||||||||||||||||||||||||
| 81 | (?: | ||||||||||||||||||||||||||||
| 82 | [04789] # Transporteur par défaut (0) ou Sélection du transporteur | ||||||||||||||||||||||||||||
| 83 | | 16 [0-9]{2} # Sélection du transporteur | ||||||||||||||||||||||||||||
| 84 | ) (?:033)? # Préfixe international (0033 numéro) | ||||||||||||||||||||||||||||
| 85 | ) ([1-9][0-9]{8}) # Numéro de ligne | ||||||||||||||||||||||||||||
| 86 | \z | ||||||||||||||||||||||||||||
| 87 | 12 | ▶ | }xs; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 12 | use constant RE_FULL => | |||||||||||||||||||||||||||
| 90 | qr{ | ||||||||||||||||||||||||||||
| 91 | \A (?: | ||||||||||||||||||||||||||||
| 92 | 1 (?: | ||||||||||||||||||||||||||||
| 93 | 0[0-9]{2} # Opérateur | ||||||||||||||||||||||||||||
| 94 | | 5 # SAMU | ||||||||||||||||||||||||||||
| 95 | | 7 # Police/gendarmerie | ||||||||||||||||||||||||||||
| 96 | | 8 # Pompiers | ||||||||||||||||||||||||||||
| 97 | | 1 (?: | ||||||||||||||||||||||||||||
| 98 | 2 # Numéro d'urgence européen | ||||||||||||||||||||||||||||
| 99 | | 5 # Urgences sociales | ||||||||||||||||||||||||||||
| 100 | | 6000 # 116000 : Enfance maltraitée | ||||||||||||||||||||||||||||
| 101 | | 8[0-9]{3} # 118XYZ : Renseignements téléphoniques | ||||||||||||||||||||||||||||
| 102 | | 9 # Enfance maltraitée | ||||||||||||||||||||||||||||
| 103 | ) | ||||||||||||||||||||||||||||
| 104 | ) | ||||||||||||||||||||||||||||
| 105 | | 3[0-9]{3} | ||||||||||||||||||||||||||||
| 106 | | (?: | ||||||||||||||||||||||||||||
| 107 | \+33 # Préfixe international (+33 numéro) | ||||||||||||||||||||||||||||
| 108 | | (?:3651)? # Préfixe d'anonymisation | ||||||||||||||||||||||||||||
| 109 | (?: | ||||||||||||||||||||||||||||
| 110 | [04789] # Transporteur par défaut (0) ou Sélection du transporteur | ||||||||||||||||||||||||||||
| 111 | | 16 [0-9]{2} # Sélection du transporteur | ||||||||||||||||||||||||||||
| 112 | ) (?:033)? # Préfixe international (0033 numéro) | ||||||||||||||||||||||||||||
| 113 | ) [1-9][0-9]{8} # Numéro de ligne | ||||||||||||||||||||||||||||
| 114 | ) \z | ||||||||||||||||||||||||||||
| 115 | 12 | ▶ | }xs; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | sub country_code() { 33 } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | # Number::Phone's implementation of country() does not yet allow | ||||||||||||||||||||||||||||
| 123 | # clean subclassing so we explicitely implement it here | ||||||||||||||||||||||||||||
| 124 | sub country() { 'FR' } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | sub new | ||||||||||||||||||||||||||||
| 128 | { | ||||||||||||||||||||||||||||
| 129 | 231 | ▶ | my $class = shift; | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=18.4
Pod
documented
| |||||||||||||||||||||||||||||
| 130 | 231 | my $number = shift; | |||||||||||||||||||||||||||
| 131 | 231 | ▶ | $class = ref $class if ref $class; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 231 | $class = _get_class($class); | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 231 | ▶ | croak "No number given to ".__PACKAGE__."->new()\n" unless defined $number; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | 231 | ▶ | croak "Invalid phone number (scalar expected)" if ref $number; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 231 | my $num = $number; | |||||||||||||||||||||||||||
| 139 | 231 | $num =~ s/[^+0-9]//g; | |||||||||||||||||||||||||||
| 140 | 231 | ▶ | return Number::Phone->new("+$1") if $num =~ /\A(?:\+|00)((?:[^3]|3[^3]).*)\z/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 231 | ▶ | return is_valid($number) ? bless(\$num, $class) : undef; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | sub is_valid | ||||||||||||||||||||||||||||
| 147 | { | ||||||||||||||||||||||||||||
| 148 | 324 | ▶ | my ($number) = (@_); | ||||||||||||||||||||||||||
|
Subroutine
is_valid: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||
| 149 | 324 | ▶ | return 1 if blessed($number) && $number->isa(__PACKAGE__); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($number) and $number->isa(__PACKAGE__)
MC/DC0%0/2
builtin::blessed($number) and $number->isa(__PACKAGE__)
builtin::blessed($number)
$number->isa(__PACKAGE__)
Truth table33%1/3
A and B
A= builtin::blessed($number)B= $number->isa(__PACKAGE__)
| |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 324 | my $class = _get_class(); | |||||||||||||||||||||||||||
| 152 | 324 | return $number =~ $class->RE_FULL; | |||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | sub is_allocated | ||||||||||||||||||||||||||||
| 157 | { | ||||||||||||||||||||||||||||
| 158 | undef | ||||||||||||||||||||||||||||
| 159 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
is_allocated: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | sub is_in_use | ||||||||||||||||||||||||||||
| 162 | { | ||||||||||||||||||||||||||||
| 163 | undef | ||||||||||||||||||||||||||||
| 164 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
is_in_use: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | sub _num(\@) | ||||||||||||||||||||||||||||
| 167 | { | ||||||||||||||||||||||||||||
| 168 | 392 | ▶ | my $args = shift; | ||||||||||||||||||||||||||
|
Subroutine
_num: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 169 | 392 | my $num = shift @$args; | |||||||||||||||||||||||||||
| 170 | 392 | my $class = ref $num; | |||||||||||||||||||||||||||
| 171 | 392 | ▶ | if ($class) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 172 | 203 | $num = ${$num}; | |||||||||||||||||||||||||||
| 173 | } else { | ||||||||||||||||||||||||||||
| 174 | 189 | $class = _get_class(); | |||||||||||||||||||||||||||
| 175 | 189 | $num = shift @$args; | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | 392 | return ($class, $num); | |||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | # Vérifie les chiffres du numéro de ligne | ||||||||||||||||||||||||||||
| 181 | # Les numéros spéciaux ne matchent pas | ||||||||||||||||||||||||||||
| 182 | sub _check_line | ||||||||||||||||||||||||||||
| 183 | { | ||||||||||||||||||||||||||||
| 184 | 180 | ▶ | my ($class, $num) = _num(@_); | ||||||||||||||||||||||||||
|
Subroutine
_check_line: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 185 | 180 | my @matches = ($num =~ $class->RE_SUBSCRIBER); | |||||||||||||||||||||||||||
| 186 | 180 | ▶ | return 0 unless @matches; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | 180 | my $line = (grep { defined } @matches)[0]; | |||||||||||||||||||||||||||
| 188 | 180 | ▶ | return 1 if $line =~ shift; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 189 | undef | ||||||||||||||||||||||||||||
| 190 | 90 | } | |||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | sub is_geographic | ||||||||||||||||||||||||||||
| 193 | { | ||||||||||||||||||||||||||||
| 194 | 60 | ▶ | return _check_line(@_, qr/\A[1-5].{8}\z/) | ||||||||||||||||||||||||||
|
Subroutine
is_geographic: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||
| 197 | sub is_fixed_line | ||||||||||||||||||||||||||||
| 198 | { | ||||||||||||||||||||||||||||
| 199 | 60 | ▶ | return _check_line(@_, qr/\A[1-5].{8}\z/) | ||||||||||||||||||||||||||
|
Subroutine
is_fixed_line: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | sub is_mobile | ||||||||||||||||||||||||||||
| 203 | { | ||||||||||||||||||||||||||||
| 204 | 60 | ▶ | return _check_line(@_, qr/\A[67].{8}\z/) | ||||||||||||||||||||||||||
|
Subroutine
is_mobile: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | sub is_pager | ||||||||||||||||||||||||||||
| 208 | { | ||||||||||||||||||||||||||||
| 209 | undef | ||||||||||||||||||||||||||||
| 210 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
is_pager: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | sub is_ipphone | ||||||||||||||||||||||||||||
| 213 | { | ||||||||||||||||||||||||||||
| 214 | 0 | ▶ | return _check_line(@_, qr/\A9/) | ||||||||||||||||||||||||||
|
Subroutine
is_ipphone: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | sub is_isdn | ||||||||||||||||||||||||||||
| 218 | { | ||||||||||||||||||||||||||||
| 219 | undef | ||||||||||||||||||||||||||||
| 220 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
is_isdn: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | sub is_tollfree | ||||||||||||||||||||||||||||
| 223 | { | ||||||||||||||||||||||||||||
| 224 | #return 1 | ||||||||||||||||||||||||||||
| 225 | # FIXME Gérer les préfixes | ||||||||||||||||||||||||||||
| 226 | 0 | ▶ | return 0 unless $_[1] =~ /\A08[0-9]{8}\z/; | ||||||||||||||||||||||||||
|
Subroutine
is_tollfree: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 227 | undef | ||||||||||||||||||||||||||||
| 228 | 0 | } | |||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | sub is_specialrate | ||||||||||||||||||||||||||||
| 231 | { | ||||||||||||||||||||||||||||
| 232 | # FIXME Gérer les préfixes | ||||||||||||||||||||||||||||
| 233 | 0 | ▶ | return 0 unless $_[1] =~ /\A08[0-9]{8}\z/; | ||||||||||||||||||||||||||
|
Subroutine
is_specialrate: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 234 | 0 | 1 | |||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | sub is_adult | ||||||||||||||||||||||||||||
| 238 | { | ||||||||||||||||||||||||||||
| 239 | 0 | ▶ | return 0 unless _check_line(@_, qr/\A8/); | ||||||||||||||||||||||||||
|
Subroutine
is_adult: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | undef | ||||||||||||||||||||||||||||
| 241 | 0 | } | |||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | sub is_personal | ||||||||||||||||||||||||||||
| 244 | { | ||||||||||||||||||||||||||||
| 245 | undef | ||||||||||||||||||||||||||||
| 246 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
is_personal: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | sub is_corporate | ||||||||||||||||||||||||||||
| 249 | { | ||||||||||||||||||||||||||||
| 250 | undef | ||||||||||||||||||||||||||||
| 251 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
is_corporate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | sub is_government | ||||||||||||||||||||||||||||
| 254 | { | ||||||||||||||||||||||||||||
| 255 | undef | ||||||||||||||||||||||||||||
| 256 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
is_government: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | sub is_international | ||||||||||||||||||||||||||||
| 259 | { | ||||||||||||||||||||||||||||
| 260 | undef | ||||||||||||||||||||||||||||
| 261 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
is_international: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | sub is_network_service | ||||||||||||||||||||||||||||
| 264 | { | ||||||||||||||||||||||||||||
| 265 | 54 | ▶ | my ($class, $num) = _num(@_); | ||||||||||||||||||||||||||
|
Subroutine
is_network_service: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||
| 266 | # Les services réseau sont en direct : jamais de préfixe | ||||||||||||||||||||||||||||
| 267 | 54 | ▶ | ($num =~ /\A1(?:|[578]|0[0-9]{2}|1(?:[259]|6000|8[0-9]{3}))\z/) ? 1 : 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | sub areacode | ||||||||||||||||||||||||||||
| 271 | { | ||||||||||||||||||||||||||||
| 272 | undef | ||||||||||||||||||||||||||||
| 273 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
areacode: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | sub areaname | ||||||||||||||||||||||||||||
| 276 | { | ||||||||||||||||||||||||||||
| 277 | undef | ||||||||||||||||||||||||||||
| 278 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
areaname: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | sub location | ||||||||||||||||||||||||||||
| 281 | { | ||||||||||||||||||||||||||||
| 282 | undef | ||||||||||||||||||||||||||||
| 283 | 0 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
location: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | sub subscriber | ||||||||||||||||||||||||||||
| 286 | { | ||||||||||||||||||||||||||||
| 287 | 152 | ▶ | my ($class, $num) = _num(@_); | ||||||||||||||||||||||||||
|
Subroutine
subscriber: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 288 | 152 | my @m = ($num =~ $class->RE_SUBSCRIBER); | |||||||||||||||||||||||||||
| 289 | 152 | ▶ | return undef unless @m; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 290 | 98 | @m = grep { defined } @m; | |||||||||||||||||||||||||||
| 291 | 98 | $m[0]; | |||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | my %length_to_format = ( | ||||||||||||||||||||||||||||
| 295 | # 2 => as is | ||||||||||||||||||||||||||||
| 296 | 2 | ▶ | 4 => sub { s/\A(..)(..)/$1 $2/ }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 297 | 0 | ▶ | 6 => sub { s/\A(...)(...)/$1 $2/ }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 298 | 0 | ▶ | 10 => sub { s/(\d\d)(?=.)/$1 /g }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 299 | 13 => sub { | ||||||||||||||||||||||||||||
| 300 | 0 | ▶ | s/\A(00)(33)(.)(..)(..)(..)(..)\z/+$2 $3 $4 $5 $6 $7/ | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 301 | || s/\A(....)(.)(..)(..)(..)(..)\z/+33 $1 $2 $3 $4 $5 $6/ | ||||||||||||||||||||||||||||
| 302 | }, | ||||||||||||||||||||||||||||
| 303 | 2 | ▶ | 14 => sub { s/\A(....)(..)(..)(..)(..)(..)\z/$1 $2 $3 $4 $5 $6/ }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 304 | 2 | ▶ | 12 => sub { s/\A(\+33)(.)(..)(..)(..)(..)\z/$1 $2 $3 $4 $5 $6/ }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 305 | 0 | ▶ | 16 => sub { s/\A(\+33)(....)(.)(..)(..)(..)(..)\z/$1 $2 $3 $4 $5 $6 $7/ }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 306 | 12 | ); | |||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | sub format | ||||||||||||||||||||||||||||
| 309 | { | ||||||||||||||||||||||||||||
| 310 | 6 | ▶ | my ($class, $num) = _num(@_); | ||||||||||||||||||||||||||
|
Subroutine
format: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||
| 311 | 6 | my $l = length $num; | |||||||||||||||||||||||||||
| 312 | 6 | my $fmt = $length_to_format{$l}; | |||||||||||||||||||||||||||
| 313 | return defined $fmt | ||||||||||||||||||||||||||||
| 314 | 6 | ▶ | ? do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 315 | 6 | local $_ = $num; | |||||||||||||||||||||||||||
| 316 | 6 | $fmt->(); | |||||||||||||||||||||||||||
| 317 | 6 | $_; | |||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | : $num; | ||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | package Number::Phone::FR::Simple; | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | 12 | ▶ | use parent 'Number::Phone::FR'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | BEGIN { | ||||||||||||||||||||||||||||
| 329 | 12 | ▶ | $INC{'Number/Phone/FR/Simple.pm'} = __FILE__; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | 12 | 1; | |||||||||||||||||||||||||||
| 333 | __END__ | ||||||||||||||||||||||||||||