[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-ldap-dev
Subject:    Re: parsing filters?
From:       woodie () netpress ! com (John Woodell)
Date:       2004-11-16 20:56:51
Message-ID: 20041116210227.2ED5F917A () netpress ! com
[Download RAW message or body]

> > Is there already a function that will parse this filter?
> > ldap:///ou=People,o=acme,c=us?uid?one?(&(mail=*)(c=CA))
 
> URI::ldap should be able to split the whole thing up into bits, and surely
> Net::LDAP::Filter can parse the filter bit from that?

OK, I suppose there are pitfalls like escaped question marks.
I'll take a look at those modules, but it seems like this would work...

# get the result of a filter
sub get_filter result() {
  my ($base,$attr,$scope,$filter) = split(/?/,shift());
  $base = (split(/\//))[-1];
  my @Attrs  = split(/,/$attr);
  my $result = $ldap->search( base   => $base,
                              filter => $filter,
                              scope  => $scope,
                              attrs  => \@Attrs );
 . . .
}
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic