isha has asked for the wisdom of the Perl Monks concerning the following question:
&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); }
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: pod2usage does not work for verbose level 1.
by kyle (Abbot) on Jan 29, 2008 at 14:51 UTC | |
Re: pod2usage does not work for verbose level 1.
by Khen1950fx (Canon) on Jan 29, 2008 at 22:43 UTC | |
Re: pod2usage does not work for verbose level 1.
by andreas1234567 (Vicar) on Jan 29, 2008 at 20:28 UTC |