line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Geo::Postcodes::JP; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
31151
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.014'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1310
|
use Geo::Postcodes::JP::DB; |
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
56
|
|
9
|
1
|
|
|
1
|
|
6
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new |
12
|
|
|
|
|
|
|
{ |
13
|
0
|
|
|
0
|
1
|
|
my ($package, %inputs) = @_; |
14
|
0
|
|
|
|
|
|
my $db_file = $inputs{db_file}; |
15
|
0
|
|
|
|
|
|
my $object = {}; |
16
|
0
|
|
|
|
|
|
$object->{db} = Geo::Postcodes::JP::DB->new (%inputs); |
17
|
0
|
|
|
|
|
|
return bless $object; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub postcode_to_address |
21
|
|
|
|
|
|
|
{ |
22
|
0
|
|
|
0
|
1
|
|
my ($object, $postcode) = @_; |
23
|
|
|
|
|
|
|
# Remove non-digits |
24
|
0
|
|
|
|
|
|
$postcode =~ s/\D//g; |
25
|
0
|
|
|
|
|
|
my $addresses = $object->{db}->lookup_postcode ($postcode); |
26
|
0
|
|
|
|
|
|
return $addresses; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub printed_address |
30
|
|
|
|
|
|
|
{ |
31
|
0
|
|
|
0
|
0
|
|
my ($object, $address) = @_; |
32
|
0
|
|
|
|
|
|
my $o = ''; |
33
|
|
|
|
|
|
|
# $o .= "〒" . $address->{postcode} . "\n"; |
34
|
0
|
|
|
|
|
|
$o .= $address->{ken_kanji} . "\n"; |
35
|
0
|
|
|
|
|
|
$o .= $address->{city_kanji} . "\n"; |
36
|
0
|
|
|
|
|
|
$o .= $address->{address_kanji}; |
37
|
0
|
0
|
|
|
|
|
if ($address->{street_number}) { |
38
|
0
|
|
|
|
|
|
$o .= $address->{street_number} |
39
|
|
|
|
|
|
|
} |
40
|
0
|
|
|
|
|
|
$o .= "\n"; |
41
|
0
|
0
|
|
|
|
|
if ($address->{jigyosyo_kanji}) { |
42
|
0
|
|
|
|
|
|
$o .= $address->{jigyosyo_kanji} . "\n"; |
43
|
|
|
|
|
|
|
} |
44
|
0
|
|
|
|
|
|
return $o; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |