10 Jan 2011 05:06:25 UTC
- Distribution: IP-Location
- Module version: 0.01
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (750 / 1 / 0)
- KwaliteeBus factor: 0
- 15.96% Coverage
- License: unknown
- Activity24 month
- Download (4.03KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
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("188.8.131.52"); print "The location of 184.108.40.206 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.
- new ( [DATAFILE] [, CHAR_SET])
This is the constructor for a new IP::Location object.
DATAFILEis the name of the QQWry datafile to which the queries use.
DATAFILEis optional. This file is used when initializing a new IP::Location object.
CHAR_SETis optional. If
CHAR_SETis not given, then the object will use GBK as the default character set. You can use the
char_setmethod to change its value.
- init ( DATAFILE )
Initialize the new created IP::Location object with the given datafile.
- locate ( IP_ADDRESS )
Returns the location of the given IP address.
- char_set( [CHARACTER_SET] )
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/
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.