line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::MobileAgent::Plugin::Locator::SoftBank::BasicLocation; |
2
|
|
|
|
|
|
|
# Simple Location Information |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw( HTTP::MobileAgent::Plugin::Locator ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
103
|
|
6
|
1
|
|
|
1
|
|
6
|
use Geo::Coordinates::Converter; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub get_location { |
9
|
6
|
|
|
6
|
1
|
8
|
my $self = shift; |
10
|
6
|
|
|
|
|
15
|
my $geocode = $ENV{ HTTP_X_JPHONE_GEOCODE }; |
11
|
6
|
|
|
|
|
29
|
$geocode =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
|
12
|
|
|
|
|
58
|
|
12
|
6
|
|
|
|
|
22
|
my ( $lat, $lng, $address ) = split /\x1a/, $geocode; |
13
|
6
|
|
50
|
|
|
13
|
return Geo::Coordinates::Converter->new( |
|
|
|
50
|
|
|
|
|
14
|
|
|
|
|
|
|
lat => _convert_point( $lat ) || undef, |
15
|
|
|
|
|
|
|
lng => _convert_point( $lng ) || undef, |
16
|
|
|
|
|
|
|
datum => 'tokyo', |
17
|
|
|
|
|
|
|
)->convert( 'wgs84' ); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _convert_point { |
21
|
12
|
|
|
12
|
|
16
|
my $point = shift; |
22
|
12
|
|
|
|
|
174
|
($point = reverse split //, $point) =~ s/(..)/.$1/g; |
23
|
12
|
|
|
|
|
108
|
return join '', reverse split //, '00' . $point; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |