Geo::IPfree - Look up country of IP Address. This module make this off-line and the DB of IPs is free.
use Geo::IPfree; my ($country,$country_name) = Geo::IPfree::LookUp("192.168.0.1") ; ... or ... use Geo::IPfree qw(LookUp) ; my ($country,$country_name) = LookUp("200.176.3.142") ; ... or ... use Geo::IPfree; my $GeoIP = Geo::IPfree->new('/GeoIPfree/ipscountry.dat') ; my ($country,$country_name,$ip) = $GeoIP->LookUp("www.cnn.com") ; ## Getting by Hostname. $GeoIP->LoadDB('/GeoIPfree/ips.dat') ; my ($country,$country_name,$ip) = $GeoIP->LookUp("www.sf.net") ; ## Getting by Hostname. ... or ... use Geo::IPfree; my $GeoIP = Geo::IPfree::new() ; ## Using the default DB! my ($country,$country_name) = $GeoIP->LookUp("64.236.24.28") ;
This package comes with it's own database to look up the IP's country, and is totally free. Take a look in CPAN for updates...
Load the database to use to LookUp the IPs.
Returns the ISO 3166 country (XX) code for an IP address or Hostname.
**If you send a Hostname you will need to be connected to the internet to resolve the host IP.
The database file in use.
The database file handler.
Graciliano M. P. <gm@virtuasites.com.br>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Geo::IPfree, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::IPfree
CPAN shell
perl -MCPAN -e shell install Geo::IPfree
For more information on module installation, please visit the detailed CPAN module installation guide.