paragkalra has asked for the wisdom of the Perl Monks concerning the following question:

Hi Friends,

I guess we all know that using ldif files we can add or modify the directory contents using OpenLDAP command line applications as shown below:

E.G: ldapadd -v -x -D "cn=admin,dc=nodomain" -H ldap://192.168.1.31:389 -f add_org.ldif -W

Now "Net::LDAP' provides "add" method which takes the attributes to be added. It also provides "modify" method along with many other useful methods.

I was refering the documentation (http://search.cpan.org/~gbarr/perl-ldap/lib/Net/LDAP.pod) and I couldn't find a way to provide a ldif file as an input parameter to the methods like "add" or "modify".

I just wanted to know if it is possible provide "ldif" files as an input parameter to various functions of Net::LDAP (just as we can do with the command "ldapadd")

If no then I guess we have to use Net::LDAP::LDIF.

Cheers,

Parag

Replies are listed 'Best First'.
Re: Using LDIF file with Net::LDAP
by Bloodnok (Vicar) on Oct 05, 2009 at 11:20 UTC
    Hmmm, I can't see your problem - does the name, Net::LDAP::LDIF, not provide any clues or hints as to what it might be able to handle by default/design ?

    I'd be willing to bet that Net::LDAP and the aformentioned Net::LDAP::LDIF, taken together, facilitate the processing of an LDIF file a line at a time.

    A user level that continues to overstate my experience :-))