From: Chris R. <chr...@ma...> - 2003-03-26 06:57:04
|
On 25/3/03 8:57 pm, Daniel Davidson <da...@li...> wrote: > Thanks to the help of Chris, I am at least now getting an error message. > > Can't call method "asn" on unblessed reference at > /usr/lib/perl5/site_perl/5.8.0/Net/LDAP.pm line 354, <STDIN> line 5. That's because you used [ $dn ]. > My code is nearly the same as it was in my last post: > > $ldap=Net::LDAP->new($server) or die "$@"; > $ldap->bind(dn => $rootdn, password => $dnpassword) or die "bind"; The bind method returns a result object (like add, etc). You need to check the result code in the result object to determine if the bind succeeded. > $result=$ldap->add( > dn => [$dn], That should probably be just dn => $dn; the arrayrefs I suggested before are only needed for attribute values. Sorry I should have mentioned that too :-) The add method checks if the dn argument is a Net::LDAP::Entry object by calling ref() on it, and if not constructs such an object. When you passed [ $dn ] this caused ref() to return true and the code assumed wrongly that it was a Net::LDAP::Entry. The error you quoted is because it then tries to call the asn method on that "object", which in your case isn't one. Cheers, Chris |