From: Daniel D. <da...@li...> - 2003-03-26 15:09:10
|
When I remove the [$dn] and replace it with $dn then my origional proble= m of=20 the script hanging without an error happens again. I'm stumped, Dan On Wednesday 26 March 2003 12:56 am, Chris Ridd wrote: > 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 messa= ge. > > > > 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=3DNet::LDAP->new($server) or die "$@"; > > $ldap->bind(dn =3D> $rootdn, password =3D> $dnpassword) or die "bind"= ; > > The bind method returns a result object (like add, etc). You need to ch= eck > the result code in the result object to determine if the bind succeeded= =2E > > > $result=3D$ldap->add( > > dn =3D> [$dn], > > That should probably be just dn =3D> $dn; the arrayrefs I suggested bef= ore > are only needed for attribute values. Sorry I should have mentioned tha= t > too :-) > > The add method checks if the dn argument is a Net::LDAP::Entry object b= y > calling ref() on it, and if not constructs such an object. When you pas= sed > [ $dn ] this caused ref() to return true and the code assumed wrongly t= hat > it was a Net::LDAP::Entry. The error you quoted is because it then trie= s to > call the asn method on that "object", which in your case isn't one. > > Cheers, > > Chris > > > > ------------------------------------------------------- > This SF.net email is sponsored by: > The Definitive IT and Networking Event. Be There! > NetWorld+Interop Las Vegas 2003 -- Register today! > http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en |