NAME

IP::QQWry - look up IP from QQWry database(file).

VERSION

This document describes IP::QQWry version 0.0.6

SYNOPSIS

use IP::QQWry;
my $qqwry = IP::QQWry->new('QQWry.Dat');
my $info = $qqwry->query('166.111.166.111');
my $info = $qqwry->query('www.perl.org');

DESCRIPTION

'QQWry.Dat' http://www.cz88.net/fox/ is a file database for IP lookup. It provides some useful infomation such as the geographical position of the IP, who owns the ip, and so on. This Module provides a simple interface for this database.

for more about the format of the database, take a look at this: http://lumaqq.linuxsir.org/article/qqwry_format_detail.html

Caveat: The 'QQWry.Dat' database uses gbk encoding, this module doesn't provide any encoding conversion utility, so if you want some other encoding, you have to do it yourself. (Encode is a great module which can help you much.) In addition, the information retrieved from this database is mostly in Chinese, so maybe it isn't suited for world wide usage, ;-)

INTERFACE

new($dbfilename)

Return a new instance of IP::QQWry. You can offer a $dbfilename for parameter instead of call set_db($dbfilename) method later on.

set_db($dbfilename)

Set database file provided by $dbfilename.

query($ip)

Query the database for $ip. The $ip can be an actual IPv4 address such as 166.111.166.111 or a domain name.

In list context, it returns a list containing base and extension part of infomation, respectively. The base part is usually called country part though it doesn't refer to country all the time. The extension part is usually called area part.

In scalar context, it returns a string which is just a catenation of base and extension part of infomation.

DEPENDENCIES

Socket, Regexp::Common

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

No bugs have been reported.

AUTHOR

sunnavy <sunnavy@gmail.com>

LICENCE AND COPYRIGHT

Copyright (c) 2006, sunnavy <sunnavy@gmail.com>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.