Geography::JapaneseMunicipals

Geography::JapanesePrefecturesの市区町村版みたいなGeography::JapaneseMunicipalsを作った。
近々、CPANにうpしようかと。

use strict;
use warnings;
use utf8;

use FindBin::libs;
use Geography::JapaneseMunicipals;
use YAML;

binmode STDOUT, ':encoding(sjis)';

my $name = '東京都渋谷区';
my $id = Geography::JapaneseMunicipals->municipal_id($name);
print "$name -> $id\n";
# 東京都渋谷区 -> 13113

$id = '01202';
$name = Geography::JapaneseMunicipals->municipal_name($id);
print "$id -> $name\n";
# 01202 -> 函館市

my $municipals = Geography::JapaneseMunicipals->municipal_infos('東京都');
print Dump $municipals;
# ---
# - id: 13101
#   name: 千代田区
#   prefecture:
#     id: 13
#     name: 東京都
#   region:
#     name: 関東
# 
# ...
# 
# - id: 13421
#   name: 小笠原村
#   prefecture:
#     id: 13
#     name: 東京都
#   region:
#     name: 関東