如何使用Perl从LDAP服务器下载用户列表?

lam*_*cro 4 perl wiki ldap

我想从我工作的LDAP服务器上传用户列表,以作为公司目录上传到我们的wiki.如何使用Perl从LDAP服务器下载用户列表?

谢谢.

Dav*_*itt 9

使用NET :: LDAP模块.

来自POD的一个小例子:

use Net::LDAP;

$ldap = Net::LDAP->new( 'ldap.bigfoot.com' ) or die "$@";

$mesg = $ldap->bind ;    # an anonymous bind

$mesg = $ldap->search( # perform a search
                       base   => "c=US",
                       filter => "(&(sn=Barr) (o=Texas Instruments))"
                     );
$mesg->code && die $mesg->error;

foreach $entry ($mesg->entries) { $entry->dump; }

$mesg = $ldap->unbind;   # take down session
Run Code Online (Sandbox Code Playgroud)