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')
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Printing POD info to terminal window without exiting
by GrandFather (Saint) on Aug 05, 2021 at 02:44 UTC | |
Re: Printing POD info to terminal window without exiting
by davido (Cardinal) on Aug 05, 2021 at 15:04 UTC | |
Re: Printing POD info to terminal window without exiting
by perlfan (Vicar) on Aug 08, 2021 at 02:20 UTC | |
by haukex (Archbishop) on Aug 08, 2021 at 07:22 UTC | |
by perlfan (Vicar) on Aug 08, 2021 at 15:08 UTC | |
by haukex (Archbishop) on Aug 08, 2021 at 18:28 UTC | |
by perlfan (Vicar) on Aug 09, 2021 at 01:42 UTC |