19 Dec 2006 15:51:29 UTC
- Distribution: IP-Country-DNSBL
- Module version: 1.02
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (457 / 6 / 0)
- KwaliteeBus factor: 0
- 44.59% Coverage
- License: unknown
- Activity24 month
- Download (4.85KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionNWETTERS Nigel Wetters Gourlay
IP::Country::DNSBL - IP geolocation via DNS
use IP::Country::DNSBL; my $reg = IP::Country::DNSBL->new(); print $reg->inet_atocc('188.8.131.52') ."\n"; print $reg->inet_atocc('www.slashdot.org') ."\n";
Finding the home country of a client using only the IP address can be difficult. Looking up the domain name associated with that address can provide some help, but many IP address are not reverse mapped to any useful domain, and the most common domain (.com) offers no help when looking for country.
This module queries a DNSBL server to find the correct country code.
The constructor zero or one arguments.
use IP::Country::DNSBL; my $reg = IP::Country::DNSBL->new();
The optional argument is a DNSBL domain name (e.g. country.example.net) which will be appended to any country code lookup. Without this argument, the module defaults to querying country.netop.org.
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) won't work.
- $cc = $reg->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. For multi-homed hosts (hosts with more than one address), the first address found is returned.
- $cc = $reg->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.
Only works with IPv4 addresses and ASCII hostnames.
http://www.netop.org/geoip.html - NetOp: IP geolocation via DNS
IP::Country::Fast - uses local database for lookups.
Copyright (C) 2006, Nigel Wetters Gourlay.
NO WARRANTY. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install IP::Country::DNSBL, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install IP::Country::DNSBL
For more information on module installation, please visit the detailed CPAN module installation guide.