cr8josh has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm new to POD documentation, and am using GetOpt::Long and "HelpMessage" to give usage info to a user. My problem is that HelpMessage exits my script. I want to be able to print my POD info to the terminal window, and not exit my script. I looked into Pod2Usage as well but it also exits.
For example, if the user enters --help, the script shows help/usage info but then continues running.
Many thanks in advance.
EDIT: Answered my own question. It turns out that Pod2Usage won't exit if you call it with
pod2usage(-exitval => 'NOEXIT');
And HelpMessage works with the same invocation:
HelpMessage(-exitval => 'NOEXIT');
My reading of the docs ("pod2usage($exitstatus))" was that the following should work as well, but it doesn't, which caused my confusion:
pod2usage('NOEXIT')