Sorry, I should have provided more detail for my original post. The code below is a snippet from a cgi-bin script that allows an LDAP administrator to add a new ou via a webpage. The webpage just allows the admin to specify the new fully qualified ou, e.g. ou=test,ou=ncr,o=pwgsc. From that data that comes as a HTTP POST I want to create the new ou, e.g. test. Hence I have no LDIF to parse.
My preference is to use either $ldap->modify or $ldap->add in the converted code How would the following code be coverted to use Perl-LDAP? my $ldapmodify = "ldapmodify -h $ldap_master -x -c"; my $context = "ou=test,ou=ncr,o=pwgsc"; my $new_ou = "test"; open (LDAP, "|".$ldapmodify); print LDAP "dn: $context\n"; print LDAP "changetype: add\n"; print LDAP "objectclass: organizationalunit\n"; print LDAP "ou: $new_ou\n"; close (LDAP); Thanks.
