NAME
Opt - Get command line options and their values
DESCRIPTION
This module allows you to read command-line options and their values.
This module can handle any command-line interface.
SYNOPSIS
use Opt;
use strict;
my ($error, $opt1, $opt2, $opt3, @info) = &Opt::GetOpt("-opt1:b, -opt2:s=string2, -opt3:s", "req 1, xor 2 3", @ARGV);
if ($error) {
print "Errors detected in specifying options.\nUsage:<usage string>";
} else {
### Rest of the code
if ($opt1) {
if ($info[1]==1) {
### If the value is a default value
print "Default value for opt2 is taken\n";
} elsif ($info[1]==3) {
### If the value is not default
print "Non-default value as given = $opt2";
}
}
}
INSTALLATION
The module can be installed using the standard Perl procedure:
perl Makefile.PL
make
make test # No tests defined in the version 0.1.0
make install # You may need to be root
make clean # or make realclean
Windows users without a working "make" can get nmake from:
ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe
USAGE
The Synopsis above gives an example of how to use the perl module and the function GetOpt.
In addition, extensive documentation is provided in the perl module itself.
The perl module can be usually found in the path /usr/lib/perl/5.8/ or /usr/lib/perl/5.8.8/ etc.
VERSION
This is the 0.1.0 version distribution of the Opt.pm module
AUTHOR
Balaji Ramasubramanian (balaji.ramasubramanian@gmail.com)
SUPPORT
Of course, I'll welcome e-mails.
And now, I have a website. If you have a question or suggestion,
please let me know.
http://balaji.ramasubramanian.googlepages.com/