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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|