WebService::Recruit::HotPepper::ShopSearch - HotPepper Web Service "ShopSearch" API
use WebService::Recruit::HotPepper; my $api = WebService::Recruit::HotPepper->new(); $api->key( 'xxxxxxxxxxxxxxxx' ); my $param = { Keyword => 'pizza', }; my $res = $api->ShopSearch( %$param ); die 'error!' if $res->is_error; my $list = $res->root->Shop; foreach my $shop ( @$list ) { print "name: ", $shop->ShopName, "\n"; print "addr: ", $shop->ShopAddress, "\n"; print "\n"; }
This module is an interface for the ShopSearch API. It accepts following query parameters to make an request.
ShopSearch
my $param = { Start => 1, Count => 10, keyword => 'italian pizza', ShopTel => '0300000000', # without hyphen # # ...and so on. See # http://api.hotpepper.jp/reference.html # for a complete list of available params. }; my $res = $hpp->ShopSearch( %$param );
$hpp above is an instance of WebService::Recruit::HotPepper.
$hpp
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->Shop->[0]->ShopIdFront; $root->Shop->[0]->ShopName; $root->Shop->[0]->ShopNameKana; $root->Shop->[0]->ShopAddress; $root->Shop->[0]->Desc; $root->Shop->[0]->GenreName; $root->Shop->[0]->ShopUrl; $root->Shop->[0]->KtaiShopUrl;
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;
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";
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 "; }
This returns a hash to specify the page for the next request.
my %hash = $res->page_param( $page->next_page );
This returns a query string to specify the page for the next request.
my $query = $res->page_query( $page->prev_page );
WebService::Recruit::HotPepper
Toshimasa Ishibashi http://iandeth.dyndns.org/
This module is unofficial and released by the author in person.
Yusuke Kawasaki http://www.kawa.net/
For creating/preparing all the base modules and stuff.
Copyright (c) 2007 Toshimasa Ishibashi. 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::HotPepper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Recruit::HotPepper
CPAN shell
perl -MCPAN -e shell install WebService::Recruit::HotPepper
For more information on module installation, please visit the detailed CPAN module installation guide.