Subject: | Lingua::DE::ASCII: grep assignment bug |
Date: | Tue, 06 Mar 2007 19:04:45 -0500 |
To: | Janek Schleicher <bigj [...] kamelfreund.de>, bug-Lingua-DE-ASCII [...] rt.cpan.org |
From: | Jay Rifkin <jay [...] doubleprime.com> |
Dear Mr. Schleicher:
I don't know whether you are still actively working on Lingua::DE,
but I have a bug report for the current CPAN version of
Lingua::DE::ASCII, version 0.11, as well as a patch.
When I use it, I get this warning:
Use of uninitialized value in substitution iterator at
/usr/local/lib/perl5/site_perl/5.8.3/Lingua/DE/ASCII.pm line 123.
Here's a test script to isolate the problem:
-----------------------------------------------
#!/usr/local/bin/perl
use strict;
use Lingua::DE::ASCII;
sub trans {
my $n = shift;
my $s = chr $n;
print $n . "\n";
print "$s\t" . Lingua::DE::ASCII::to_ascii($s) . "\n";
}
for (128..255) { trans($_) }
-----------------------------------------------
The fix is to change this mapping:
-----------------------------------------------
# remove all unknown chars
$ANSI_TO_ASCII_TRANSLITERATION{$_} = ''
for (grep {!defined($ANSI_TO_ASCII_TRANSLITERATION{chr $_})} (128..255));
-----------------------------------------------
to the following:
-----------------------------------------------
# remove all unknown chars
$ANSI_TO_ASCII_TRANSLITERATION{$_} = ''
for (
grep { !defined( $ANSI_TO_ASCII_TRANSLITERATION{$_} ) }
map { chr $_ } ( 128 .. 255 )
);
-----------------------------------------------
If you're no longer maintaining the script, please let me know, and
I'd be happy to try to update it myself -- it's a very helpful module to have.
Thanks very much,
Jay
Jay Rifkin
jay@doubleprime.com