M
Martin Gill
Hi
I'm trying to learn perl, so i've been playing with some of the examples
in the documentation.
I tried creating a simple script with Getopt::Long and Pod::Usage.
When I use pod2usage(-verbose => x) where x is less than two, i don't
get to see my SYNOPSIS block, in fact, i get to see nothing at all.
I thought it was my script, so I copy/pasted the example script into a
new file and ran that. Same result.
A quick search in google revealed some old messages in this group that
talked about line endings being a problem. I use SciTE as my editor, so
it was nice and easy to change the line endings of my file. I tried
CR/LF, LF on its own, and CR on it's own as line endings, but still no luck.
Anyone have any ideas what I am doing wrong?
I've attached the sample code I'm working from to the email.
I'm running:
This is perl, v5.8.4 built for MSWin32-x86-multi-thread
Binary build 810 provided by ActiveState Corp.
Built Jun 1 2004 11:52:21
On Windows XP Pro SP2.
Thanks for any help,
Martin
---------------Code-----------------------
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
I'm trying to learn perl, so i've been playing with some of the examples
in the documentation.
I tried creating a simple script with Getopt::Long and Pod::Usage.
When I use pod2usage(-verbose => x) where x is less than two, i don't
get to see my SYNOPSIS block, in fact, i get to see nothing at all.
I thought it was my script, so I copy/pasted the example script into a
new file and ran that. Same result.
A quick search in google revealed some old messages in this group that
talked about line endings being a problem. I use SciTE as my editor, so
it was nice and easy to change the line endings of my file. I tried
CR/LF, LF on its own, and CR on it's own as line endings, but still no luck.
Anyone have any ideas what I am doing wrong?
I've attached the sample code I'm working from to the email.
I'm running:
This is perl, v5.8.4 built for MSWin32-x86-multi-thread
Binary build 810 provided by ActiveState Corp.
Built Jun 1 2004 11:52:21
On Windows XP Pro SP2.
Thanks for any help,
Martin
---------------Code-----------------------
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