In a module I'm writing there is just one method which requires an additional module, so I wish to make that module optional by not listing it in the depends part of the META6.json file. The method will return a Failure object if the optional module is not available.
I know I can do something like this:
if (try require Optional::Module) !=== Nil {
# go on
} else {
# fail
}
Is there any better way to do it?