in reply to How to write script usage section
"Getopt::Long encourages the use of Pod::Usage to produce help messages. For example:"
use Getopt::Long; use Pod::Usage; my $man = 0; my $help = 0; GetOptions('help|?' => \$help, man => \$man) or pod2usage(2); pod2usage(1) if $help; pod2usage(-exitstatus => 0, -verbose => 2) if $man; __END__ =head1 NAME sample - Using Getopt::Long and Pod::Usage =head1 SYNOPSIS sample [options] [file ...] Options: -help brief help message -man full documentation =head1 OPTIONS =over 8 =item B<-help> Print a brief help message and exits. =item B<-man> Prints the manual page and exits. =back =head1 DESCRIPTION B<This program> will read the given input file(s) and do someting useful with the contents thereof. =cut
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to write script usage section
by perl@newbie (Novice) on Sep 08, 2005 at 14:33 UTC | |
by philcrow (Priest) on Sep 08, 2005 at 14:40 UTC | |
by gellyfish (Monsignor) on Sep 08, 2005 at 14:38 UTC |