Manual Reference Pages - IP::Country::MaxMind (3)
IP::Country::MaxMind - Look up country by IP Address
my $gi = IP::Country::MaxMind->new(GEOIP_STANDARD);
# look up IP address 126.96.36.199
# returns undef if country is unallocated, or not defined in our database
my $cc1 = $gi->inet_atocc(188.8.131.52);
my $cc2 = $gi->inet_atocc(yahoo.com);
This module adapts the Geo::IP module to use the same interface as the IP::Country
modules; thus allowing users to easily switch between using the two underlying
Free monthly updates to the database are available from
If you require greater accuracy, MaxMind offers a Premium database on a paid
The author of this module is in no way associated with MaxMind.
$gi = IP::Country::MaxMind->new( $flags );
Constructs a new IP::Country::MaxMind object with the default database located
inside your systems datadir, typically /usr/local/share/GeoIP/GeoIP.dat.
Flags can be set to either GEOIP_STANDARD, or for faster performance
(at a cost of using more memory), GEOIP_MEMORY_CACHE. When using memory
cache you can force a reload if the file is updated by setting GEOIP_CHECK_CACHE.
$gi = IP::Country::MaxMind->open( $database_filename, $flags );
Constructs a new Geo::IP object with the database located at $database_filename.
All object methods are designed to be used in an object-oriented fashion.
$result = $object->foo_method($bar,$baz);
Using the module in a procedural fashion (without the arrow syntax) wont work.
$cc = $gi->inet_atocc(HOSTNAME)
Takes a string giving the name of a host, and translates that to an
two-letter country code. Takes arguments of both the rtfm.mit.edu
type and 184.108.40.206. If the host name cannot be resolved, returns undef.
If the resolved IP address is not contained within the database, returns undef.
$cc = $gi->inet_ntocc(IP_ADDRESS)
Takes a string (an opaque string as returned by Socket::inet_aton())
and translates it into a two-letter country code. If the IP address is
not contained within the database, returns undef.
$cc = $gi->db_time()
Returns zero. For compatibility only.
Copyright (C) 2002,2003 Nigel Wetters Gourlay. All Rights Reserved.
NO WARRANTY. This module is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
|perl v5.12.2 ||IP::Country::MaxMind (3) ||2006-04-06 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.