Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: AD User Exist?

by VSarkiss (Monsignor)
on Nov 30, 2004 at 21:55 UTC ( [id://411309]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://411309]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-24 23:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found