http://qs1969.pair.com?node_id=594626


in reply to The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan!

I dont't understand the comment:
# 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;
I evaluate "--help" and "--man" as "subs", like
GetOptions( "help|?" => sub { pod2usage( -verbose => 1, -exitval => 0 ); }, "man" => sub { pod2usage( -verbose => 2, -exitval => 0 ); }, # ... ) or pod2usage( -verbose => 1, -exitval => 1);

The '-exitval' lets pod2usage exit the programm for you.

The line "or pod2usage( -verbose => 1, -exitval => 1);" is now added to my code; until I read your article I never thought of checking GetOptions(). But it is a good idea! :)