Apache2::Apache::Geo::IP::Record |
Apache::Geo::IP::Record - Contains city information for GeoIP City Edition
# in httpd.conf # PerlModule Apache::HelloIP #<Location /ip> # SetHandler perl-script # PerlResponseHandler Apache::HelloIP # PerlSetVar GeoIPDBCityFile "/usr/local/share/GeoIP/GeoIPCity.dat" # PerlSetVar GeoIPFlag Standard #</Location> # file Apache::HelloIP use Apache::Geo::IP::Record; use strict;
use Apache::Const -compile => 'OK'; sub handler { my $r = Apache::Geo::IP::Record->new(shift); $r->content_type('text/plain'); my $city = $r->city; $r->print($city); return Apache::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 Apache::RequestReq, and can be used as follows in an Apache module.
# file Apache::HelloIP
use Apache::Geo::IP::Record; use strict;
sub handler { my $r = Apache::Geo::IP::Record->new(shift); # continue along }
The directives in F<httpd.conf> are as follows:
PerlModule Apache::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 Geo::IP manpage and Apache.
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::Apache::Geo::IP::Record |