csarid has asked for the wisdom of the Perl Monks concerning the following question:
use Net::LDAP; $ldap = Net::LDAP->new('ldap.acme.com') or die "$@"; $mesg = $ldap->search( base => "o=acme.com", scope => 'sub', filter => "sn=smith", ); # # At this point the user can get the returned data as an array # or as a stack. # In this example we will use an array # How many entries were returned from the search my $max = $mesg->count; for( my $index = 0 ; $index < $max ; $index++) { my $entry = $mesg->entry($index); my $dn = $entry->dn; # Obtain DN of this entry @attrs = $entry->attributes; # Obtain attributes for this entry. foreach my $var (@attrs) { #get a list of values for a given attribute $attr = $entry->get_value( $var, asref => 1 ); if ( defined($attr) ) { foreach my $value ( @$attr ) { print "$var: $value\n"; # Print each value for the attribut +e. } } + } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ldap search question
by salva (Canon) on Jul 21, 2009 at 06:16 UTC | |
|
Re: ldap search question
by spazm (Monk) on Jul 21, 2009 at 05:01 UTC | |
by csarid (Sexton) on Jul 21, 2009 at 21:53 UTC | |
by csarid (Sexton) on Jul 24, 2009 at 19:41 UTC | |
|
Re: ldap search question
by NetWallah (Canon) on Jul 21, 2009 at 05:52 UTC | |
|
Re: ldap search question
by nif (Sexton) on Jul 22, 2009 at 09:49 UTC |