View previous topic :: View next topic |
Author |
Message |
mlehde -
Joined: 19 Feb 2003 Posts: 10
|
Posted: Sat Apr 26, 2003 2:09 am Post subject: Getting Geo::IP PurePerl to work on a w32 platform |
|
|
Code: | programs needed for this:
PurePerl -> Geo-IP-PurePerl-1.10 from http://www.maxmind.com/download/geoip/api/perl/
Nmake (read your activeperl docs)
ActivePerl
Extract Geo-IP-PurePerl-1.10
open \lib\Geo\IP\PurePerl.pm
on lines 48 & 52:
replace:
$db_file = '/usr/local/share/GeoIP/GeoIP.dat';
with
$db_file = 'F:/root/www/abyss/cgi-bin/awstats/plugins/GeoIP.dat';
#or wherever you want your GeoIP.dat file.
Perl Makefile.pl
Nmake
Nmake test
Nmake Install
PurePerl is now installed
#-------------------------------------------------
Now make a copy to backup geoip.pm in your awstats\plugins folder and replace
lines 13 -60 with:
# <-----
# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES
if (!eval ('require "Geo/IP/Pureperl.pm";')) { return "Error: Need Perl module Geo::IP"; }
# ----->
use strict;no strict "refs";
#-----------------------------------------------------------------------------
# PLUGIN VARIABLES
#-----------------------------------------------------------------------------
# <-----
# ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN
# AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
my $PluginNeedAWStatsVersion="5.4";
my $PluginHooksFunctions="GetCountryCodeByAddr GetCountryCodeByName";
# ----->
# <-----
# IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE.
use vars qw/
%TmpDomainLookup
$gi
/;
# ----->
#-----------------------------------------------------------------------------
# PLUGIN FUNCTION: Init_pluginname
#-----------------------------------------------------------------------------
sub Init_geoip {
my $InitParams=shift;
my $checkversion=&Check_Plugin_Version($PluginNeedAWStatsVersion);
# <-----
# ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
debug(" InitParams=$InitParams",1);
my $mode=$InitParams;
if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE') {
$mode=Geo::IP::PurePerl::GEOIP_MEMORY_CACHE(); }
else { $mode=Geo::IP::PurePerl::GEOIP_STANDARD(); }
%TmpDomainLookup=();
debug(" GeoIP working in mode $mode",1);
$gi = Geo::IP::PurePerl->new($mode);
# ----->
return ($checkversion?$checkversion:"$PluginHooksFunctions");
}
This is just a tempory fix, and you will have to d/l the updates yourself, but you won't have to pull your hair out trying to get the c api to work. If anyone can re-program the c api for him, email me |
|
|
Back to top |
|
|
DLashley -
Joined: 18 Dec 2002 Posts: 207 Location: New York, NY
|
Posted: Tue May 27, 2003 12:48 am Post subject: |
|
|
Thank you for this information! :)
Can you install this Perl module through PPM at the command prompt also, or can you only do it manually? _________________ DLashley |
|
Back to top |
|
|
|