Skip Menu |

This queue is for tickets about the Text-Levenshtein CPAN distribution.

Report information
The Basics
Id: 36717
Status: resolved
Priority: 0/
Queue: Text-Levenshtein

People
Owner: NEILB [...] cpan.org
Requestors: ambrus [...] math.bme.hu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.07



Subject: Too many return values, also wrong value from Text::Levenshtein
Date: Fri, 13 Jun 2008 11:04:44 +0200
To: bug-Text-Levenshtein [...] rt.cpan.org
From: "Zsbán Ambrus" <ambrus [...] math.bme.hu>
Dear maintainers, This is a bug report about the cpan module Text::Levenshtein. For some arguments, I seem to be getting too many return values from the distance function in Text::Levenshtein if called in list context, and an incorrect edit distance if called in scalar context. According to the docs, in list context the function should return the edit distance of the first string argument from each of the rest of the arguments. In the following examples, I call the function with exactly two strings, so the functions should return just one number, but it actually returns three in list context. Also, I think the correct edit distance of these strings is 1, whereas in scalar context the function returns 2. $ perl -we 'use Text::Levenshtein "distance"; warn join ",", distance("abd", "acd");' Use of uninitialized value in addition (+) at /usr/local/lib/perl5/site_perl/5.10.0/Text/Levenshtein.pm line 58. Use of uninitialized value in addition (+) at /usr/local/lib/perl5/site_perl/5.10.0/Text/Levenshtein.pm line 58. Use of uninitialized value in addition (+) at /usr/local/lib/perl5/site_perl/5.10.0/Text/Levenshtein.pm line 58. Use of uninitialized value in addition (+) at /usr/local/lib/perl5/site_perl/5.10.0/Text/Levenshtein.pm line 58. 2,2,1 at -e line 1. $ perl -we 'use Text::Levenshtein "distance"; warn scalar distance("abd", "acd");' Use of uninitialized value in addition (+) at /usr/local/lib/perl5/site_perl/5.10.0/Text/Levenshtein.pm line 58. Use of uninitialized value in addition (+) at /usr/local/lib/perl5/site_perl/5.10.0/Text/Levenshtein.pm line 58. Use of uninitialized value in addition (+) at /usr/local/lib/perl5/site_perl/5.10.0/Text/Levenshtein.pm line 58. Use of uninitialized value in addition (+) at /usr/local/lib/perl5/site_perl/5.10.0/Text/Levenshtein.pm line 58. 2 at -e line 1. My environment is an x86-linux system with debian, but a vanilla perl 5.10.0 I compiled from source. $ perl -we 'use Text::Levenshtein; warn $Text::Levenshtein::VERSION;' 0.04 at -e line 1. $ perl -V Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=linux, osvers=2.6.20.6, archname=i686-linux uname='linux king 2.6.20.6 #3 smp tue may 29 09:42:52 cest 2007 i686 gnulinux ' config_args='' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='4.1.1', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib /usr/lib64 libs=-lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=/lib/libc-2.3.6.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.3.6' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO Built under linux Compiled at Dec 18 2007 19:48:06 @INC: /usr/local/lib/perl5/5.10.0/i686-linux /usr/local/lib/perl5/5.10.0 /usr/local/lib/perl5/site_perl/5.10.0/i686-linux /usr/local/lib/perl5/site_perl/5.10.0 /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl . Thanks in advance for investigating this report. Ambrus
From: reinpost [...] win.tue.nl
I just attached a patch to <a href="https://rt.cpan.org/Public/Bug/Display.html?id=42459">ticket 42459</a>.
Fixed in 0.07, thanks. Neil