Subject: | 2 warnings and 2 "uninitialized value", (with solution) |
Hi, in first place, sorry for my bad english.
When i use the perl module:
use Geo::IPfree qw(LookUp);
my $ip = '80.80.80.8';
my ($country,$country_name) = Geo::IPfree::LookUp($ip);
The perl interpreter show this:
Possible attempt to separate words with commas at
/usr/share/perl5/Geo/IPfree.pm line 38.
Possible attempt to separate words with commas at
/usr/share/perl5/Geo/IPfree.pm line 63.
Use of uninitialized value in string eq at
/usr/share/perl5/Geo/IPfree.pm line 267.
Use of uninitialized value in length at /usr/share/perl5/Geo/IPfree.pm
line 125.
I edited the file /usr/share/perl5/Geo/IPfree.pm, and now this work
without print warnings.
*** 1º & 2º WARNING
"Possible attempt to separate words with commas at
/usr/share/perl5/Geo/IPfree.pm line 38."
"Possible attempt to separate words with commas at
/usr/share/perl5/Geo/IPfree.pm line 63."
Replace:
my @baseX = qw/ ... / ;
my %countrys = qw/ ... / ;
And put this (with quoted strings):
my @baseX = ( ... ) ;
my %countrys = ( ... ) ;
*** 3º WARNING:
"Use of uninitialized value in string eq at
/usr/share/perl5/Geo/IPfree.pm line 267."
if ($lib_path eq '') { <--- uninitialized value in string
Replace: my $lib_path ;
and put: my $lib_path = '';
*** 4º WARNING:
"Use of uninitialized value in length at /usr/share/perl5/Geo/IPfree.pm
line 125."
while( read($handler, $buffer , 1 , length($buffer) ) ) { <---
uninitialized value length($buffer)
In the line: my ($handler,$buffer) ;
add the value (0 is valid): my ($handler,$buffer) ; $buffer=0;
I attach the file edited.
Byezzzzzzz
Subject: | IPfree.pm |
Message body is not shown because it is too large.