Hello,

I need some help in understanding how to iterate thru array of hashes. I am
basically pushing a hash into array and then passing the array to another
function to iterate thru the values. I could do it parallely but I wanted to
check the size of the array and make sure it is within the defined limits.

Q: After passing the array, how can I iterate thru the entries to perform an
LDAP-ADD. I am getting error adding. Any help or optimization for this?

Does someone have a better way of doing this? I am performing a one-way sync
from AD to LDAP with custom attributes and also making sure the additiona nd
deletion list is within a specified limit.

code:
         $user{'cn'} = $cn;
         $user{'givenName'}=$givenName;
         $user{'sn'} = $sn;
         $user{'description'} = $description;
         $user{'mail'} = $mail;
         $user{'uid'} = $sAMAccountName;
         $user{'objectClass'} = @objectClass;
         $user{'userPassword'} = &get_password;
         $user{'gidNumber'} = $gidNumber;
         $user{'loginShell'} = $loginShell;
         $user{'HomeDirectory'} = "/home/$sAMAccountName";
         $user{'gecos'} = $cn;
         $user{'uidNumber'} = $uidNumber;
         push @add_user,%user;

Routine-2
 foreach $item ( @add_user )
    {
      $entry = Net::LDAP::Entry->new;
      $dn = "uid=".$item{'uid'}.",ou=People,".$ldap_base;
      print "DN:$dn \n";  # Test to see if DN prints properly

      my $mesg_ld = $ldap_ld->add($dn,attr => [ %item ] );

-Prashanth



Reply via email to