The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

IP::QQWry - a simple interface for QQWry IP database(file).

VERSION

This document describes IP::QQWry version 0.0.16

SYNOPSIS

    use IP::QQWry;
    my $qqwry = IP::QQWry->new('QQWry.Dat');
    my $info = $qqwry->query('166.111.166.111');
    my ( $base, $ext ) = $qqwry->query(2792334959);
    my $version = $qqwry->db_version;
    $qqwry->clear;

DESCRIPTION

'QQWry.Dat' http://www.cz88.net/fox/ is an IP file database. It provides some useful infomation such as the geographical position of the host bound with some IP address, the IP's owner, etc. IP::QQWry provides a simple interface for this file 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 or big5 encoding, IP::QQWry doesn't do any decoding stuff, use IP::QQWry::Decoded if you want the returned info decoded.

INTERFACE

new

Accept one optional parameter for database file name. Return an object of IP::QQWry.

set_db

Set database file. Accept a IP database file path as a parameter. Return 1 for success, undef for failure.

query

Accept one parameter, which has to be an IPv4 address such as `166.111.166.111` or an integer like 2792334959.

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

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

If it can't find useful information, return undef.

Caveat: the domain name as an argument is not supported any more since v0.0.12. Because a domain name could have more than one IP address bound, the previous implementation is lame and not graceful, so I decided to dump it.

clear

clear cache

cached($ip)

return 1 if $ip is cached, 0 otherwise

db_version

return database version.

DEPENDENCIES

version

BUGS AND LIMITATIONS

No bugs have been reported.

AUTHOR

sunnavy <sunnavy@gmail.com>

LICENCE AND COPYRIGHT

Copyright (c) 2006-2011, sunnavy <sunnavy@gmail.com>.

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