Net::LDAP::Filter

  • Thread starter Hallvard B Furuseth
  • Start date
H

Hallvard B Furuseth

The Net::LDAP::Filter manpage says those objects let me "directly
manipulate LDAP filters without worrying about the string representation
and all the associated escaping mechanisms." But I don't see how, or
what it helps for, at least not by using the documented interface.

The new and parse methods take a single string argument.
So how am I supposed to code
sub equalityMatch($$) { my($attr, $val); ... }
so e.g. equalityMatch("foo", "X*Y\0Z") returns "(foo=X\2aY\00Z)"?

This works, but is not documented:
my $filter = "($attr=x)";
$filter->{equalityMatch}{assertionValue} = $val;
return $filter->as_string

It seems simpler to me to just do
$val =~ s/([*()\\\0])/sprintf("\\%02x", ord($1))/eg;
return "($attr=$val)";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top