Re: [Geoip-perl] How can I use the function $org = $gi->org_by_addr( $ipaddr );
Brought to you by:
tjmather
|
From: Boris Z. <bze...@ma...> - 2008-11-11 14:01:09
|
Hi,
Seems you did not install the C API and the pure perl fallback is used.
I suggest to install the CAPI and reinstall Geo::IP afterwards. That
fix your problem.
use Geo::IP;
my $ipaddr = '24.24.24.24';
my $gi = Geo::IP->open('/usr/local/share/GeoIP/GeoIPOrg.dat') or
die $!;
my $org = $gi->org_by_addr($ipaddr);
print $org;
If you feel comfortable with the PurePerl code, replace org_by_addr
with org_by_name.
org_by_name notice that you call it with a ip and does the same as
org_by_addr for that case.
use Geo::IP;
my $ipaddr = '24.24.24.24';
my $gi = Geo::IP->open('/usr/local/share/GeoIP/GeoIPOrg.dat') or
die $!;
my $org = $gi->org_by_name($ipaddr);
print $org;
Sure I will add the missing method in the next release of Geo::IP.
Thanks for the hint!
Have a nice day.
Am 11.11.2008 um 13:25 schrieb Rubén Cuevas Rumín:
> Hi all,
>
> When try to use the function:
>
> $org = $gi->org_by_addr( $ipaddr );
>
> I obtain as answer:
>
> Can't locate object method "org_by_addr" via package "Geo::IP" at ./
> prueba.pl line 12.
>
> Basically, I have a file with IP addresess and I want to which ISP
> they belong to.
>
> It would be great if any of you could help me.
>
> Thanks in advance,
> Rubén.
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
> Geoip-perl mailing list
> Geo...@li...
> https://lists.sourceforge.net/lists/listinfo/geoip-perl
--
Boris
|