Hi all,

I've found a little bug in Apache::GeoIP module (1.215) when using it under
mod_perl 2 (Apache 2.0.47, Perl 5.8.1, mod_perl 1.99_10):

[Wed Dec 03 13:38:41 2003] [error] [client 1.2.3.4] Can't locate object method 
"remote_ip" via package "Apache::Connection" at 
/home/perl-5.8.1/lib/site_perl/5.8.1/i686-linux-thread-multi/Apache2/Apache/Geo/IP.pm 
line 73.

In httpd.conf:

   ...
   PerlModule Apache2
   <Perl >
      package My::Apache::GeoIP;
      use Apache::Geo::IP;
      use strict;
      use Apache::Const -compile => 'OK';
      sub handler {
         my $r = Apache::Geo::IP->new(shift);
         $r->content_type('text/plain');
         my $country = uc($r->country_code_by_addr());
         $r->print($country);
         return OK;
      }
      1;
   </Perl>
   <Location /geoip>
      SetHandler perl-script
      PerlResponseHandler My::Apache::GeoIP
      PerlSetVar GeoIPDBFile "/usr/local/share/GeoIP/GeoIP.dat"
      PerlSetVar GeoIPFlag Standard
   </Location> 
   ...

I think that this happnes because Apache2/Apache/Geo/IP.pm don't loads
Apache::Connection class.
With simple patch (that I've attached) it seems to work fine.

by

        - Enrico




Attachment: IP.pm-patch
Description: Binary data

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to