Getting Geo::IP PurePerl to work on a w32 platform

 
Post new topic   Reply to topic    Aprelium Forum Index -> Tutorials
View previous topic :: View next topic  
Author Message
mlehde
-


Joined: 19 Feb 2003
Posts: 10

PostPosted: Sat Apr 26, 2003 2:09 am    Post subject: Getting Geo::IP PurePerl to work on a w32 platform Reply with quote

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 View user's profile Send private message ICQ Number
DLashley
-


Joined: 18 Dec 2002
Posts: 207
Location: New York, NY

PostPosted: Tue May 27, 2003 12:48 am    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> Tutorials All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group