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

I'm trying to implement a simple LDAP auth for my CGI script. I'd like to use something equivalent to this php code:
<?php // using ldap bind $ldaprdn = 'username@mydomain.COM'; // ldap rdn or dn $ldappass = 'mypassword'; // associated password // connect to ldap server $ldapconn = ldap_connect("LDAP IP") or die("Could not connect to LDAP server."); if ($ldapconn) { // binding to ldap server $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); // verify binding if ($ldapbind) { echo "LDAP bind successful..."; } else { echo "LDAP bind failed..."; } } ?>

Replies are listed 'Best First'.
Re: Simple LDAP auth for CGI
by Anonymous Monk on Dec 30, 2014 at 23:21 UTC

    Did you google it? That brings up Net::LDAP, which is fairly actively developed and has lots of good reviews. The documentation begins with some example code:

    use Net::LDAP; $ldap = Net::LDAP->new( 'ldap.bigfoot.com' ) or die "$@"; $mesg = $ldap->bind( 'cn=root, o=University of Michigan, c=us', password => 'secret' );
Re: Simple LDAP auth for CGI
by Anonymous Monk on Dec 30, 2014 at 23:18 UTC
A reply falls below the community's threshold of quality. You may see it by logging in.