if (*package::foo{CODE}) { # Function package::foo exists. } else { # Function package::foo does not exist. }