FW: ldapsearch equivalent with Net::LDAP

[email protected] ("Jeremiah Foster")
Newsgroups perl.macosx
Message-ID <56D2F550769FAA4CA70D5B2EB8419F140229D7F3@esealmw118.eemea.ericsson.se>
 

-----Original Message-----
From: Jeremiah Foster 
Sent: den 27 november 2007 09:20
To: 'Dennis Putnam'
Subject: RE: ldapsearch equivalent with Net::LDAP

 
 
> I am trying to do the equivalent of this search:
> 
>      ldapsearch -x -LLL -b "dc=ldaphost,dc=mydomain,dc=com" uid

Caveat Emptor: I am no LDAP genius.
 
> Here is one of the many variations I tried:
> 
>      use strict;
>      use Net::LDAP;
> 
>      my $ldap=Net::LDAP->new("ldaphost.mydomain.com") or die "$@";

Try replacing $@ with $!. You are using $@ which is the eval error
message, but I don't see where you are using eval. $! will tell you what
went wrong since it is the sys/libcall error message. 

>      my $mesg=$ldap->bind();
> 
>      if ($#ARGV<0) {
>              $mesg=$ldap->search(
>                      base=>"dc=ldaphost,dc=mydomain,dc=com",
>                      attrs=>["uid"]
>              );
>      print $mesg->entries(),"\n";
>      }
>      else {
>      }
>      $ldap->unbind();
> 
> 
> I am just starting so my code is incomplete but it should be enough to

> get something. However, I get nothing, not even an error. Can someone 
> see what I am doing wrong? TIA.

See what your code spits out now and diagnose from there. Hopefully that
is a start.

	Jeremiah
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.