我想从我工作的 LDAP 服务器上传用户列表,以作为公司目录上传到我们的 wiki。如何使用 Perl 从 LDAP 服务器下载用户列表?
谢谢。
使用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