Closed denimboy closed 7 years ago
Thanks for the very thorough bug report! I agree that this is pretty clearly a bug. I'll add it to our internal project planning tool so we can schedule time for us to fix it.
Cheers,
Dave Rolsky MaxMind Software Engineering Team Lead
Hmm, I'm not able to replicate this bug using the code you provided. I tried with both Perl 5.14.2 and 5.20.2.
Can you give me the output from perl -V
and also let me know what versions of MaxMind::DB::Reader
and MaxMind::DB::Reader::XS
you're using?
Thanks,
Dave Rolsky MaxMind Software Engineering Team Lead
Hi David,
The perl version I am using is 5.14.2. I cannot include the full output of perl -V in this forum
geoip C library is version 1.6.9 GeoIP2 Perl library is version 2.003001 MaxMind::DB::Reader is version 1.000012 MaxMind::DB::Reader::XS is version 1.000003
Thanks,
@denimboy, we are not able to reproduce this. Would you be willing to share perl -V
by emailing support@maxmind.com with it? Are you able to reproduce this on other Perl versions?
Greg MaxMind
Some things that might be relevant:
Hi,
It looks like the issue is specific to our particular build of perl. I can reliably reproduce the bug in our development environment, but when I try running the test on my workstation it does not error. I installed perl 5.14.2 with perlbrew and still no error.
I am going to assume this issue is with our build only. We have a work around in place so no further action is required.
GeoIP2 perl libraries do not handle certain locales properly. The locales in question use a comma as a decimal separator such that 3.14159 becomes 3,14159.
Example program below. Uncomment either of the setlocale lines marked as "not ok" and the program will die trying to output latitude. Error message is "37,386 is not a valid Num"
`
!/usr/bin/perl
use strict; use warnings; use Data::Dumper; use POSIX; use GeoIP2::Database::Reader;
POSIX::setlocale(POSIX::LC_ALL, "en_US"); # ok
POSIX::setlocale(POSIX::LC_ALL, "de_DE"); # not ok
POSIX::setlocale(POSIX::LC_ALL, "fr_FR"); # not ok
my $reader = GeoIP2::Database::Reader->new( file => "./GeoIP2-City.mmdb", );
my $city = $reader->city(ip => '8.8.8.8');
print Dumper($city);
print "latitude: ", $city->location->latitude, "\n"; print "longitude: ", $city->location->longitude, "\n"; `