[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: API with LDIF support



On Sun, 3 Aug 2003, David Smith wrote:

> Does anyone know of an LDAP C (or any language for that matter) API
> which includes LDIF importing functionality?

Perl's Net::LDAP::LDIF module?

    use Net::LDAP::LDIF;

    my $ldif = Net::LDAP::LDIF->new("file.ldif", "r", onerror => 'undef');
    while (not $ldif->eof())
    {
	$entry = $ldif->read_entry();
	if ($ldif->error())
	{
	    print "Error msg: ", $ldif->error(), "\n";
	    print "Error lines:\n", $ldif->error_lines(), "\n";
	}
	else
	{
	    # do stuff
	}
    }
    $ldif->done();

-- 
Dave Horsfall  DTM  VK2KFU  daveh@ci.com.au  Ph: +61 2 9906-7866  Fx: 9906-1556
Corinthian Engineering, Level 1, 401 Pacific Hwy, Artarmon, NSW 2064, Australia