line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::Coordinates::Converter::iArea; |
2
|
5
|
|
|
5
|
|
82765
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
147
|
|
3
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
203
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
5
|
5
|
|
|
5
|
|
109
|
use 5.00800; |
|
5
|
|
|
|
|
20
|
|
|
5
|
|
|
|
|
226
|
|
6
|
5
|
|
|
5
|
|
1564
|
use Geo::Coordinates::Converter; |
|
5
|
|
|
|
|
23846
|
|
|
5
|
|
|
|
|
118
|
|
7
|
5
|
|
|
5
|
|
2397
|
use CDB_File; |
|
5
|
|
|
|
|
2783
|
|
|
5
|
|
|
|
|
195
|
|
8
|
5
|
|
|
5
|
|
2283
|
use File::ShareDir 'dist_file'; |
|
5
|
|
|
|
|
19284
|
|
|
5
|
|
|
|
|
1410
|
|
9
|
|
|
|
|
|
|
Geo::Coordinates::Converter->add_default_formats('iArea'); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub get_center { |
12
|
5
|
|
|
5
|
1
|
329
|
my ($class, $areacode) = @_; |
13
|
|
|
|
|
|
|
|
14
|
5
|
|
|
|
|
21
|
my $file = dist_file('Geo-Coordinates-Converter-iArea', 'areacode2center.cdb'); |
15
|
5
|
|
|
|
|
1326
|
my $cdb = CDB_File->TIEHASH($file); |
16
|
5
|
100
|
|
|
|
76
|
if ($cdb->EXISTS($areacode)) { |
17
|
2
|
|
|
|
|
17
|
my ($lat, $lng) = split /,/, $cdb->FETCH($areacode); |
18
|
2
|
|
|
|
|
16
|
return Geo::Coordinates::Converter->new( |
19
|
|
|
|
|
|
|
lat => $lat, |
20
|
|
|
|
|
|
|
lng => $lng, |
21
|
|
|
|
|
|
|
datum => 'tokyo', |
22
|
|
|
|
|
|
|
format => 'degree', |
23
|
|
|
|
|
|
|
areacode => $areacode, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
} else { |
26
|
3
|
|
|
|
|
96
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub get_name { |
31
|
1
|
|
|
1
|
1
|
15
|
my ($class, $areacode) = @_; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
6
|
my $file = dist_file('Geo-Coordinates-Converter-iArea', 'areacode2name.cdb'); |
34
|
1
|
|
|
|
|
382
|
my $cdb = CDB_File->TIEHASH($file); |
35
|
1
|
50
|
|
|
|
26
|
if ($cdb->EXISTS($areacode)) { |
36
|
1
|
|
|
|
|
5
|
my $name = $cdb->FETCH($areacode); |
37
|
1
|
|
|
|
|
5
|
utf8::decode($name); |
38
|
1
|
|
|
|
|
40
|
return $name; |
39
|
|
|
|
|
|
|
} else { |
40
|
0
|
|
|
|
|
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
__END__ |