#!/usr/bin/perl

use Mozilla::LDAP::Conn;
use Mozilla::LDAP::Entry;

$entry = new Mozilla::LDAP::Entry();
$entry->setDN("uid=tuser,dc=example,dc=com");
$entry->{objectclass} = [ "top", "person", "inetOrgPerson" ];
$entry->{cn} = [ "test user0" ];
$entry->{sn} = [ "user0" ];
$entry->{givenname} = [ "test" ];

print "---- Starting with this entry ----\n";
$entry->printLDIF();

$key =  $entry->FIRSTKEY();
print "First Key is: $key\n";
$key =  $entry->NEXTKEY();
print "Second Key is: $key\n";
$key =  $entry->NEXTKEY();
print "Third Key is: $key\n";
$key =  $entry->NEXTKEY();
print "Fourth Key is: $key\n";

print "Deleting objectclass and sn attribute values\n\n";
$entry->remove("objectclass");
$entry->remove("sn");

print "---- Updated entry ----\n";
$entry->printLDIF();

$key =  $entry->FIRSTKEY();
print "First Key is now: $key\n";
$key =  $entry->NEXTKEY();
print "Second Key is now: $key\n";

