NAME

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

SYNOPSIS

use WebService::Recruit::Jalan;

my $jalan = WebService::Recruit::Jalan->new();
$jalan->key( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' );

my $param = {
    s_area      =>  '141602',
};
my $res = $jalan->OnsenSearch( %$param );
die "error!" if $res->is_error;

my $list = $res->root->Onsen;
foreach my $onsen ( @$list ) {
    print "OnsenID: ",   $onsen->OnsenID, "\n";
    print "OnsenName: ", $onsen->OnsenName, "\n";
}

DESCRIPTION

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

my $param = {
    reg         =>  '10',
    pref        =>  '130000',
    l_area      =>  '136200',
    s_area      =>  '136202',
    onsen_q     =>  '0',
    start       =>  '1',
    count       =>  '10',
    xml_ptn     =>  '0',
};

$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->NumberOfResults;
$root->DisplayPerPage;
$root->DisplayFrom;
$root->APIVersion;
$root->Onsen;
$root->Onsen->[0]->OnsenName;
$root->Onsen->[0]->OnsenNameKana;
$root->Onsen->[0]->OnsenID;
$root->Onsen->[0]->OnsenAddress;
$root->Onsen->[0]->Area;
$root->Onsen->[0]->Area->Region;
$root->Onsen->[0]->Area->Prefecture;
$root->Onsen->[0]->Area->LargeArea;
$root->Onsen->[0]->Area->SmallArea;
$root->Onsen->[0]->NatureOfOnsen;
$root->Onsen->[0]->OnsenAreaName;
$root->Onsen->[0]->OnsenAreaNameKana;
$root->Onsen->[0]->OnsenAreaID;
$root->Onsen->[0]->OnsenAreaURL;
$root->Onsen->[0]->OnsenAreaCaption;

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;

page

This returns a Data::Page instance.

my $page = $res->page();
print "Total: ", $page->total_entries, "\n";
print "Page: ", $page->current_page, "\n";
print "Last: ", $page->last_page, "\n";

pageset

This returns a Data::Pageset instance.

my $pageset = $res->pageset( 'fixed' );
$pageset->pages_per_set($pages_per_set);
my $set = $pageset->pages_in_set();
foreach my $num ( @$set ) {
    print "$num ";
}

page_param

This returns a hash to specify the page for the next request.

my %hash = $res->page_param( $page->next_page );

page_query

This returns a query string to specify the page for the next request.

my $query = $res->page_query( $page->prev_page );

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.