The isNull() method tests whether an object handle points to a valid object. If this function returns TRUE, the object does not exist. The syntax is as follows:
<objectRef>->isNull();
For example, this script deletes the object PORT25 from the Domain Manager if it exists. The if statement uses the isNull() function to test if the object exists. An exclamation point is a logical NOT, so that if the object does exist, the condition is true for the if statement. The output demonstrates the case where the object exists and is deleted.
ASL Script (isnull_obj.asl): START { ..eol } do { delthisObj = object("Port","PORT25"); if (!delthisObj->isNull()) { delthisObj->delete(); print("Deleted ".delthisObj); } else { print(delthisObj." does not exist");} } Input: none Output: $ sm_adapter --server=JS1 isnull_obj.asl Deleted Port::PORT25 $