On 17/6/03 10:15 am, John Woodell <[EMAIL PROTECTED]> wrote:

> Greetings,
> 
> I'm looking for some sample code that illustrates
> sorting an array of entries by one of the attributes.
> 
> OpenLDAP doesn't seem to want to deal with
> LDAP_CONTROL_SORTREQUEST or LDAP_CONTROL_SORTRESULT
> 
> my @entries = $result->entries;
> # hmm
> foreach $entr ( @entries ) {
>   print $entr->get_value("cn")."\n";
> }
> 
> 

Net::LDAP::Search has a sorted() method that will return the search results
sorted by whatever list of attributes you give it. So essentially just
change:

    my @entries = $result->entries;

to:

    my @entries = $result->sorted("cn");

Cheers,

Chris

Reply via email to