Net::LDAP::Filter
- From: Hallvard B Furuseth <h.b.furuseth@xxxxxxxxxxx>
- Date: Thu, 29 Mar 2007 11:20:40 +0200
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)";
--
Hallvard
.
- Prev by Date: Re: perl + script files from only one directory
- Next by Date: Re: perl + script files from only one directory
- Previous by thread: FAQ 9.8 How do I fetch an HTML file?
- Next by thread: HowTo parse huge Files
- Index(es):