| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WebService::Recruit::Jalan; | 
| 2 | 3 |  |  | 3 |  | 2758 | use strict; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 142 |  | 
| 3 | 3 |  |  | 3 |  | 17 | use base qw( Class::Accessor::Fast ); | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 2801 |  | 
| 4 | 3 |  |  | 3 |  | 12197 | use vars qw( $VERSION ); | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 194 |  | 
| 5 |  |  |  |  |  |  | $VERSION = '0.10'; | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 3 |  |  | 3 |  | 2543 | use WebService::Recruit::Jalan::HotelSearchLite; | 
|  | 3 |  |  |  |  | 12 |  | 
|  | 3 |  |  |  |  | 49 |  | 
| 8 | 3 |  |  | 3 |  | 2467 | use WebService::Recruit::Jalan::HotelSearchAdvance; | 
|  | 3 |  |  |  |  | 12 |  | 
|  | 3 |  |  |  |  | 43 |  | 
| 9 | 3 |  |  | 3 |  | 2377 | use WebService::Recruit::Jalan::AreaSearch; | 
|  | 3 |  |  |  |  | 9 |  | 
|  | 3 |  |  |  |  | 32 |  | 
| 10 | 3 |  |  | 3 |  | 2786 | use WebService::Recruit::Jalan::OnsenSearch; | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 39 |  | 
| 11 | 3 |  |  | 3 |  | 2224 | use WebService::Recruit::Jalan::StockSearch; | 
|  | 3 |  |  |  |  | 14 |  | 
|  | 3 |  |  |  |  | 46 |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | my $PARAMS = [qw( key )]; | 
| 14 |  |  |  |  |  |  | my $TPPCFG = [qw( user_agent lwp_useragent http_lite utf8_flag )]; | 
| 15 |  |  |  |  |  |  | __PACKAGE__->mk_accessors( @$PARAMS, @$TPPCFG ); | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | sub new { | 
| 18 | 2 |  |  | 2 | 1 | 4659 | my $package = shift; | 
| 19 | 2 |  |  |  |  | 8 | my $self    = {@_}; | 
| 20 | 2 |  | 33 |  |  | 28 | $self->{user_agent} ||= __PACKAGE__."/$VERSION "; | 
| 21 | 2 |  |  |  |  | 7 | bless $self, $package; | 
| 22 | 2 |  |  |  |  | 9 | $self; | 
| 23 |  |  |  |  |  |  | } | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  | sub init_treepp_config { | 
| 26 | 0 |  |  | 0 | 0 |  | my $self = shift; | 
| 27 | 0 |  |  |  |  |  | my $api  = shift; | 
| 28 | 0 |  |  |  |  |  | my $treepp = $api->treepp(); | 
| 29 | 0 |  |  |  |  |  | foreach my $key ( @$TPPCFG ) { | 
| 30 | 0 | 0 |  |  |  |  | $treepp->set( $key => $self->{$key} ) if exists $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 |  |  |  |  | $api->add_param( $key => $self->{$key} ) if exists $self->{$key}; | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  | } | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | sub HotelSearchLite { | 
| 43 | 0 | 0 |  | 0 | 1 |  | my $self = shift or return; | 
| 44 | 0 | 0 |  |  |  |  | $self = $self->new() unless ref $self; | 
| 45 | 0 |  |  |  |  |  | my $api = WebService::Recruit::Jalan::HotelSearchLite->new(); | 
| 46 | 0 |  |  |  |  |  | $self->init_treepp_config( $api ); | 
| 47 | 0 |  |  |  |  |  | $self->init_query_param( $api ); | 
| 48 | 0 |  |  |  |  |  | $api->add_param( @_ ); | 
| 49 | 0 |  |  |  |  |  | $api->request(); | 
| 50 | 0 |  |  |  |  |  | $api; | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | sub HotelSearchAdvance { | 
| 54 | 0 | 0 |  | 0 | 1 |  | my $self = shift or return; | 
| 55 | 0 | 0 |  |  |  |  | $self = $self->new() unless ref $self; | 
| 56 | 0 |  |  |  |  |  | my $api = WebService::Recruit::Jalan::HotelSearchAdvance->new(); | 
| 57 | 0 |  |  |  |  |  | $self->init_treepp_config( $api ); | 
| 58 | 0 |  |  |  |  |  | $self->init_query_param( $api ); | 
| 59 | 0 |  |  |  |  |  | $api->add_param( @_ ); | 
| 60 | 0 |  |  |  |  |  | $api->request(); | 
| 61 | 0 |  |  |  |  |  | $api; | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | sub AreaSearch { | 
| 65 | 0 | 0 |  | 0 | 1 |  | my $self = shift or return; | 
| 66 | 0 | 0 |  |  |  |  | $self = $self->new() unless ref $self; | 
| 67 | 0 |  |  |  |  |  | my $api = WebService::Recruit::Jalan::AreaSearch->new(); | 
| 68 | 0 |  |  |  |  |  | $self->init_treepp_config( $api ); | 
| 69 | 0 |  |  |  |  |  | $self->init_query_param( $api ); | 
| 70 | 0 |  |  |  |  |  | $api->add_param( @_ ); | 
| 71 | 0 |  |  |  |  |  | $api->request(); | 
| 72 | 0 |  |  |  |  |  | $api; | 
| 73 |  |  |  |  |  |  | } | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | sub OnsenSearch { | 
| 76 | 0 | 0 |  | 0 | 1 |  | my $self = shift or return; | 
| 77 | 0 | 0 |  |  |  |  | $self = $self->new() unless ref $self; | 
| 78 | 0 |  |  |  |  |  | my $api = WebService::Recruit::Jalan::OnsenSearch->new(); | 
| 79 | 0 |  |  |  |  |  | $self->init_treepp_config( $api ); | 
| 80 | 0 |  |  |  |  |  | $self->init_query_param( $api ); | 
| 81 | 0 |  |  |  |  |  | $api->add_param( @_ ); | 
| 82 | 0 |  |  |  |  |  | $api->request(); | 
| 83 | 0 |  |  |  |  |  | $api; | 
| 84 |  |  |  |  |  |  | } | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | sub StockSearch { | 
| 87 | 0 | 0 |  | 0 | 1 |  | my $self = shift or return; | 
| 88 | 0 | 0 |  |  |  |  | $self = $self->new() unless ref $self; | 
| 89 | 0 |  |  |  |  |  | my $api = WebService::Recruit::Jalan::StockSearch->new(); | 
| 90 | 0 |  |  |  |  |  | $self->init_treepp_config( $api ); | 
| 91 | 0 |  |  |  |  |  | $self->init_query_param( $api ); | 
| 92 | 0 |  |  |  |  |  | $api->add_param( @_ ); | 
| 93 | 0 |  |  |  |  |  | $api->request(); | 
| 94 | 0 |  |  |  |  |  | $api; | 
| 95 |  |  |  |  |  |  | } | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | =head1 NAME | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | WebService::Recruit::Jalan - A Interface for Jalan Web Service | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | use WebService::Recruit::Jalan; | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | my $jalan = WebService::Recruit::Jalan->new(); | 
| 106 |  |  |  |  |  |  | $jalan->key( 'xxxxxxxxxxxxxx' ); | 
| 107 |  |  |  |  |  |  |  | 
| 108 |  |  |  |  |  |  | my $res = $jalan->HotelSearchAdvance( s_area => '260502' ); | 
| 109 |  |  |  |  |  |  | my $list = $res->root->Hotel; | 
| 110 |  |  |  |  |  |  | foreach my $hotel ( @$list ) { | 
| 111 |  |  |  |  |  |  | print "HotelID: ",   $hotel->HotelID, "\n"; | 
| 112 |  |  |  |  |  |  | print "HotelName: ", $hotel->HotelName, "\n"; | 
| 113 |  |  |  |  |  |  | } | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | This module is a interface for the Jalan Web Service, | 
| 118 |  |  |  |  |  |  | produced by Recruit Co., Ltd., Japan. | 
| 119 |  |  |  |  |  |  | It provides five API methods: L, L, | 
| 120 |  |  |  |  |  |  | L, L and L. | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =head1 METHODS | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | =head2 new | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | This is the constructor method for this class. | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | my $jalan = WebService::Recruit::Jalan->new(); | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | This accepts optional parameters. | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | my $conf = { key => 'your_auth_key', utf8_flag => 1 }; | 
| 133 |  |  |  |  |  |  | my $jalan = WebService::Recruit::Jalan->new( %$conf ); | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | =head2 key | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | A valid developer key is required to make a request. | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | $jalan->key( 'your_auth_key' ); | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =head2 HotelSearchLite | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | This makes a request for C API. | 
| 144 |  |  |  |  |  |  | See L for details. | 
| 145 |  |  |  |  |  |  |  | 
| 146 |  |  |  |  |  |  | my $res = $jalan->HotelSearchLite( s_area => '162612' ); | 
| 147 |  |  |  |  |  |  |  | 
| 148 |  |  |  |  |  |  | =head2 HotelSearchAdvance | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | This makes a request for C API. | 
| 151 |  |  |  |  |  |  | See L for details. | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | my $res = $jalan->HotelSearchAdvance( s_area => '260502' ); | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | =head2 AreaSearch | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | This makes a request for C API. | 
| 158 |  |  |  |  |  |  | See L for details. | 
| 159 |  |  |  |  |  |  |  | 
| 160 |  |  |  |  |  |  | my $res = $jalan->AreaSearch( reg => 15 ); | 
| 161 |  |  |  |  |  |  |  | 
| 162 |  |  |  |  |  |  | =head2 OnsenSearch | 
| 163 |  |  |  |  |  |  |  | 
| 164 |  |  |  |  |  |  | This makes a request for C API. | 
| 165 |  |  |  |  |  |  | See L for details. | 
| 166 |  |  |  |  |  |  |  | 
| 167 |  |  |  |  |  |  | my $res = $jalan->OnsenSearch( s_area => '141602' ); | 
| 168 |  |  |  |  |  |  |  | 
| 169 |  |  |  |  |  |  | =head2 StockSearch | 
| 170 |  |  |  |  |  |  |  | 
| 171 |  |  |  |  |  |  | This makes a request for C API. | 
| 172 |  |  |  |  |  |  | See L for details. | 
| 173 |  |  |  |  |  |  |  | 
| 174 |  |  |  |  |  |  | my $res = $jalan->StockSearch( lon_jgd => 139.758, lat_jgd => 35.666 ); | 
| 175 |  |  |  |  |  |  |  | 
| 176 |  |  |  |  |  |  | =head2 utf8_flag / user_agent / lwp_useragent / http_lite | 
| 177 |  |  |  |  |  |  |  | 
| 178 |  |  |  |  |  |  | This modules uses L module internally. | 
| 179 |  |  |  |  |  |  | Following methods are available to configure it. | 
| 180 |  |  |  |  |  |  |  | 
| 181 |  |  |  |  |  |  | $jalan->utf8_flag( 1 ); | 
| 182 |  |  |  |  |  |  | $jalan->user_agent( 'Foo-Bar/1.0 ' ); | 
| 183 |  |  |  |  |  |  | $jalan->lwp_useragent( LWP::UserAgent->new() ); | 
| 184 |  |  |  |  |  |  | $jalan->http_lite( HTTP::Lite->new() ); | 
| 185 |  |  |  |  |  |  |  | 
| 186 |  |  |  |  |  |  | =head1 SEE ALSO | 
| 187 |  |  |  |  |  |  |  | 
| 188 |  |  |  |  |  |  | http://jws.jalan.net/ | 
| 189 |  |  |  |  |  |  |  | 
| 190 |  |  |  |  |  |  | =head1 AUTHOR | 
| 191 |  |  |  |  |  |  |  | 
| 192 |  |  |  |  |  |  | Yusuke Kawasaki L | 
| 193 |  |  |  |  |  |  |  | 
| 194 |  |  |  |  |  |  | This module is unofficial and released by the author in person. | 
| 195 |  |  |  |  |  |  |  | 
| 196 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 197 |  |  |  |  |  |  |  | 
| 198 |  |  |  |  |  |  | Copyright (c) 2007 Yusuke Kawasaki. All rights reserved. | 
| 199 |  |  |  |  |  |  | This program is free software; you can redistribute it and/or | 
| 200 |  |  |  |  |  |  | modify it under the same terms as Perl itself. | 
| 201 |  |  |  |  |  |  |  | 
| 202 |  |  |  |  |  |  | =cut | 
| 203 |  |  |  |  |  |  | 1; |