From: Mark W. <mew...@un...> - 2000-05-12 14:37:16
|
#now connect to LDAP server my $ldap = new Net::LDAP('ldap.acme.com'); my $mesg = $ldap->bind("my_dn", password=>"password"); die ("failed to bind with ",$mesg->code(),"\n") if $mesg->code(); #update entry $mesg = $ldap->modify("cn=cmex,ou=software,dc=acme,dc=com", add => { 'resource' => 'value1'}); die ("failed to modify ",$mesg->code(),"\n") if $mesg->code(); $ldap->unbind(); Mark On Fri, 12 May 2000, Reda Bouarich wrote: > Hello, > I tried this program that you wrote but it doesn't seem to work , surely due > to a bad using from me!! > Could you explain me please. > regards, > Reda. > > here is the program > > > #!/usr/local/bin/perl > > use lib '.'; > use lib 'lib'; > use Net::LDAP; > > > > $host='cmix.vbe.cpqcorp.net'; > $ldap = Net::LDAP->new($host); > > $filter='(cn=cmix)'; > $mesg = $ldap->search( > base => "ou=equipments,ou=Test3,o=temip.com", > filter => $filter, > attr => \@_, > ); > > my $max = $mesg->count; > for($i = 0 ; $i < $max ; $i++) { > my $entry = $mesg->entry($i); > foreach my $attr ($entry->attributes) { > print join("\n ",$attr, $entry->get($attr)),"\n"; > } > } > > # or > > use Net::LDAP::Entry; > > > $entry = Net::LDAP::Entry->new; > print $entry ; > print "\n HELLO>>>>>>>>>>>>>>\n"; > $entry->add( > resource => 'cn=value1' > ); > > > #$entry->delete( 'unwanted' ); > > > #$entry->replace( > # attr1 => 'newvalue', > #attr2 => [qw(new values)] > #); > > > $entry->update( $ldap ); # update directory server > > > I have this error message: > > use of uninitialized value at Convert/Ber.pm line 1224 > use of uninitialized value at Convert/Ber.pm line 1225 > > > I'm just trying to add a value to the attribute "resource" in the following > entry cn=cmix. > > > > > > > > > |