I've started adding a brief "self help" snippet in code that
I write for others. This allows them to enter command -help
from the command line and get the POD doc.
We're still on Perl 5.005 here, so I'd guess that the warnings
either don't appear in 5.6, or at least can be ignored with
no warnings.
#!/usr/local/bin/perl -w
use strict;
use Getopt::Long;
use Pod::Text;
(my $PROGRAM = (split('/',$0))[-1]) =~ s/\..*$//;
my $USAGE = <<__EOT__;
Usage: $PROGRAM [-help]
__EOT__
my $HELP;
# Get the command-line parameters
GetOptions("help" => \$HELP)
or die($USAGE);
if ($HELP)
{
$^W = 0; # Pod::Text throws warnings
pod2text($0);
exit(0);
}
# Continue with the rest of the program
# ********************************************************
# * POD documentation
# ********************************************************
__END__
=head1 NAME
helpme - an example of command-line help
=head1 SYNOPSIS
helpme [-help]
=head1 DESCRIPTION
Put your description here!
=head1 EXIT STATUS
The following exit values are returned:
0 Successful completion
-1 An error occurred
=head1 AUTHOR INFORMATION
Author: Elmer Fudd
Address bug reports and comments to:
Elmer.Fudd@killthewabbit.com
=cut