| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::Recruit::Jalan::OnsenSearch; |
|
2
|
3
|
|
|
3
|
|
20
|
use strict; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
129
|
|
|
3
|
3
|
|
|
3
|
|
17
|
use vars qw( $VERSION ); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
134
|
|
|
4
|
3
|
|
|
3
|
|
17
|
use base qw( WebService::Recruit::Jalan::Base ); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
1327
|
|
|
5
|
|
|
|
|
|
|
$VERSION = '0.10'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
0
|
|
|
0
|
1
|
0
|
sub url { 'http://jws.jalan.net/APICommon/OnsenSearch/V1/'; } |
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
1
|
401
|
sub query_class { 'WebService::Recruit::Jalan::OnsenSearch::Query'; } |
|
10
|
3
|
|
|
3
|
0
|
45
|
sub query_fields { [qw( |
|
11
|
|
|
|
|
|
|
key reg pref l_area s_area onsen_q start count xml_ptn |
|
12
|
|
|
|
|
|
|
)]; } |
|
13
|
0
|
|
|
0
|
1
|
0
|
sub notnull_param { [qw( key )]; } |
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
|
|
0
|
1
|
0
|
sub elem_class { 'WebService::Recruit::Jalan::OnsenSearch::Element'; } |
|
16
|
3
|
|
|
3
|
1
|
43
|
sub root_elem { 'Results'; } |
|
17
|
|
|
|
|
|
|
sub elem_fields { { |
|
18
|
3
|
|
|
3
|
0
|
56
|
Results => [qw( |
|
19
|
|
|
|
|
|
|
NumberOfResults DisplayPerPage DisplayFrom APIVersion Onsen |
|
20
|
|
|
|
|
|
|
)], |
|
21
|
|
|
|
|
|
|
Onsen => [qw( |
|
22
|
|
|
|
|
|
|
OnsenName OnsenNameKana OnsenID OnsenAddress Area NatureOfOnsen |
|
23
|
|
|
|
|
|
|
OnsenAreaName OnsenAreaNameKana OnsenAreaID OnsenAreaURL |
|
24
|
|
|
|
|
|
|
OnsenAreaCaption |
|
25
|
|
|
|
|
|
|
)], |
|
26
|
|
|
|
|
|
|
Area => [qw( |
|
27
|
|
|
|
|
|
|
Region Prefecture LargeArea SmallArea |
|
28
|
|
|
|
|
|
|
)], |
|
29
|
|
|
|
|
|
|
}; } |
|
30
|
0
|
|
|
0
|
1
|
|
sub force_array { [qw( Onsen )]; } |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# __PACKAGE__->mk_query_accessors(); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
@WebService::Recruit::Jalan::OnsenSearch::Query::ISA = qw( Class::Accessor::Fast ); |
|
35
|
|
|
|
|
|
|
WebService::Recruit::Jalan::OnsenSearch::Query->mk_accessors( @{query_fields()} ); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# __PACKAGE__->mk_elem_accessors(); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
@WebService::Recruit::Jalan::OnsenSearch::Element::ISA = qw( Class::Accessor::Children::Fast ); |
|
40
|
|
|
|
|
|
|
WebService::Recruit::Jalan::OnsenSearch::Element->mk_ro_accessors( root_elem() ); |
|
41
|
|
|
|
|
|
|
WebService::Recruit::Jalan::OnsenSearch::Element->mk_child_ro_accessors( %{elem_fields()} ); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
WebService::Recruit::Jalan::OnsenSearch - Jalan Web Service "OnsenSearch" API |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
use WebService::Recruit::Jalan; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $jalan = WebService::Recruit::Jalan->new(); |
|
52
|
|
|
|
|
|
|
$jalan->key( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ); |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my $param = { |
|
55
|
|
|
|
|
|
|
s_area => '141602', |
|
56
|
|
|
|
|
|
|
}; |
|
57
|
|
|
|
|
|
|
my $res = $jalan->OnsenSearch( %$param ); |
|
58
|
|
|
|
|
|
|
die "error!" if $res->is_error; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $list = $res->root->Onsen; |
|
61
|
|
|
|
|
|
|
foreach my $onsen ( @$list ) { |
|
62
|
|
|
|
|
|
|
print "OnsenID: ", $onsen->OnsenID, "\n"; |
|
63
|
|
|
|
|
|
|
print "OnsenName: ", $onsen->OnsenName, "\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
|
|
|
|
|
|
|
reg => '10', |
|
73
|
|
|
|
|
|
|
pref => '130000', |
|
74
|
|
|
|
|
|
|
l_area => '136200', |
|
75
|
|
|
|
|
|
|
s_area => '136202', |
|
76
|
|
|
|
|
|
|
onsen_q => '0', |
|
77
|
|
|
|
|
|
|
start => '1', |
|
78
|
|
|
|
|
|
|
count => '10', |
|
79
|
|
|
|
|
|
|
xml_ptn => '0', |
|
80
|
|
|
|
|
|
|
}; |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
C<$jalan> above is an instance of L. |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 METHODS |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 root |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This returns the root element of the response. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my $root = $res->root; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
You can retrieve each element by the following accessors. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$root->NumberOfResults; |
|
95
|
|
|
|
|
|
|
$root->DisplayPerPage; |
|
96
|
|
|
|
|
|
|
$root->DisplayFrom; |
|
97
|
|
|
|
|
|
|
$root->APIVersion; |
|
98
|
|
|
|
|
|
|
$root->Onsen; |
|
99
|
|
|
|
|
|
|
$root->Onsen->[0]->OnsenName; |
|
100
|
|
|
|
|
|
|
$root->Onsen->[0]->OnsenNameKana; |
|
101
|
|
|
|
|
|
|
$root->Onsen->[0]->OnsenID; |
|
102
|
|
|
|
|
|
|
$root->Onsen->[0]->OnsenAddress; |
|
103
|
|
|
|
|
|
|
$root->Onsen->[0]->Area; |
|
104
|
|
|
|
|
|
|
$root->Onsen->[0]->Area->Region; |
|
105
|
|
|
|
|
|
|
$root->Onsen->[0]->Area->Prefecture; |
|
106
|
|
|
|
|
|
|
$root->Onsen->[0]->Area->LargeArea; |
|
107
|
|
|
|
|
|
|
$root->Onsen->[0]->Area->SmallArea; |
|
108
|
|
|
|
|
|
|
$root->Onsen->[0]->NatureOfOnsen; |
|
109
|
|
|
|
|
|
|
$root->Onsen->[0]->OnsenAreaName; |
|
110
|
|
|
|
|
|
|
$root->Onsen->[0]->OnsenAreaNameKana; |
|
111
|
|
|
|
|
|
|
$root->Onsen->[0]->OnsenAreaID; |
|
112
|
|
|
|
|
|
|
$root->Onsen->[0]->OnsenAreaURL; |
|
113
|
|
|
|
|
|
|
$root->Onsen->[0]->OnsenAreaCaption; |
|
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 author 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; |