Re: Search and print unique LDAP attribute values.
Chris Ridd <[email protected]> Fri, 14 Sep 2012 17:38:01 +0100
| Newsgroups | gmane.comp.lang.perl.modules.ldap |
|---|---|
| Message-ID | <[email protected]> |
On 14 Sep 2012, at 16:46, Bruce Johnson <[email protected]> wrote: > > On Sep 14, 2012, at 12:13 AM, Chris Ridd wrote: >> >> By definition the values in a given stored LDAP attribute have to be all unique, so most of your problem "goes away": @result is simply @a! > > I'm pretty sure that the method here will only work with single-valued attributes. It'll work just fine with multi-valued attributes - the trick is that you have to call get_value in an array context, and then it'll return an array of all the values. Otherwise it'll just return one of them. See <http://search.cpan.org/~gbarr/perl-ldap-0.4001/lib/Net/LDAP/Entry.pod#get_value> I usually use it something like this: my (@vals) = $entry->get_value("objectClass"); foreach my $val (@vals) { ... } Chris