if (ref $code && $code->()) {...} # short circuit