Subject: | Warnings when runned with -w or use warnimgs |
When script using Lingua::DetectCharset spawned with warnings (-w in
command line/shebang or use warnings; in code) it produces many error
messages:
Use of uninitialized value in addition (+) at
/usr/local/lib/perl5/site_perl/5.10.1/Lingua/DetectCharset.pm line 85.
Cause of this problem is undefs in right part of that line. Patch
attached to this bug report.
Subject: | DetectCharset.pm.patch |
--- DetectCharset.pm.102.ORIG 2002-05-29 23:41:45.000000000 +0600
+++ DetectCharset.pm 2010-10-29 16:18:14.000000000 +0600
@@ -76,13 +76,14 @@
$PairSize = 4 if $Code eq 'Utf8';
$PairSize = 2 if $Code ne 'Utf8';
+ # Compute statistics
my ($Mark, $i);
for (@Data) {
s/[\n\r]//go;
$_ = Convert::Cyrillic::toLower ($_, $Code);
for (split (/[\.\,\-\s\:\;\?\!\'\"\(\)\d<>]+/o)) {
for $i (0..length ()-$PairSize) {
- $Mark += ${$Table} {substr ($_, $i, $PairSize)};
+ $Mark += ( ${$Table} {substr ($_, $i, $PairSize)} || 0 );
}
}
}