|
Peter, I'm a bit too lazy for cmdline tools, however using /repos/ instead of /wsvn/ also works for me, might be a hint in the project FAQ, creating a diff is suddenly a breeze and so is keeping up with your versions ;-) There's a bug in your version 0.14 which causes substring match with schema to fail , it is fixed by the attached patch. The regex match works, however its not very common for clients to specify regexes (we might specify a new match for that ;-), I was actually looking for something which matches things like schmidt schmit schmitt etc... therefore I added a list of modules which will be tried (String::Approx, Text::Metaphone, Text::Soundex in that order) , if you have none it will fall back on the original regexp. Cheers, Hans Peter Marschall schreef: Hi Hans, On Sunday, 15. January 2006 21:48, [EMAIL PROTECTED] wrote:I've created a 0.14 (see attached patch ;-)) which contains more matching rules and some other small fixes. |
Index: FilterMatch.pm
===================================================================
--- FilterMatch.pm (revision 483)
+++ FilterMatch.pm (working copy)
@@ -15,7 +15,7 @@
package Net::LDAP::Filter;
-$VERSION = '0.14';
+$VERSION = '0.15';
sub _filterMatch($@);
@@ -80,7 +80,7 @@
greaterOrEqual equality
lessOrEqual ordering
approxMatch approx
- substring substr
+ substrings substr
);
sub _filterMatch($@)
@@ -256,10 +256,25 @@
my $assertion=shift;
my $op=shift;
- #print "approx assertion '". $assertion ."'\n";
+ if (eval ("require String::Approx")){
+ #print "using String::Approx\n";
+ return String::Approx::amatch($assertion, @_) ? 1 : 0;
- return grep(/^$assertion$/i, @_) ? 1 : 0;
- # better: by use String::Approx or similar
+ }
+ elsif (eval ("require Text::Metaphone")){
+ #print "using Text::Metaphone\n";
+ my $metamatch = Text::Metaphone::Metaphone($assertion);
+ return grep((Text::Metaphone::Metaphone($_) eq $metamatch), @_) ? 1 : 0;
+ }
+ elsif (eval ("require Text::Soundex")){
+ #print "using Text::Soundex\n";
+ my $smatch = Text::Soundex::soundex($assertion);
+ return grep((Text::Soundex::soundex($_) eq $smatch), @_) ? 1 : 0;
+ }
+ else{
+ #we really have nothing, use plain regexp
+ return grep(/^$assertion$/i, @_) ? 1 : 0;
+ }
}
1;
