vbr.pl has asked for the wisdom of the Perl Monks concerning the following question:

Been using the Text::Levenshtein::XS module in some of my code and I've been getting this warning and don't really know what it means in this context: use of uninitialized value in subroutine entry at C:/strawberry/perl/site/lib/Text/Levenshtein/XS.pm

I looked at the code in the module and it's coming from

sub distance { # shift shift is faster than $_[0] $_[1] return Text::Levenshtein::XS::xs_distance( [unpack('U*', shift)], +[unpack('U*',shift)] ); # <-- this }
In my code I call the distance function in a basic if/else statement, comparing it's return value with a constant in the conditional statement. I have a lot of these checks so the warning clutters up my console. Thanks for any help.

Replies are listed 'Best First'.
Re: Warning from Text::Levenshtein::XS
by BrowserUk (Pope) on Mar 25, 2014 at 18:45 UTC

    The message suggests that you are calling the distance() function with only one variable; or with (at least one) of the variables containing undef.

    Look to your own code where you call the function and print out the value(s) you are passing.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      This makes sense with the code that I have, and I can also avoid it pretty easily. Thanks for your help.

        This particular message is only generated from XS problems. This was a bug in the distribution, and has been reported and fixed. See https://rt.cpan.org/Ticket/Display.html?id=99413.