Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

LDAP attribute modifciation failed

by anakin30 (Acolyte)
on Aug 29, 2012 at 07:27 UTC ( #990395=perlquestion: print w/replies, xml ) Need Help??
anakin30 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Gurus, i have written the script below to modify attribute on LDAP Directory. But i cant make the changes

#!/usr/bin/perl use Net::LDAP; $ldap = new Net::LDAP('localhost') or die "$@"; $ldap->bind( dn => 'uid=xxx,ou=org,', password => 'secret' ) || die $@; my $dn = "uid=atype,ou=org,o=com"; my $description = "banana"; $msg = $ldap->modify ( $dn, replace => { 'description' => $description } ) || warn "Failed to modify entry. $!"; print "msg is $msg\n"; $ldap->unbind;

i received the following error, when i run the perl script and the attribute not updated on LDAP Directory

msg is Net::LDAP::Modify=HASH(0x1bfe7a4)

Can you please let me know what is my mistake in here, or how to make sure the update take place on LDAP

Thank you in advanced.

Replies are listed 'Best First'.
Re: LDAP attribute modifciation failed
by Corion (Pope) on Aug 29, 2012 at 07:30 UTC

    The Net::LDAP documentation shows the following approach for error checking. Why are you not using it?

    $mesg = $ldap->search( # perform a search base => "c=US", filter => "(&(sn=Barr) (o=Texas Instruments))" ); $mesg->code && die $mesg->error;

      Not sure how to use it, and where to use it.

      I read the reference still not understand much

        If you don't know how and where to use that snippet, how did you come up with your original program? Maybe it's now time to learn to program, and also time to learn about LDAP?

        The code snippet I quoted is very, very similar to a part of the program you already posted. I recommend you learn to recognize similarities, and also recognize differences, and learn to modify code according to similarity and difference.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://990395]
Approved by marto
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2018-04-23 04:05 GMT
Find Nodes?
    Voting Booth?