From: Mark W. <mew...@un...> - 2000-06-29 18:25:39
|
On Thu, 29 Jun 2000, Graham Barr wrote: > ----- Forwarded message from Eric Zhou <eri...@ya...> ----- > > Date: Thu, 29 Jun 2000 10:55:36 -0700 (PDT) > From: Eric Zhou <eri...@ya...> > Subject: retrieve perl-ldap schema and ldap search > To: Graham Barr <gb...@po...> > > hi,Graham: > > remember I asked you an address the other day about > two perl module. I am still not that far yet. > I have been able to use ldap->add() and ldap->modify() > function to do some simple stuff. > > do you have some handy example of how to use > ldap->schema to retrieve schema of ldap tree? This should work: my $schema = $ldap->schema(dn=>"name of your server's schema object"); To get information about the schema look at the documenation for Net::LDAP::Schema. > the other thing is that I don't quite understand > your ldap->search() doing. because I wish to search > and dn in the ldap tree and see if it is there before > I insert it. do I suppose to use ldap->search() or > ldap->compare(). The simplest way to check for the existence of an entry is to do a search (this is not a misunderstanding of Net::LDAP, just a misunderstanding of LDAP ;). Set your base to be the DN of the entry, scope of base and a filter of "objectclass=*". like this: $ldap->search( base => "uid=mewilcox,ou=people,dc=unt,dc=edu", scope => "base", filter => "objectclass", ); if you get an error code of zero then the entry exists. If you get an error code of 32 then the entry doesn't exist. Mark > > > thank you very much. > > Eric > > > __________________________________________________ > Do You Yahoo!? > Get Yahoo! Mail - Free email you can access from anywhere! > http://mail.yahoo.com/ > > ----- End forwarded message ----- > > |