line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::MobileAttribute::Plugin::Locator::ThirdForce::BasicLocation; |
2
|
|
|
|
|
|
|
# Simple Location Information |
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw( HTTP::MobileAttribute::Plugin::Locator::Base ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
98
|
|
6
|
1
|
|
|
1
|
|
7
|
use Geo::Coordinates::Converter; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub get_location { |
9
|
6
|
|
|
6
|
0
|
12
|
my $self = shift; |
10
|
6
|
|
|
|
|
13
|
my $geocode = $ENV{ HTTP_X_JPHONE_GEOCODE }; |
11
|
6
|
|
|
|
|
34
|
$geocode =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
|
12
|
|
|
|
|
85
|
|
12
|
6
|
|
|
|
|
22
|
my ( $lat, $lng, $address ) = split /\x1a/, $geocode; |
13
|
6
|
|
50
|
|
|
14
|
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
|
|
18
|
my $point = shift; |
22
|
12
|
|
|
|
|
102
|
($point = reverse split //, $point) =~ s/(..)/.$1/g; |
23
|
12
|
|
|
|
|
99
|
return join '', reverse split //, '00' . $point; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |