CC: | Laurent DOMISSE <domisse [...] w3perl.com> |
Subject: | Warning message |
Date: | Sun, 06 Sep 2009 20:11:22 +0200 |
To: | bug-Geo-IPfree [...] rt.cpan.org |
From: | Laurent Domisse <domisse [...] w3perl.com> |
Hello,
I'm using GeoIPfree 0.6 on my Mandriva 2008.0 (perl 5.8.8).
I have the following warning :
Use of uninitialized value in length at
/usr/lib/perl5/site_perl/5.8.8/Geo/IPfree.pm line 223.
In IPfree.pm , line 223 is inside the Faster call :
sub Faster {
my $this = shift;
seek( $this->{ handler }, 0, 0 ); ## Fix bug on Perl
5.6.0
seek( $this->{ handler }, $this->{ start }, 0 );
1 while (
read(
$this->{ handler },
$this->{ DB },
1024 * 4,
length( $this->{ DB } )
) ##################### Line 223
);
$this->{ DB_SIZE } = length( $this->{ DB } );
memoize( 'dec2baseX' );
memoize( 'baseX2dec' );
$this->{ FASTER } = 1;
}
My code is :
#!/usr/bin/perl
$geoip_free = 1;
&check_module("Geo::IPfree","Can't resolve IP address","Get country code
from IP using GeoIPfree");
&init_geoipfree;
sub check_module {
local($module,$msg,$fonction) = @_;
eval("use $module");
if ($@) {
$msg = "\n$module module missing : $msg !\n\n";
$msg .= "1) If you want to install the $module module : \n";
if ($nt == 1) {
$msg .= " Go to your Perl installation path (usually C:\Perl)
and type :\n";
$msg .= "'ppm'\n";
$msg .= "At the prompt 'PPM>' type :\n";
$msg .= "'install $module'\n\n";
}
if ($nt == 0) {
$msg .= " Use CPAN to download the required modules, type :\n";
$msg .= "'perl -MCPAN -e shell'\n";
$msg .= "At the prompt 'cpan>' type :\n";
$msg .= "'install $module'\n\n";
}
if ($spip == 1) {
$msg .= "Then the module according to your database\n";
$msg .= "'install DBD-mysql'\n";
$msg .= "(for mysql database)\n";
}
$msg .= "2) or you can choose to disable '$fonction' in your
configuration file\n";
&error_exit($msg);
} else {
# require $module;
if ($enable_email == 1) {
require MIME::Lite;
}
if ($netgeo == 1) {
require Geo::IP;
}
if ($geoip_free == 1) {
require Geo::IPfree;
}
}
}
sub init_geoipfree {
my $GeoIP = Geo::IPfree->new(); ## Using the default DB!
$GeoIP->Faster;
}
If I comment $GeoIP->Faster;, no more warning.
GeoIPfree works fine except this warning....thanks for the module !
Laurent