in reply to How to write script usage section

the Getopt::Long module's own documentation has this to say on the matter...

"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
---
my name's not Keith, and I'm not reasonable.

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
    what does "=over 8" and "=item B<-help>" signify. And what does "cut" do. I can see "cut" in the man page documentation for my script. Whats it for. How can i put a new line while writing the pod usage ie New line should appear in the man page else the man page looks quite cluttered Pardon me but im absolutely new to the whole word of scripting.
      =over some_number begins a list =back ends it. All pod commands begin at the left margin with =.

      Pod thinks in paragraphs, where paragraph is defined as a group of lines separated from other groups by one or more blank lines.

      See perlpod for details on pod, it is quite simple, but highly effective.

      Phil

      Read perlpod in the first instance.

      /J\