| Module Info
| Add a review of String-Approx
Have used this module for years; it has always worked well for me in providing basic approximate matching capabilities.
The other review seems a bit harsh. The module gets the job done, is maintained, has decent documentation and a test suite. The guts may not be pristine and not every single function may be UTF-8 clean, but I've seen a lot worse.
Plus it isn't like there are any alternatives for approximate matching modules, so go ahead and use it, it won't hurt.
This module seems to work to some extent, but it has a fair share of problems. It's written using a C extension, and it doesn't work with Perl's utf8, so lengths from "aindex" and "aslice" come out in bytes even when it's fed a correctly encoded UTF-8 string.
The documentation is fairly lousy, and does not bother to carefully describe what it means by "approximate match". It was only by looking at the test code that I could understand what it meant
The calling conventions for these routines are also counterintuitive The routine "aslice" refuses to return a list in list context. Instead, if it's called in list context, it returns a reference to an array, and if it's called in scalar context, it returns a list, which is then converted to a number because of the scalar context. I don't know what the author could possibly have been thinking when he designed that.
*Be warned* also about version 2.7 of this module. cpanratings doesn't seem to allow me to add different comments for two versions of the same module, so I'll put comments here. First, the code is dangerous - it calls "die" if there is an input error instead of just returning to the calling routine. Also the source code is almost unreadable, with variable names which are one or two letters long, and worst of all the methodology is insane - it creates regular expression of length O(n!), where n is length of the original string we're trying to match, using a list of every possible combination of "nearly matching" strings. Note that this insanity is from an author who wrote a book on "Mastering Algorithms with Perl". It works with UTF-8, because it only uses regular expressions, but it's an utter mess. I can't recommend either version 3.26 or version 2.7.
Three stars for version 3.26: â˜…â˜†â˜…â˜†â˜…
One star for version 2.7: â˜…â˜†â˜†â˜†â˜†
I don't see anything wrong with a program dieing on an error. It's just as easy to trap that with eval and respond as it is to check a return code. And if anything, it's *safer* to die if there's an error than to continue as if nothing's wrong.