File Coverage

blib/lib/HTTP/MobileAgent/Plugin/Locator/EZweb/GPS.pm
Criterion Covered Total %
statement 15 15 100.0
branch 2 4 50.0
condition 2 6 33.3
subroutine 4 4 100.0
pod 1 1 100.0
total 24 30 80.0


line stmt bran cond sub pod time code
1             package HTTP::MobileAgent::Plugin::Locator::EZweb::GPS;
2             # GPS
3              
4 1     1   5 use strict;
  1         2  
  1         43  
5 1     1   6 use base qw( HTTP::MobileAgent::Plugin::Locator );
  1         2  
  1         94  
6 1     1   6 use Geo::Coordinates::Converter;
  1         2  
  1         7  
7              
8             sub get_location {
9 4     4 1 7 my ( $self, $params ) = @_;
10 4         18 (my $lat = $params->{ lat }) =~ s/^[\-\+]//g;
11 4         14 (my $lng = $params->{ lon }) =~ s/^[\-\+]//g;
12 4 50 33     26 my $datum = defined $params->{ datum } && $params->{ datum } == 1 ? 'tokyo' : 'wgs84';
13 4 50 33     17 my $format = defined $params->{ unit } && $params->{ unit } == 1 ? 'degree' : 'dms';
14 4         15 return Geo::Coordinates::Converter->new(
15             lat => $lat,
16             lng => $lng,
17             datum => $datum,
18             format => $format,
19             )->convert( 'wgs84' );
20             }
21              
22             1;