WebService::Recruit::Jalan::AreaSearch - Jalan Web Service "AreaSearch" API
use WebService::Recruit::Jalan; my $jalan = WebService::Recruit::Jalan->new(); $jalan->key( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ); my $param = { reg => '15', }; my $res = $jalan->AreaSearch( %$param ); die "error!" if $res->is_error; my $list = $res->root->Area->Region; foreach my $reg ( @$list ) { print $reg->cd, "\t# ", $reg->name, "\n"; foreach my $pref ( @{ $reg->Prefecture } ) { print $pref->cd, "\t * ", $pref->name, "\n"; foreach my $large ( @{ $pref->LargeArea } ) { print $large->cd, "\t + ", $large->name, "\n"; foreach my $small ( @{ $large->SmallArea } ) { print $small->cd, "\t - ", $small->name, "\n"; } } } }
This module is a interface for the AreaSearch API. It accepts following query parameters to make an request.
AreaSearch
my $param = { reg => '10' pref => '130000' l_area => '136200' };
$jalan above is an instance of WebService::Recruit::Jalan.
$jalan
This returns the root element of the response.
my $root = $res->root;
You can retrieve each element by the following accessors.
$root->APIVersion; $root->Area; $root->Area->Region; $root->Area->Region->[0]->cd; $root->Area->Region->[0]->name; $root->Area->Region->[0]->Prefecture; $root->Area->Region->[0]->Prefecture->[0]->cd; $root->Area->Region->[0]->Prefecture->[0]->name; $root->Area->Region->[0]->Prefecture->[0]->LargeArea; $root->Area->Region->[0]->Prefecture->[0]->LargeArea->[0]->cd; $root->Area->Region->[0]->Prefecture->[0]->LargeArea->[0]->name; $root->Area->Region->[0]->Prefecture->[0]->LargeArea->[0]->SmallArea; $root->Area->Region->[0]->Prefecture->[0]->LargeArea->[0]->SmallArea->[0]->cd; $root->Area->Region->[0]->Prefecture->[0]->LargeArea->[0]->SmallArea->[0]->name;
This returns the raw response context itself.
print $res->xml, "\n";
This returns the response status code.
my $code = $res->code; # usually "200" when succeeded
This returns true value when the response has an error.
die 'error!' if $res->is_error;
WebService::Recruit::Jalan
Yusuke Kawasaki http://www.kawa.net/
This module is unofficial and released by the author in person.
Copyright (c) 2007 Yusuke Kawasaki. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WebService::Recruit::Jalan, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Recruit::Jalan
CPAN shell
perl -MCPAN -e shell install WebService::Recruit::Jalan
For more information on module installation, please visit the detailed CPAN module installation guide.