Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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 yourname@perl.me.uk? Just ask!!!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://636889]
Approved by grinder
help
Chatterbox?
[Discipulus]: no, they are my crossword/sudoku like entertainment
Discipulus grins
[marto]: Even with shell command recall I find it less time consuming to do such things in a file.
[marto]: I very seldom use one liners for anything which isn't utterly trivial
[Discipulus]: i'm wise enough to never use my oneliners

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2017-09-22 08:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (260 votes). Check out past polls.

    Notices?