Skip Menu |

This queue is for tickets about the Mojolicious-Plugin-Geo CPAN distribution.

Report information
The Basics
Id: 77983
Status: new
Priority: 0/
Queue: Mojolicious-Plugin-Geo

People
Owner: Nobody in particular
Requestors: nygel [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.02
Fixed in: (no value)



Subject: parsing server return where a key with an empty value exists
Hi. If the server returns a blank value the map creates an invalid hash. For example the ip 1.2.3.4. Have attached a patch which should solve the issue, it's reusing Mojo:URL to manage the parsing. Regards, Nygel
Subject: Geo.pm.patch
--- Geo.pm 2011-08-18 01:39:48.000000000 +0100 +++ Geo2.pm 2012-06-23 21:57:44.538417611 +0100 @@ -1,6 +1,7 @@ package Mojolicious::Plugin::Geo; use Mojo::Base 'Mojolicious::Plugin'; use Mojo::UserAgent; +use Mojo::URL; our $VERSION = '0.02'; @@ -13,9 +14,9 @@ my $ua = Mojo::UserAgent->new; my $ip_info = $ua->get('http://geo.serving-sys.com/GeoTargeting/ebGetLocation.aspx?ip=' . $ip)->res->body; - my %data = map { (split /=/, $_) } split(/&/, $ip_info); + my $data = Mojo::URL->new("http://dummy.com?${ip_info}")->query->to_hash; - return \%data; + return $data; }); }