line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Recruit::Dokoiku; |
2
|
3
|
|
|
3
|
|
2536
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
165
|
|
3
|
3
|
|
|
3
|
|
18
|
use base qw( Class::Accessor::Fast ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
3018
|
|
4
|
3
|
|
|
3
|
|
11867
|
use vars qw( $VERSION ); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
194
|
|
5
|
|
|
|
|
|
|
$VERSION = '0.11'; |
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
2672
|
use WebService::Recruit::Dokoiku::SearchPOI; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
46
|
|
8
|
3
|
|
|
3
|
|
2419
|
use WebService::Recruit::Dokoiku::GetLandmark; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
37
|
|
9
|
3
|
|
|
3
|
|
2239
|
use WebService::Recruit::Dokoiku::GetStation; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
82
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my $PARAMS = [qw( key pagesize )]; |
12
|
|
|
|
|
|
|
my $TPPCFG = [qw( user_agent lwp_useragent http_lite utf8_flag )]; |
13
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( @$PARAMS, @$TPPCFG ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
2
|
|
|
2
|
1
|
1314
|
my $package = shift; |
17
|
2
|
|
|
|
|
7
|
my $self = {@_}; |
18
|
2
|
|
33
|
|
|
24
|
$self->{user_agent} ||= __PACKAGE__."/$VERSION "; |
19
|
2
|
|
|
|
|
6
|
bless $self, $package; |
20
|
2
|
|
|
|
|
6
|
$self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub init_treepp_config { |
24
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
25
|
0
|
|
|
|
|
|
my $api = shift; |
26
|
0
|
|
|
|
|
|
my $treepp = $api->treepp(); |
27
|
0
|
|
|
|
|
|
foreach my $key ( @$TPPCFG ) { |
28
|
0
|
0
|
|
|
|
|
next unless exists $self->{$key}; |
29
|
0
|
0
|
|
|
|
|
next unless defined $self->{$key}; |
30
|
0
|
|
|
|
|
|
$treepp->set( $key => $self->{$key} ); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub init_query_param { |
35
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
36
|
0
|
|
|
|
|
|
my $api = shift; |
37
|
0
|
|
|
|
|
|
foreach my $key ( @$PARAMS ) { |
38
|
0
|
0
|
|
|
|
|
next unless exists $self->{$key}; |
39
|
0
|
0
|
|
|
|
|
next unless defined $self->{$key}; |
40
|
0
|
|
|
|
|
|
$api->add_param( $key => $self->{$key} ); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub searchPOI { |
45
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
46
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
47
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::Dokoiku::SearchPOI->new(); |
48
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
49
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
50
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
51
|
0
|
|
|
|
|
|
$api->request(); |
52
|
0
|
|
|
|
|
|
$api; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub getLandmark { |
56
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
57
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
58
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::Dokoiku::GetLandmark->new(); |
59
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
60
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
61
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
62
|
0
|
|
|
|
|
|
$api->request(); |
63
|
0
|
|
|
|
|
|
$api; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub getStation { |
67
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
68
|
0
|
0
|
|
|
|
|
$self = $self->new() unless ref $self; |
69
|
0
|
|
|
|
|
|
my $api = WebService::Recruit::Dokoiku::GetStation->new(); |
70
|
0
|
|
|
|
|
|
$self->init_treepp_config( $api ); |
71
|
0
|
|
|
|
|
|
$self->init_query_param( $api ); |
72
|
0
|
|
|
|
|
|
$api->add_param( @_ ); |
73
|
0
|
|
|
|
|
|
$api->request(); |
74
|
0
|
|
|
|
|
|
$api; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 NAME |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
WebService::Recruit::Dokoiku - A Interface for Dokoiku Web Service Beta |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SYNOPSIS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
use WebService::Recruit::Dokoiku; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $doko = WebService::Recruit::Dokoiku->new(); |
86
|
|
|
|
|
|
|
$doko->key( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
my $param = { |
89
|
|
|
|
|
|
|
lat_jgd => '35.6686', |
90
|
|
|
|
|
|
|
lon_jgd => '139.7593', |
91
|
|
|
|
|
|
|
name => 'ATM', |
92
|
|
|
|
|
|
|
}; |
93
|
|
|
|
|
|
|
my $res = $doko->searchPOI( %$param ); |
94
|
|
|
|
|
|
|
my $list = $res->root->poi; |
95
|
|
|
|
|
|
|
foreach my $poi ( @$list ) { |
96
|
|
|
|
|
|
|
print "name: ", $poi->name, "\n"; |
97
|
|
|
|
|
|
|
print "addr: ", $poi->address, "\n"; |
98
|
|
|
|
|
|
|
print "web: ", $poi->dokopcurl, "\n"; |
99
|
|
|
|
|
|
|
print "map: ", $poi->dokomapurl, "\n"; |
100
|
|
|
|
|
|
|
print "\n"; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 DESCRIPTION |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This module is a interface for the Dokoiku Web Service I, |
106
|
|
|
|
|
|
|
provided by Recruit Co., Ltd., Japan. |
107
|
|
|
|
|
|
|
It provides three API methods: L, L |
108
|
|
|
|
|
|
|
and L. |
109
|
|
|
|
|
|
|
With these methods, you can find almost all of shops, restaurants |
110
|
|
|
|
|
|
|
and many other places in Japan. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 METHODS |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 new |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This is the constructor method for this class. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my $doko = WebService::Recruit::Dokoiku->new(); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This accepts optional parameters. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
my $conf = { key => 'your_auth_key', utf8_flag => 1 }; |
123
|
|
|
|
|
|
|
my $doko = WebService::Recruit::Dokoiku->new( %$conf ); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head2 key |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
A valid developer key is required to make a request. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
$doko->key( 'your_auth_key' ); |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 searchPOI |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This makes a request for C API. |
134
|
|
|
|
|
|
|
See L for details. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
my $res = $doko->searchPOI( lmcode => 4212, name => 'ATM' ); |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head2 getLandmark |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This makes a request for C API. |
141
|
|
|
|
|
|
|
See L for details. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
my $res = $doko->getLandmark( name => 'SHIBUYA 109' ); |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 getStation |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This makes a request for C API. |
148
|
|
|
|
|
|
|
See L for details. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
my $res = $doko->getStation( lon_jgd => 139.758, lat_jgd => 35.666 ); |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 utf8_flag / user_agent / lwp_useragent / http_lite |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This modules uses L module internally. |
155
|
|
|
|
|
|
|
Following methods are available to configure it. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
$doko->utf8_flag( 1 ); |
158
|
|
|
|
|
|
|
$doko->user_agent( 'Foo-Bar/1.0 ' ); |
159
|
|
|
|
|
|
|
$doko->lwp_useragent( LWP::UserAgent->new() ); |
160
|
|
|
|
|
|
|
$doko->http_lite( HTTP::Lite->new() ); |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 SEE ALSO |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
http://www.doko.jp/api/ |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 AUTHOR |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Yusuke Kawasaki L |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
This module is unofficial and released by the authour in person. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Copyright (c) 2007 Yusuke Kawasaki. All rights reserved. |
175
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
176
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |
179
|
|
|
|
|
|
|
1; |