|
Apache2::Geo::IP::Record - Contains city information for GeoIP City Edition |
Apache2::Geo::IP::Record - Contains city information for GeoIP City Edition
# in httpd.conf # PerlModule Apache2::HelloIP #<Location /ip> # SetHandler perl-script # PerlResponseHandler Apache2::HelloIP # PerlSetVar GeoIPDBCityFile "/usr/local/share/GeoIP/GeoIPCity.dat" # PerlSetVar GeoIPFlag Standard #</Location>
# file Apache2::HelloIP
use Apache2::Geo::IP::Record; use strict;
use Apache2::Const -compile => 'OK';
sub handler {
my $r = Apache2::Geo::IP::Record->new(shift);
$r->content_type('text/plain');
my $city = $r->city;
$r->print($city);
return Apache2::Const::OK; } 1;
This module constitutes a mod_perl (version 2) interface to the Geo::IP module which contains location information returned by the GeoIP City database.
This module subclasses Apache2::RequestReq, and can be used as follows in an Apache module.
# file Apache2::HelloIP
use Apache2::Geo::IP::Record; use strict;
sub handler {
my $r = Apache2::Geo::IP::Record->new(shift);
# continue along
}
The directives in F<httpd.conf> are as follows:
PerlModule Apache2::HelloIP
<Location /ip>
PerlSetVar GeoIPDBCityFile "/usr/local/share/GeoIP/GeoIPCity.dat"
PerlSetVar GeoIPFlag Standard
# other directives
</Location>
The C<PerlSetVar> directives available are
The available methods are as follows.
$r->connection->remote_ip is used.
$r->connection->remote_ip is used.
$r->connection->remote_ip is used.
$r->connection->remote_ip is used.
$r->connection->remote_ip is used.
$r->connection->remote_ip is used.
$r->connection->remote_ip is used.
$r->connection->remote_ip is used.
1.11
The look-up code for obtaining this information is based on the GeoIP library and the Geo::IP Perl module, and is Copyright (c) 2002, T.J. Mather, tjmather@tjmather.com, New York, NY, USA. See http://www.maxmind.com/ for details. The mod_perl interface is Copyright (c) 2002, Randy Kobes <randy@theoryx5.uwinnipeg.ca>.
All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|
Apache2::Geo::IP::Record - Contains city information for GeoIP City Edition |