http://www.perlmonks.org?node_id=411309


in reply to AD User Exist?

A typical way to handle that are try/catch blocks, which in Perl are implemented with eval (the block form). When you wrap the call in an eval, it will trap the die, and let you inspect the result. Something like this in your case:

$path='cn=username,ou=mybase_ou,dc=computer,dc=com'; eval { $objUser = Win32::OLE->GetObject("LDAP://" . $path); }; if ($@) { # the call died, do something or another. }

You can read more about this in perlfunc, under eval.

Replies are listed 'Best First'.
Re^2: AD User Exist?
by Anonymous Monk on Dec 01, 2004 at 14:33 UTC
    Thank you, Eval worked perfectly.