Hi all,

I've been reading this least for a few days, and I've not seen a link to a
FAQ go by yet, so I haven't read that.  I guess the first and most important
question is:  where's the FAQ?  :)

The second question is, why can I get no output from Pod::Usage?  I've tried
copying the little sample program verbatim out of the Pod::Usage man/pod
page, and it too generates no output.  I originally thought it was because I
was running perl under cygwin on Win2K, so I copied the code to a Solaris
2.8 box and tried it there, again to no avail.  Am I completely missing
something, perhaps the point of Pod::Usage?

Here's the script I've tested with:

#!/usr/local/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);
pod2usage(1) 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.

=cut

Reply via email to