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

NAME

HTTP::ClientDetect::Location - Lookup the country of the client using Geo::IP

VERSION

Version 0.03

SYNOPSIS

    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);
    }

ACCESSORS

db

Path to the geoip database, which can be retrieved from http://dev.maxmind.com/geoip/legacy/geolite/

db must be passed to the constructor.

geo

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")>.

SUBROUTINES/METHODS

request_country($request_obj)

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").

AUTHOR

Marco Pessotto, <melmothx at gmail.com>

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc HTTP::ClientDetect::Location

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

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.