Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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,o=xxx.com', 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.

Comment on LDAP attribute modifciation failed
Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://990395]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2014-10-23 12:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (125 votes), past polls