#!/usr/bin/perl -w test.pl use warnings; use strict; use Getopt::Std; $Getopt::Std::STANDARD_HELP_VERSION = 1; use Pod::Usage; my $VERSION = v1.0.0; my %options; getopts('h', \%options); HELP_MESSAGE() if $options{'h'}; print "ok"; # main program would go here. sub HELP_MESSAGE { # the program reaches this point, I checked. pod2usage ( { -exit_status => 0, -verbose_level => 1 } ); # pod2usage seems to be doing nothing w/Cyg. # Why? } sub VERSION_MESSAGE { return 1 if (lc $ARGV[0] eq "--help"); print "This program is $0, "; printf "version %vd\n", $VERSION; printf "(Using Perl v%vd)", $^V; exit 0; } __END__ =head1 NAME test.pl =head1 SYNOPSIS A one line description, possibly command syntax. [more headers deleted here for conciseness] =head1 OPTIONS =over 4 =item -h, --help Prints synopsis and options, then exits. =item --version Prints version information and exits. =back =head1 ETC [more headers deleted here for conciseness]