ext Hutchins, Mike ([EMAIL PROTECTED]) wrote:
> I have no idea why this little chunk of code doesn't work. Any help
> would be much appreciated.
> 
> use Net::LDAP;
> use Net::LDAP::LDIF;
> 
> $ldap=Net::LDAP->new("cdenldap1", port => 389,
>                                               version => 3 )

You don't need to specify port => 389; it's the default. But it
doesn't cause a problem if you do.

> $msg = $ldap->search( 
>               base    => "o=amr",
>               scope   => "subtree",
>               filter  => "(&(objectClass=person)(isSupervisor=Y))",
>               attrs   => [ "cn", "uid" ]);

You don't need to specify scope => "subtree", to get subtree scoped
searching. Subtree is the default. And even if you do specify it, the
options are "base", "one", or "sub"; not "subtree".

That is one reason why your script does not work.

>       $ldif + Net::LDAP::LDIF->new("\\supes.ldif", "w")

What is "$ldif +" supposed to mean? That should give a big warning.

You should start all of your perl scripts with:

#!/usr/bin/perl -w


until you are such an expert that you don't need to ask mailing lists
for help with debugging scripts :-)

-- 
Mike

Reply via email to