in reply to The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan!
I evaluate "--help" and "--man" as "subs", like# Check this last to avoid parsing options as Places, # and so don't override $opt_man verbose level my @places = @ARGV; pod2usage(-verbose => 1) && exit unless @places;
GetOptions( "help|?" => sub { pod2usage( -verbose => 1, -exitval => 0 ); }, "man" => sub { pod2usage( -verbose => 2, -exitval => 0 ); }, # ... ) or pod2usage( -verbose => 1, -exitval => 1);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan!
by hippo (Archbishop) on Aug 31, 2023 at 10:59 UTC |