Im trying to return a value if the netldap server is unavailable and print out the error and such. The first thing i try is to bind to the ldap server anonymously, and if it fails to print out data via a webpage... I have the ldap server firewalled off and should not be able to connect.
As u can see if it doesnt result in LDAP_SUCCESS, it should technically print out the page ... But i think its giving an error before that because of the fact its not even making a connection to the ldap server...so would I put a die statement in there instead? Im assuming its not resulting in a code whatsover, which is why its not printing that out.
# First, bind anonymously to test connectivity
$ldaps = Net::LDAPS->new ( 'servername', timeout => 10 );
$result = $ldaps->bind();
if ($result->code() != LDAP_SUCCESS)
$pagehead = $pagetitle ='server unavailable';
print "<p style=\"margin:10pt;\">LDAP Server Unavailable\n.";