line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Number::Phone::UK::Data; |
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
6042315
|
use warnings; |
|
17
|
|
|
|
|
87
|
|
|
17
|
|
|
|
|
963
|
|
4
|
17
|
|
|
17
|
|
210
|
use strict; |
|
17
|
|
|
|
|
132
|
|
|
17
|
|
|
|
|
705
|
|
5
|
|
|
|
|
|
|
|
6
|
17
|
|
|
17
|
|
178
|
use Number::Phone; |
|
17
|
|
|
|
|
133
|
|
|
17
|
|
|
|
|
327
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "2.0001"; |
9
|
|
|
|
|
|
|
|
10
|
17
|
|
|
17
|
|
942
|
use DBM::Deep; |
|
17
|
|
|
|
|
170417
|
|
|
17
|
|
|
|
|
143
|
|
11
|
17
|
|
|
17
|
|
675
|
use File::ShareDir; |
|
17
|
|
|
|
|
82
|
|
|
17
|
|
|
|
|
4683
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $file = Number::Phone::_find_data_file('Number-Phone-UK-Data.db'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $slurped = 0; |
16
|
|
|
|
|
|
|
my $db; |
17
|
|
|
|
|
|
|
my $pid = -1; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub db { |
20
|
9810
|
100
|
|
9810
|
0
|
71466
|
return $db if($slurped); |
21
|
6751
|
100
|
100
|
|
|
15316
|
if(!$db || $pid != $$) { |
22
|
|
|
|
|
|
|
# we want to re-open the DB if we've forked, because of |
23
|
|
|
|
|
|
|
# https://github.com/DrHyde/perl-modules-Number-Phone/issues/72 |
24
|
18
|
|
|
|
|
239
|
$pid = $$; |
25
|
18
|
50
|
|
|
|
1816
|
open(my $ro_fh, '<:bytes', $file) || die(__PACKAGE__.": can't open $file: $!\n"); |
26
|
18
|
|
|
|
|
282
|
$db = DBM::Deep->new(fh => $ro_fh); |
27
|
|
|
|
|
|
|
} |
28
|
6751
|
|
|
|
|
565618
|
return $db |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub slurp { |
32
|
4
|
100
|
|
4
|
0
|
4023849
|
return if($slurped); |
33
|
3
|
|
|
|
|
161
|
$db = _slurp(db()); |
34
|
3
|
|
|
|
|
305
|
$slurped++; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _slurp { |
38
|
1992615
|
|
|
1992615
|
|
5565838
|
my $db = shift; |
39
|
1992615
|
100
|
|
|
|
2851723996
|
if(!ref($db)) { |
40
|
1988907
|
|
|
|
|
12803917
|
return $db |
41
|
|
|
|
|
|
|
} else { |
42
|
|
|
|
|
|
|
return { map { |
43
|
1992612
|
|
|
|
|
2073954794
|
$_ => _slurp($db->{$_}) |
44
|
3708
|
|
|
|
|
5969
|
} keys(%{$db}) }; |
|
3708
|
|
|
|
|
15635
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |