Skeeve has asked for the wisdom of the Perl Monks concerning the following question:

What do you think about calling POD::Perldoc as a help function? I currently add some POD to my script and want to use this help function
use POD::Perldoc; sub help { exit( Pod::Perldoc->run(args=>[$0]) ); }
I'd love to hear your thoughts about it.

Replies are listed 'Best First'.
Re: call POD::Perldoc as help
by PodMaster (Abbot) on Sep 26, 2004 at 14:42 UTC
Re: call POD::Perldoc as help
by Aristotle (Chancellor) on Sep 26, 2004 at 15:31 UTC

    Indeed, Pod::Usage is what you want. My scripts generally use that and Getopt::Long (see PodMaster's link), and start out with the following incantation:

    GetOptions( 'h|help' => sub { pod2usage( -verbose => 1 ) }, 'man' => sub { pod2usage( -verbose => 2 ) }, # ... ) or pod2usage();

    Makeshifts last the longest.

Re: call POD::Perldoc as help
by educated_foo (Vicar) on Sep 26, 2004 at 14:18 UTC
    How many screenfuls of output is it? IMHO the --help or usage error message should fit in one 80x24 window, while the developer documentation for your module likely won't.
      I would recommend Pod::Usage then. It prints only the SYNOPSYS by default, but it can also be more verbose if desired.