The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

WebService::Recruit::Jalan::AreaSearch - Jalan Web Service "AreaSearch" API

SYNOPSIS

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";
            }
        }
    }
}

DESCRIPTION

This module is a interface for the AreaSearch API. It accepts following query parameters to make an request.

my $param = {
    reg         =>  '10'
    pref        =>  '130000'
    l_area      =>  '136200'
};

$jalan above is an instance of WebService::Recruit::Jalan.

METHODS

root

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;

xml

This returns the raw response context itself.

print $res->xml, "\n";

code

This returns the response status code.

my $code = $res->code; # usually "200" when succeeded

is_error

This returns true value when the response has an error.

die 'error!' if $res->is_error;

SEE ALSO

WebService::Recruit::Jalan

AUTHOR

Yusuke Kawasaki http://www.kawa.net/

This module is unofficial and released by the author in person.

COPYRIGHT AND LICENSE

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.