IP::Country::DB_File - IP to country translation based on DB_File


IP-Country-DB_File documentation  | view source Contained in the IP-Country-DB_File distribution.

Index


NAME

Top

IP::Country::DB_File - IP to country translation based on DB_File

VERSION

Top

version 2.01

SYNOPSIS

Top

 use IP::Country::DB_File;

 my $ipcc = IP::Country::DB_File->new();
 $ipcc->inet_atocc('1.2.3.4');
 $ipcc->inet_atocc('host.example.com');

DESCRIPTION

Top

IP::Country::DB_File is a light-weight module for fast IP address to country translation based on DB_File. The country code database is stored in a Berkeley DB file. You have to build the database using IP::Country::DB_File::Builder before you can lookup country codes.

This module tries to be API compatible with the other IP::Country modules. The installation of IP::Country is not required.

CONSTRUCTOR

Top

new

 my $ipcc = IP::Country::DB_File->new([ $db_file ]);

Creates a new object and opens the database file $db_file. $db_file defaults to ipcc.db.

OBJECT METHODS

Top

inet_atocc

 $ipcc->inet_atocc($string);

Looks up the country code of host $string. $string can either be an IP address in dotted quad notation or a hostname.

If successful, returns the country code. In most cases it is an ISO-3166-1 alpha-2 country code, but there are also codes like 'EU' for Europe. See the documentation of IP::Country for more details.

Returns '**' for private IP addresses.

Returns undef if there's no country code listed for the IP address.

inet_ntocc

 $ipcc->inet_ntocc($string);

Like inet_atocc but works with a packed IP address.

db_time

 $ipcc->db_time();

Returns the mtime of the DB file.

SEE ALSO

Top

IP::Country, IP::Country::DB_File::Builder

AUTHOR

Top

Nick Wellnhofer <wellnhofer@aevum.de>

COPYRIGHT AND LICENSE

Top


IP-Country-DB_File documentation  | view source Contained in the IP-Country-DB_File distribution.