| 1 | package WebService::Heartrails::Express::Provider::Near; | ||
| 2 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 0 | ▶ | use WebService::Heartrails::Express::Provider::Common; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 6 | use Carp; | ||
| 7 | |||
| 8 | sub call{ | ||
| 9 | my($self,$class,$arg) = @_; | ||
| 10 | my $x = $arg->{x}; | ||
| 11 | my $y = $arg->{y}; | ||
| 12 | |||
| 13 | unless(defined $x or defined $y){ | ||
| 14 | croak("x or y is either required"); | ||
| 15 | } | ||
| 16 | |||
| 17 | my $sub_url =do{ | ||
| 18 | if(not defined $x){ | ||
| 19 | {method => 'getStations',y => $y}; | ||
| 20 | }elsif(not defined $y){ | ||
| 21 | {method => 'getStations',x => $x}; | ||
| 22 | }else{ | ||
| 23 | {method => 'getStations',x => $x,y => $y}; | ||
| 24 | } | ||
| 25 | }; | ||
| 26 | |||
| 27 | my $content = WebService::Heartrails::Express::Provider::Common::call($class,$sub_url); | ||
| 28 | return JSON::decode_json($content)->{response}->{station}; | ||
| 29 | } | ||
| 30 | |||
| 31 | 1; | ||