GithubHelp home page GithubHelp logo

geoip-api-perl's Issues

Deprecate argument to lib_version()

I'm looking at:

const char *
lib_version(CLASS)
char * CLASS

in IP.xs and it's unclear why this function takes an argument since it's unused. Indeed, it's highly likely that you'd want to check the version before instantiating an object, such as:

use version;

my $wanted = version->parse('v1.4.4');
my $have = version->parse(Geo::IP::lib_version());

my $gi;
if ($have >= $wanted) {
    $gi = Geo::IP::open_type(... opened the preferred way ...);
} else {
    $gi = Geo::IP::open_type(... opened the legacy way ...);

so it's not clear that the argument to lib_version() serves any purpose, and I think it can safely be deprecated.

Requiring the class for $gi->lib_version() seems to be putting the cart before the horse, as you'd have already instantiated $gi by then.

Installation instructions

It is probably just me not understanding them:

I tried to install Geo::IP using cpanm, but it complained that the library is too old so I visited http://dev.maxmind.com/geoip/downloadable/ that redirected me to:
http://dev.maxmind.com/geoip/legacy/downloadable/

It was unclear to me what to install from there so I went with the C library.
https://github.com/maxmind/geoip-api-c/releases

and got the following:

:~/GeoIP-1.6.0# make check
...
============================================================================
Testsuite summary for GeoIP 1.6.0
============================================================================
# TOTAL: 1
# PASS:  0
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See test/test-suite.log
Please report to [email protected]
============================================================================

Nevertheless I installed it using "make install" and then tried cpanm Geo::IP again:
This time it compiled but then the tests failed:

t/0_base.t ............... ok
Error Opening file /usr/local/share/GeoIP/GeoIP.dat
Can't call method "country_code_by_addr" on an undefined value at t/1_lookup.t line 17, <DATA> line 1.
t/1_lookup.t ............. 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 18/18 subtests 
t/20_min_capi_version.t .. ok
Error Opening file /usr/local/share/GeoIP/GeoIP.dat
Can't call method "country_code_by_name" on an undefined value at t/2_namelookup.t line 17, <DATA> line 1.
t/2_namelookup.t ......... 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 11/11 subtests 
Error Opening file /usr/local/share/GeoIP/GeoIP.dat
Can't call method "country_code_by_addr" on an undefined value at /root/.cpanm/work/1390736230.30217/Geo-IP-1.43/blib/lib/Geo/Mirror.pm line 96.
t/3_mirror.t ............. 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 1/2 subtests 

Test Summary Report
-------------------
t/1_lookup.t           (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 18 tests but ran 0.
t/2_namelookup.t       (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 11 tests but ran 0.
t/3_mirror.t           (Wstat: 512 Tests: 1 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 2 tests but ran 1.
Files=5, Tests=3,  0 wallclock secs ( 0.03 usr  0.00 sys +  0.05 cusr  0.01 csys =  0.09 CPU)
Result: FAIL
Failed 3/5 test programs. 0/3 subtests failed.
make: *** [test_dynamic] Error 2
-> FAIL Installing Geo::IP failed. See /root/.cpanm/work/1390736230.30217/build.log for details. Retry with --force to force install it.

All this on 5.18.1 self-compiled on Debian 6.

Doesn't easily open GeoLite2 city database

I downloaded the GeoLite2 City database from:

http://dev.maxmind.com/geoip/geoip2/geolite2/

Then I tried to open it using:

!/usr/bin/perl

use Geo::IP;
$geoip = Geo::IP-&gt;open("/home/moise/Downloads/GeoLite2-City.mmdb") or die $!;
$result = $geoip->record_by_addr('8.8.8.8');

... and I got:

Invalid database type GeoIP Country Edition, expected GeoIP City Edition, Rev 1

This is with Geo::IP 1.43 from Debian testing. That doesn't seem like the right behavior -- it seems like I followed the example, and it seems from the example like reading the city database should be supported.

Geo::IP v1.42 produce error when trying use Geo::IP

Geo::IP v1.42 produce following error when trying use Geo::IP:

Can't load '/usr/local/perl-5.16.3/site/lib/auto/Geo/IP/IP.so' for module Geo::IP: /usr/local/perl-5.16.3/site/lib/auto/Geo/IP/IP.so: undefined symbol: GeoIP_country_continent at /usr/local/perl-5.16.3/lib/DynaLoader.pm line 191.


Geo::IP v1.42 used. Compiled with:

export LD_LIBRARY_PATH=/usr/local/lib;
cpan -fi Geo::IP


Latest geoip-api-c v1.5.1 used. Compiled with:

./configure
make
make install


Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

Platform:
osname=linux, osvers=2.6.11-1.1369_fc4, archname=x86_64-linux-thread-multi
uname='linux perl-linux64-vm 2.6.11-1.1369_fc4 #1 thu jun 2 22:56:33 edt 2005 x86_64 x86_64 x86_64 gnulinux '
config_args='-ders -Dcc=gcc -Dusethreads -Duseithreads -Uinstallusrbinperl -Ulocincpth= -Uloclibpth= -Duse64bitall -Dlibpth=/lib64 /usr/lib64 /usr/local/lib64 -Accflags=-DUSE_SITECUSTOMIZE -Duselargefiles -Accflags=-DPERL_RELOCATABLE_INCPUSH -Accflags=-fno-merge-constants -Dprefix=/usr/local/perl-5.16.3 -Dprivlib=/usr/local/perl-5.16.3/lib -Darchlib=/usr/local/perl-5.16.3/lib -Dsiteprefix=/usr/local/perl-5.16.3/site -Dsitelib=/usr/local/perl-5.16.3/site/lib -Dsitearch=/usr/local/perl-5.16.3/site/lib -Dsed=/bin/sed -Duseshrplib -Dcf_by=ActiveState -Dcf_email=[email protected]'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DUSE_SITECUSTOMIZE -DPERL_RELOCATABLE_INCPUSH -fno-merge-constants -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DUSE_SITECUSTOMIZE -DPERL_RELOCATABLE_INCPUSH -fno-merge-constants -fno-strict-aliasing -pipe'
ccversion='', gccversion='4.0.0 20050519 (Red Hat 4.0.0-8)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =''
libpth=/lib64 /usr/lib64 /usr/local/lib64
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.3.5.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.3.5'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/local/perl-5.16.3/lib/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2'

Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV
PERL_RELOCATABLE_INCPUSH USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API USE_SITECUSTOMIZE
Locally applied patches:
ActivePerl Build 1603 [296746]
Built under linux
Compiled at Mar 13 2013 11:02:49
%ENV:
PERL5LIB="/var/www/p-core/lib:/var/www/p-core/lib:/var/www/p-core/lib:"
@inc:
/var/www/p-core/lib
/var/www/p-core/lib
/var/www/p-core/lib
/usr/local/perl-5.16.3/site/lib
/usr/local/perl-5.16.3/lib

how to use GeoIPASNum & GeoIPASNumv6

Is it possible to use these with the Geo::IP module?

I have tried loading it this way:

Geo::IP->open("$db_dir/GeoIPASNum.dat", GEOIP_ASNUM_EDITION);

which results in this error:

Invalid database type GeoIP ASNum Edition, expected GeoIP City Edition, Rev 1

sysinfo

libgeoip @1.6.2_0 (active)
p5-geo-ip @1.430.0_0 (active)

install instructions

Hi I noticed there's no install instructions for Windows users.
Does geoip-api-perl support windows?

Use of uninitialized value $hasStructureInfo in numeric eq (==) at (eval 34)...

Patch....

--- IP.pm.orig  2015-03-13 20:26:26.389514227 -0400
+++ IP.pm       2015-03-13 20:26:46.532377417 -0400
@@ -5540,7 +5540,7 @@
     my $i  = 0;
     my $buf;
     my $retval;
-    my $hasStructureInfo;
+    my $hasStructureInfo = 0;
     seek( $gi->{fh}, -3, 2 );
     for ( my $i = 0 ; $i < STRUCTURE_INFO_MAX_SIZE ; $i++ ) {
         read( $gi->{fh}, $buf, 3 );

Module does not build for ActiveState Perl

Hi!

This module has a pure perl part, but it does not build for ActiveState Perl. Please find the Report here: http://ppm4.activestate.com/MSWin32-x86/5.16/1600/B/BO/BORISZ/Geo-IP-1.43.d/log-20131210T164827.txt
There is an overview here: http://code.activestate.com/ppm/Geo-IP/

If I get the error log correctly, it's currently not possible to build this module automatically, because it will only install "anyway" if you start with perl Makefile:PL PP=1.
Is there eventually a way to define this as fallback behavior if the CAPI is not found?

Best regards,
Alex

name_by_addr_v6

I am using Geo::IP 1.50 from CPAN. When I try to use name_by_addr_v6 I get
Can't locate object method "name_by_addr_v6" via package "Geo::IP" at ...
I looked at the source and I don't see any attempt to define the method. Am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.