blib/lib/Catalyst/Plugin/Geocoding.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 6 | 12 | 50.0 |
branch | n/a | ||
condition | n/a | ||
subroutine | 2 | 3 | 66.6 |
pod | 0 | 1 | 0.0 |
total | 8 | 16 | 50.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Catalyst::Plugin::Geocoding; | ||||||
2 | |||||||
3 | 1 | 1 | 22846 | use strict; | |||
1 | 3 | ||||||
1 | 34 | ||||||
4 | 1 | 1 | 883 | use LWP::Simple; | |||
1 | 154366 | ||||||
1 | 10 | ||||||
5 | |||||||
6 | our $VERSION = '0.01'; | ||||||
7 | |||||||
8 | sub geocoding { | ||||||
9 | 0 | 0 | 0 | my $c = shift; | |||
10 | 0 | my $location = shift; | |||||
11 | |||||||
12 | 0 | my $url = "http://maps.google.com/maps/geo?q=$location&output=csv&key=" | |||||
13 | . $c->config->{gmap_key}; | ||||||
14 | 0 | my $result = get($url); | |||||
15 | 0 | $result =~ m[(\d+),(\d+),(.+?),(.+)\z]o; | |||||
16 | 0 | return ($result, $1, $2, $3, $4); | |||||
17 | } | ||||||
18 | |||||||
19 | 1; | ||||||
20 | |||||||
21 | __END__ |