Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Ldapsearch help

by gopalr (Priest)
on Sep 04, 2007 at 10:28 UTC ( [id://636889] : perlquestion . print w/replies, xml ) Need Help??

gopalr has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I am using Unix and the following command successfully run in command prompt. But when we embed in CGI, the results is not found. ie. array is not getting any values

$cdsCmd="/opt/totalnet/sbin/ldapsearch uid=USERID -h ldaps://xxx.c om:636 -D xxxGID=xxxxx, ou=Employee,ou=People,o=Company,c=US -w PASSWD + ARGUMENTS"; @cdsValues = `$cdsCmd`; print @cdsValues;

Please guide me in this regard

Thanks in Adavnce

Replies are listed 'Best First'.
Re: Ldapsearch help
by grinder (Bishop) on Sep 04, 2007 at 10:50 UTC

    Perhaps the backticked command is failing. Maybe you should use IPC::Open3 to keep track of both STDOUT and STDERR. Otherwise $? will give a clue as to whether it succeeded or not.

    Another alternative is to use the Net::LDAP module, which allows you to perform LDAP queries directly from Perl. In this way you can see exactly where and when in fails, and also possibly tailor the search to return exactly what you need and not have to post-process the results of @cdsValues.

    • another intruder with the mooring in the heart of the Perl

Re: Ldapsearch help
by ghenry (Vicar) on Oct 17, 2007 at 15:33 UTC

    Learn to use ldapsearch correctly.

    man ldapsearch

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a Just ask!!!