I am calling pod2usage with verbose level 1 when -help is provided (Please run below code on LINUX).
&GetOptions( 'h|help' => \$opt_help,
'man' => sub{ pod2usage({-verbose=>2,
-exitval=>0}); },
'q|quiet' => \$opt_quiet,
'c|config=s' => \@opt_config,
'p|project=s' => \$opt_proj
) || pod2usage(1);
if($opt_help){
print "help---------------\n";
pod2usage(1);
}
But this is not printing the SYNOPSIS secction from the Pod document. I m using embedded pod document.
please help me!
<br
Here is the whole program with POD document.
use strict;
use Getopt::Long;
use Pod::Usage;
my $opt_maxError = 0;
my $opt_quiet = 0;
my $file = "";
my $errors = 0;
my @opt_config;
my $opt_project;
my $opt_help;
my @files = ();
&GetOptions( 'h|help' => \$opt_help,
'man' => sub{ &pod2usage({-verbose=>2,
-exitval=>0}); },
'q|quiet' => \$opt_quiet,
'c|config=s' => \@opt_config,
'p|project=s' => \$opt_project
) || pod2usage(1);
if($opt_help){
print "help---------------\n";
&pod2usage(1);
}
if(@ARGV){
@files = @ARGV;
}
elsif(!@opt_config && !$opt_project){
@files = glob("*.cc *.txt");
}
if(!defined $opt_project){
pod2usage(
-msg => "\n%E, PROJECT DEFINITION FILE DOESN'T EXIST.\n",
-exitval=>1);
}
# take place for all those specified files
if(!@files)
{
pod2usage(
-msg => "\n%E, NO TESTPLAN LISTS FILE.\n",
-exitval=>1);
}
exit;
##########END OF SCRIPT###########
__END__
=head1 NAME
test.pl -- A simple script.
=head1 SYNOPSIS
test.pl [options]
Options:
-h or -help Display help.
-man About the script.
-c <config_name> Configuration name.
-p <path> Path to Project Definition File.
-m <n> or -maxerror <n> Maximum number of errors.
-q or -quiet Do not print errors.
=head1 OPTIONS
=over 8
=item B<-h|help>
Print a brief help message and exits.
=item B<-man>
Prints the manual page and exits.
=item B<-c> <name>
Configuration name.
i.e: -c tg,mpg
or
-c tg -c mpg
=item B<-p> <path>
Path to Project Definition File.
=item B<-m|maxerror> <number>
Maximum number of errors.
=item B<-q|quiet>
Setting this switch will not print any error on stderr.
=back
=head1 DESCRIPTION
The script parses the feature file & print errors.