Using Getopt::Long
, I want to capture any failures from GetOptions
and, rather than printing them to STDOUT/STDERR, I want to print out a Usage string and exit the script. I tried wrapping the call to GetOptions
in a Try::Tiny
try/catch
block, but it doesn't get caught. I'm not sure what's going on behind the scenes here.
How can I capture a failure in GetOptions
, prevent it from printing, and print my own usage statement instead?