Fantastic, found and tested catch all that works with AD and Net::LDAP
without any nasty hacking. Thanks for your help Graham, Chris et al...
#!/usr/bin/perl
use strict;
use warnings;
use Net::LDAP;
my $dn = 'cn=Joe,ou=London,o=axomic';
my $password = '';
my $ldapServer = new Net::LDAP('ldap://localhost',
'port' =>'389',
'timeout'=>'2');
my $error;
if ($password) {
$error = $ldapServer->bind($dn,'password'=>$password)->is_error();
} else {
$ldapServer->bind($dn,'noauth'=>'1');
$error = $ldapServer->search('base' =>$dn,
'filter'=>'(dn='.$dn.')',
'scope' =>'base')->is_error();
}
print $error?"Failure\n":"Success\n";
=========
OpenAsset - Image Management for Architects, Designers & Engineers
Axomic Ltd
http://www.axomic.com