19 Jan 2011 23:22:46 UTC
- Distribution: IP-Country-DB_File
- Module version: 2.01
- Source (raw)
- Browse (raw)
- How to Contribute
- Clone repository
- Issues (0)
- Testers (304 / 14 / 0)
- KwaliteeBus factor: 1
- License: perl_5
- Activity24 month
- Download (13.86KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionNWELLNHOF Nick Wellnhofer
- OBJECT METHODS
- SEE ALSO
- COPYRIGHT AND LICENSE
IP::Country::DB_File - IP to country translation based on DB_File
use IP::Country::DB_File; my $ipcc = IP::Country::DB_File->new(); $ipcc->inet_atocc('184.108.40.206'); $ipcc->inet_atocc('host.example.com');
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.
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.
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.
Like inet_atocc but works with a packed IP address.
Returns the mtime of the DB file.
Nick Wellnhofer <email@example.com>
This software is copyright (c) 2011 by Nick Wellnhofer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install IP::Country::DB_File, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install IP::Country::DB_File
For more information on module installation, please visit the detailed CPAN module installation guide.