Ahhh how annoying. The pod documents can have no white space before the
=command or they don't work. They also have to have a blank line before and
after them. This seem very anti-perl. Especially with the white space.

 Paul Kraus
 -----------------------
 PEL Supply Company
 Network Administrator

> -----Original Message-----
> From: Paul Kraus [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 09, 2004 8:51 AM
> To: [EMAIL PROTECTED]
> Subject: pod::usage example help
> 
> Ok if I understand this then if
> --help is called from the page then should display this
> =head1 SYNOPSIS
> 
>         sample [options] [file ...]
> 
>          Options:
>            -help            brief help message
>            -man             full documentation
> 
>         =head1 OPTIONS
> 
> If --man or infact if nothing is passed then the entire pod documents
> should
> be displayed
> GetOptions('help|?' => \$help, man => \$man) or pod2usage(2);
> Which to me read if help or man is undefined then pod2usage(-verbose => 2)
> Which is called before this line which states to display just the no files
> given message.
> pod2usage("$0: No files given.")  if ((@ARGV == 0) && (-t STDIN));
> 
> now when I pass in --help I get nothing when I pass in nothing I get the
> no
> files given message and when I pass in --man I get the entire document.
> This
> code taken from the pod::usage docs.
> 
> #!/usr/bin/perl
> 
> use Getopt::Long;
> use Pod::Usage;
> 
> my $man = 0;
> my $help = 0;
> ## Parse options and print usage if there is a syntax error,
> ## or if usage was explicitly requested.
> GetOptions('help|?' => \$help, man => \$man) or pod2usage(2);
> print "$help\n";
> print "$man\n";
> pod2usage(-verbose => 0) if $help;
> pod2usage(-verbose => 2) if $man;
> 
> ## If no arguments were given, then allow STDIN to be used only
> ## if it's not connected to a terminal (otherwise print usage)
> pod2usage("$0: No files given.")  if ((@ARGV == 0) && (-t STDIN));
> __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 something
>         useful with the contents thereof.
> 
>         =synompis
>         some text
> 
>         =cut
> 
> 
>  Paul Kraus
>  -----------------------
>  PEL Supply Company
>  Network Administrator
>  -----------------------
>  800 321-1264 Toll Free
>  216 267-5775 Voice
>  216 267-6176 Fax
>  www.pelsupply.com
>  -----------------------



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to