Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Perl on OSX > Re: ldapsearch ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 6 Topic 1014 of 1075
Post > Topic >>

Re: ldapsearch equivalent with Net::LDAP

by dennis.putnam@[EMAIL PROTECTED] (Dennis Putnam) Nov 27, 2007 at 07:42 AM

Thanks again. I see you are an early riser too. No, I am not familiar  
with that (I'm not a Perl expert either). I'll look it up and see  
what it can give me.

On Nov 27, 2007, at 7:17 AM, Jeremiah Foster wrote:

> Did you try using Data::Dumper? It is a built-in module and is
> incredibly useful. You can use it to dump out the contents of $mesg  
> for
> example.
>
>> -----Original Message-----
>> From: Dennis Putnam [mailto:dennis.putnam@[EMAIL PROTECTED]
>> Sent: den 27 november 2007 13:16
>> To: macosx@[EMAIL PROTECTED]
>> Cc: Jeremiah Foster
>> Subject: Re: ldapsearch equivalent with Net::LDAP
>>
>> Thanks for the reply. I'm not an LDAP expert either but this
>> issue is more of a Perl Net::LDAP user than an LDAP expert per se.
>> Unfortunately there are no real world working script examples
>> readily available. The samples that are, show the syntax but
>> not the context, making them pretty much useless to the novice.
>>
>> The script is not 'die'ing so it never really gets to that point.
>> Whether I use '$!' or '$@[EMAIL PROTECTED]
' won't matter until I actually get
>> an error condition. It appears that everything is working
>> except the search returns zero entries. Since 'ldapsearch'
>> works it is clearly not a server problem. That leaves only
>> the way I am trying to use Net::LDAP. There does not appear
>> to be any way to cause Net::LDAP to generate informational
>> messages about the dialog that occurs between it and the LDAP
>> server. I don't see any way to debug this.
>>
>> On Nov 27, 2007, at 3:20 AM, Jeremiah Foster wrote:
>>
>>>
>>>
>>> -----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 "$@[EMAIL PROTECTED]
";
>>>
>>> Try replacing $@[EMAIL PROTECTED]
 with $!. You are using $@[EMAIL PROTECTED]
 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
>>
>>
 




 6 Posts in Topic:
FW: ldapsearch equivalent with Net::LDAP
jeremiah.foster@[EMAIL PR  2007-11-27 09:20:03 
Re: ldapsearch equivalent with Net::LDAP
dennis.putnam@[EMAIL PROT  2007-11-27 07:15:37 
Re: ldapsearch equivalent with Net::LDAP
dennis.putnam@[EMAIL PROT  2007-11-27 07:42:00 
Re: ldapsearch equivalent with Net::LDAP
dennis.putnam@[EMAIL PROT  2007-11-27 08:55:35 
Re: ldapsearch equivalent with Net::LDAP
shellys@[EMAIL PROTECTED]  2007-11-27 09:29:19 
Re: ldapsearch equivalent with Net::LDAP
phreelance@[EMAIL PROTECT  2007-11-27 20:22:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 3:31:56 CDT 2008.