line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Recruit::Dokoiku::SearchPOI; |
2
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
113
|
|
3
|
3
|
|
|
3
|
|
15
|
use base qw( WebService::Recruit::Dokoiku::Base ); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
1918
|
|
4
|
3
|
|
|
3
|
|
21
|
use vars qw( $VERSION ); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
920
|
|
5
|
|
|
|
|
|
|
$VERSION = '0.10'; |
6
|
|
|
|
|
|
|
|
7
|
0
|
|
|
0
|
1
|
0
|
sub url { 'http://api.doko.jp/v1/searchPOI.do'; } |
8
|
0
|
|
|
0
|
1
|
0
|
sub force_array { [qw( poi )]; } |
9
|
0
|
|
|
0
|
1
|
0
|
sub elem_class { 'WebService::Recruit::Dokoiku::SearchPOI::Element'; } |
10
|
1
|
|
|
1
|
1
|
49
|
sub query_class { 'WebService::Recruit::Dokoiku::SearchPOI::Query'; } |
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
0
|
55
|
sub query_fields { [qw( |
13
|
|
|
|
|
|
|
key format callback pagenum pagesize keyword name tel |
14
|
|
|
|
|
|
|
lat_jgd lon_jgd radius lmcode iarea order |
15
|
|
|
|
|
|
|
)]; } |
16
|
3
|
|
|
3
|
1
|
39
|
sub root_elem { 'results'; } |
17
|
|
|
|
|
|
|
sub elem_fields { { |
18
|
3
|
|
|
3
|
0
|
39
|
results => [qw( |
19
|
|
|
|
|
|
|
status totalcount pagenum poi |
20
|
|
|
|
|
|
|
)], |
21
|
|
|
|
|
|
|
poi => [qw( |
22
|
|
|
|
|
|
|
code name kana tel address stationcode station distance |
23
|
|
|
|
|
|
|
dokopcurl dokomburl dokomapurl reviewrank tag |
24
|
|
|
|
|
|
|
)], |
25
|
|
|
|
|
|
|
}; } |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# __PACKAGE__->mk_query_accessors(); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
@WebService::Recruit::Dokoiku::SearchPOI::Query::ISA = qw( Class::Accessor::Fast ); |
30
|
|
|
|
|
|
|
WebService::Recruit::Dokoiku::SearchPOI::Query->mk_accessors( @{query_fields()} ); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# __PACKAGE__->mk_elem_accessors(); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
@WebService::Recruit::Dokoiku::SearchPOI::Element::ISA = qw( Class::Accessor::Children::Fast ); |
35
|
|
|
|
|
|
|
WebService::Recruit::Dokoiku::SearchPOI::Element->mk_ro_accessors( root_elem() ); |
36
|
|
|
|
|
|
|
WebService::Recruit::Dokoiku::SearchPOI::Element->mk_child_ro_accessors( %{elem_fields()} ); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 NAME |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
WebService::Recruit::Dokoiku::SearchPOI - Dokoiku Web Service Beta "searchPOI" API |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SYNOPSIS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
use WebService::Recruit::Dokoiku; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $doko = WebService::Recruit::Dokoiku->new(); |
47
|
|
|
|
|
|
|
$doko->key( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my $param = { |
50
|
|
|
|
|
|
|
lat_jgd => '35.6686', |
51
|
|
|
|
|
|
|
lon_jgd => '139.7593', |
52
|
|
|
|
|
|
|
name => 'ATM', |
53
|
|
|
|
|
|
|
}; |
54
|
|
|
|
|
|
|
my $res = $doko->searchPOI( %$param ); |
55
|
|
|
|
|
|
|
die 'error!' if $res->is_error; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $list = $res->root->poi; |
58
|
|
|
|
|
|
|
foreach my $poi ( @$list ) { |
59
|
|
|
|
|
|
|
print "name: ", $poi->name, "\n"; |
60
|
|
|
|
|
|
|
print "addr: ", $poi->address, "\n"; |
61
|
|
|
|
|
|
|
print "web: ", $poi->dokopcurl, "\n"; |
62
|
|
|
|
|
|
|
print "map: ", $poi->dokomapurl, "\n"; |
63
|
|
|
|
|
|
|
print "\n"; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 DESCRIPTION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
This module is a interface for the C API. |
69
|
|
|
|
|
|
|
It accepts following query parameters to make an request. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $param = { |
72
|
|
|
|
|
|
|
pagenum => '1', |
73
|
|
|
|
|
|
|
pagesize => '10', |
74
|
|
|
|
|
|
|
keyword => 'keyword for place', |
75
|
|
|
|
|
|
|
name => 'name of place', |
76
|
|
|
|
|
|
|
tel => '03-3575-1111', |
77
|
|
|
|
|
|
|
lat_jgd => '35.6686', |
78
|
|
|
|
|
|
|
lon_jgd => '139.7593', |
79
|
|
|
|
|
|
|
radius => '1000', |
80
|
|
|
|
|
|
|
lmcode => '1908', |
81
|
|
|
|
|
|
|
iarea => '05800', |
82
|
|
|
|
|
|
|
order => '1', |
83
|
|
|
|
|
|
|
}; |
84
|
|
|
|
|
|
|
my $res = $doko->searchPOI( %$param ); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
C<$doko> above is an instance of L. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 METHODS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head2 root |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This returns the root element of the response. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $root = $res->root; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
You can retrieve each element by the following accessors. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
$root->status; |
99
|
|
|
|
|
|
|
$root->totalcount; |
100
|
|
|
|
|
|
|
$root->pagenum; |
101
|
|
|
|
|
|
|
$root->poi->[0]->code; |
102
|
|
|
|
|
|
|
$root->poi->[0]->name; |
103
|
|
|
|
|
|
|
$root->poi->[0]->kana; |
104
|
|
|
|
|
|
|
$root->poi->[0]->tel; |
105
|
|
|
|
|
|
|
$root->poi->[0]->address; |
106
|
|
|
|
|
|
|
$root->poi->[0]->stationcode; |
107
|
|
|
|
|
|
|
$root->poi->[0]->station; |
108
|
|
|
|
|
|
|
$root->poi->[0]->distance; |
109
|
|
|
|
|
|
|
$root->poi->[0]->dokopcurl; |
110
|
|
|
|
|
|
|
$root->poi->[0]->dokomburl; |
111
|
|
|
|
|
|
|
$root->poi->[0]->dokomapurl; |
112
|
|
|
|
|
|
|
$root->poi->[0]->reviewrank; |
113
|
|
|
|
|
|
|
$root->poi->[0]->tag; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 xml |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This returns the raw response context itself. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
print $res->xml, "\n"; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 code |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This returns the response status code. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
my $code = $res->code; # usually "200" when succeeded |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 is_error |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This returns true value when the response has an error. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
die 'error!' if $res->is_error; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 page |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This returns a L instance. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
my $page = $res->page(); |
138
|
|
|
|
|
|
|
print "Total: ", $page->total_entries, "\n"; |
139
|
|
|
|
|
|
|
print "Page: ", $page->current_page, "\n"; |
140
|
|
|
|
|
|
|
print "Last: ", $page->last_page, "\n"; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 pageset |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This returns a L instance. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
my $pageset = $res->pageset( 'fixed' ); |
147
|
|
|
|
|
|
|
$pageset->pages_per_set($pages_per_set); |
148
|
|
|
|
|
|
|
my $set = $pageset->pages_in_set(); |
149
|
|
|
|
|
|
|
foreach my $num ( @$set ) { |
150
|
|
|
|
|
|
|
print "$num "; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 page_param |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This returns a hash to specify the page for the next request. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
my %hash = $res->page_param( $page->next_page ); |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 page_query |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
This returns a query string to specify the page for the next request. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
my $query = $res->page_query( $page->prev_page ); |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head1 SEE ALSO |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
L |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 AUTHOR |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Yusuke Kawasaki L |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
This module is unofficial and released by the authour in person. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Copyright (c) 2007 Yusuke Kawasaki. All rights reserved. |
178
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
179
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |
182
|
|
|
|
|
|
|
1; |