HTTP::ClientDetect::Location - Lookup the country of the client using Geo::IP
Version 0.03
use HTTP::ClientDetect::Location; my $geo = HTTP::ClientDetect::Location->new(db => "/path/to/geo-ip"); # inside a Dancer route get '/detect' => sub { my $req = request; my $country_code = $geo->country_code($req); }
Path to the geoip database, which can be retrieved from http://dev.maxmind.com/geoip/legacy/geolite/
db must be passed to the constructor.
db
This accessor wraps Geo::IP or Geo::IP::PurePerl. Calling $geo->geo will return an instantiated object, and you can call, e.g. $geo-geo->country_code_by_addr("128.31.0.51")> or $geo-geo->country_code_by_name("linuxia.de")>.
$geo-
Return the country of the request. The request should be a string with the ip or Dancer::Request object (or something that respond to the method "remote_address").
Marco Pessotto, <melmothx at gmail.com>
<melmothx at gmail.com>
Please report any bugs or feature requests to bug-interchange6-plugin-autodetect at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTTP-ClientDetect. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-interchange6-plugin-autodetect at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc HTTP::ClientDetect::Location
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTTP-ClientDetect
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/HTTP-ClientDetect
CPAN Ratings
http://cpanratings.perl.org/d/HTTP-ClientDetect
Search CPAN
http://search.cpan.org/dist/HTTP-ClientDetect/
Copyright 2013 Marco Pessotto.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install HTTP::ClientDetect, copy and paste the appropriate command in to your terminal.
cpanm
cpanm HTTP::ClientDetect
CPAN shell
perl -MCPAN -e shell install HTTP::ClientDetect
For more information on module installation, please visit the detailed CPAN module installation guide.