IP::Location - Perl extension for getting the location of an IP.
no warnings; use IP::Location; my $QQWRY = IP::Location->new("qqwry.dat"); my $location = $QQWRY->locate("1.2.3.4"); print "The location of 1.2.3.4 is $location\n";
IP::Location is a perl extension for getting the location of an IP through datafile or the Internet. When it works in the local mode, it queries the local QQWry datafile, when it works in the network mode, it works as an interface to the online IP location database.
This is the constructor for a new IP::Location object. DATAFILE is the name of the QQWry datafile to which the queries use.
DATAFILE
DATAFILE is optional. This file is used when initializing a new IP::Location object.
CHAR_SET is optional. If CHAR_SET is not given, then the object will use GBK as the default character set. You can use the char_set method to change its value.
CHAR_SET
char_set
Initialize the new created IP::Location object with the given datafile.
Returns the location of the given IP address.
If the method is called without parameter, it returns the current character set the module uses. If the method is called with a CHARACTER_SET parameter, it will set the character set to the given value. The current supported character set is GBK and UTF-8. GBK is used as the default value.
Return the version of the datafile and the module.
More verbose information about the datafile.
The format of the QQWry datafile can be referred at http://lumaqq.linuxsir.org/article/qqwry_format_detail.html.
The latest version of QQWry datafile can be found at http://www.cz88.net/fox/
michael.wang, <ylzcylx@gmail.com>
Copyright (C) 2011 by Michael Wang (loveky)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.1 or, at your option, any later version of Perl 5 you may have available.
To install IP::Location, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IP::Location
CPAN shell
perl -MCPAN -e shell install IP::Location
For more information on module installation, please visit the detailed CPAN module installation guide.