0

我正在尝试使用 Perl 中的 Win32::ad::user 模块在 csv 文件中获取给定用户名的 DN,但我似乎无法正确使用语法。这是我的代码...(域名已被替换)

#!/usr/bin/perl
#use strict;
use warnings;
use Win32::AD::User;
use Text::CSV;
use Net::LDAP;

my $file = "Users.csv";
my $csv = Text::CSV->new();

open (CSV, "<", $file) or die $!;

while (<CSV>) {
if ($csv->parse($_)) {
    my @username = $csv->fields();
    my $user = $username[0];
    my $adstring = join('', $user, ',user",',$user, '"');
    my $acdiruser=Win32::AD::User->new('WinNT://my.domain.EDU/ ',$user);
    $acdiruser->get_info();
    print join ("\n", $acdiruser->get_property( dn ));

}
}
close CSV;

有任何想法吗?

谢谢!!!

编辑:错误是 Bareword "dn" not allowed while "strict subs" in use at T:\Thunderbird Conversion\GetOU.pl 第 22 行,第 558 行。由于编译错误,T:\Thunderbird Conversion\GetOU.pl 的执行中止.

4

2 回答 2

1

我认为这可能是一个错字。

$acdiruser->get_property( 'dn' );

问候,

于 2012-04-20T06:59:03.787 回答
0

So, this was an issue with the Win32::AD::User module- When I was using Quotes, I was failing because I was trying to apply LDAP properties to a function that only accepts WinNT properties. I'll be using Net::Ldap instead.

于 2012-04-20T07:35:52.180 回答