Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Ldapsearch help

by gopalr (Priest)
on Sep 04, 2007 at 10:28 UTC ( #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!!!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://636889]
Approved by grinder
[Discipulus]: found translate only good from or possibly to english.. in any other case i use double way translation

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2018-06-19 07:37 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.