From: <CZa...@wi...> - 2002-04-17 14:40:29
|
Hello, I am trying to sort my output using "Net::LDAP::Control::Sort" but I am getting this error syntax error at email_search.pl line 25, near "if $ctrl " I followed the example in the "Programming with Net::LDAP" guide slide " #52". Is this correct or a typo.? $sort = Net::LDAP::Control::Sort->new( order => "sn -mail" ); foreach my $i (@OU) { foreach my $j ("a" .. "z") { @args = ( base => "ou=$i,o=Wiley", scope => "subtree", filter => "(sn=$j*)" ); $r = $ldap->search( @args, control => [ $sort ]); ($ctrl) = $r->control( LDAP_CONTROL_SORTRESULT ); die ldap_error_desc($r->code) if $r->code; if $ctrl && $ctrl->result; @entries = $r->entries; foreach $entry (@entries) { $mail = $entry->get_value('mail'); $cn = $entry->get_value('cn'); if ($mail ne "") { @email = split(/@/, $mail); printf "$i: $email[0]\n"; } else { print "$i: $cn has no email address.\n"; } } } } |