# if object is not valid or both is busy and can't wait: if( ! $a || ! ref($a) || ! isa($a,'Foo') || $a->IsBusy() && ! $a->CanWait() ) { return; }