getopt plus
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 403
Getopt::Plus 0.98
Getopt::Plus is a Perl module with options wrapper with standard options, help system and more. more>>
Getopt::Plus is a Perl module with options wrapper with standard options, help system and more.
FILE_SIZE_HUMAN
Map from file size in bytes to human name, as hashref, keys being name (full name, lowercase, no trailing s) and abbrev (one/two-letter abbreviation).
Option Types
Permissable values to the type field of an option specifier.
OPT_FLOAT
OPT_INT
OPT_STRING
OPT_FDLEVEL
OPT_BOOLEAN
Error Codes
ERR_OK
Not an error at all. Hence the name.
ERR_ABNORMAL
Not so much an error as a non-erroneous circumstance worthy of signalling, e.g., grep finding no matches.
ERR_UTILITY
Again, not really an error, rather a utility function being called --- e.g., the --help or --version. This gets an error code because it is almost certainly an error to call from batch scripts.
ERR_USAGE
The program was called wrong.
ERR_IO_READ
Some problem reading from disk or network (system read).
ERR_IO_WRITE
Some problem writing to disk or network (system write).
ERR_DB_READ
Some problem reading from db or similar (application read).
ERR_DB_WRITE
Some problem writing to db or similar (application write).
ERR_EXTERNAL
Some problem with an external application.
ERR_INTERNAL
An internal logic error (the sort of thing that should never happen, but has been caught by an internal assertion or sanity check).
ERR_INPUT
Some problem with the input file (which was read fine, but contains bad data).
<<lessFILE_SIZE_HUMAN
Map from file size in bytes to human name, as hashref, keys being name (full name, lowercase, no trailing s) and abbrev (one/two-letter abbreviation).
Option Types
Permissable values to the type field of an option specifier.
OPT_FLOAT
OPT_INT
OPT_STRING
OPT_FDLEVEL
OPT_BOOLEAN
Error Codes
ERR_OK
Not an error at all. Hence the name.
ERR_ABNORMAL
Not so much an error as a non-erroneous circumstance worthy of signalling, e.g., grep finding no matches.
ERR_UTILITY
Again, not really an error, rather a utility function being called --- e.g., the --help or --version. This gets an error code because it is almost certainly an error to call from batch scripts.
ERR_USAGE
The program was called wrong.
ERR_IO_READ
Some problem reading from disk or network (system read).
ERR_IO_WRITE
Some problem writing to disk or network (system write).
ERR_DB_READ
Some problem reading from db or similar (application read).
ERR_DB_WRITE
Some problem writing to db or similar (application write).
ERR_EXTERNAL
Some problem with an external application.
ERR_INTERNAL
An internal logic error (the sort of thing that should never happen, but has been caught by an internal assertion or sanity check).
ERR_INPUT
Some problem with the input file (which was read fine, but contains bad data).
Download (0.046MB)
Added: 2006-11-02 License: Perl Artistic License Price:
1087 downloads
Getopt::Lucid 0.16
Getopt::Lucid is a clear, readable syntax for command line processing. more>>
Getopt::Lucid is a clear, readable syntax for command line processing.
SYNOPSIS
use Getopt::Lucid qw( :all );
# basic option specifications with aliases
@specs = (
Switch("version|V"),
Counter("verbose|v"),
Param("config|C"),
List("lib|l|I"),
Keypair("define"),
Switch("help|h")
);
$opt = Getopt::Lucid->getopt( @specs );
$verbosity = $opt->get_verbose;
@libs = $opt->get_lib;
%defs = $opt->get_define;
%all_options = $opt->options;
# advanced option specifications
@adv_spec = (
Param("input")->required, # required
Param("mode")->default("tcp"), # defaults
Param("host")->needs("port"), # dependencies
Param("port", qr/d+/ )->required, # regex validation
Param("config", sub { -r } ), # custom validation
Param("help")->anycase, # case insensitivity
);
# example with a config file
use Config::Std;
if ( -r $opt->get_config ) {
read_config( $opt->get_config() => my %config_hash );
$opt->merge_defaults( $config_hash{} );
}
The goal of this module is providing good code readability and clarity of intent for command-line option processing. While readability is a subjective standard, Getopt::Lucid relies on a more verbose, plain-English option specification as compared against the more symbolic approach of Getopt::Long.
Main features:
- Five option types: switches, counters, parameters, lists, and keypairs
- Three option styles: long, short (including bundled), and bare (without dashes)
- Specification of defaults, required options and option dependencies
- Validation of options with regexes or subroutines
- Negation of options on the command line
- Support for parsing any array, not just the default @ARGV
- Incorporation of external defaults (e.g. from a config file) with user control of precedence
<<lessSYNOPSIS
use Getopt::Lucid qw( :all );
# basic option specifications with aliases
@specs = (
Switch("version|V"),
Counter("verbose|v"),
Param("config|C"),
List("lib|l|I"),
Keypair("define"),
Switch("help|h")
);
$opt = Getopt::Lucid->getopt( @specs );
$verbosity = $opt->get_verbose;
@libs = $opt->get_lib;
%defs = $opt->get_define;
%all_options = $opt->options;
# advanced option specifications
@adv_spec = (
Param("input")->required, # required
Param("mode")->default("tcp"), # defaults
Param("host")->needs("port"), # dependencies
Param("port", qr/d+/ )->required, # regex validation
Param("config", sub { -r } ), # custom validation
Param("help")->anycase, # case insensitivity
);
# example with a config file
use Config::Std;
if ( -r $opt->get_config ) {
read_config( $opt->get_config() => my %config_hash );
$opt->merge_defaults( $config_hash{} );
}
The goal of this module is providing good code readability and clarity of intent for command-line option processing. While readability is a subjective standard, Getopt::Lucid relies on a more verbose, plain-English option specification as compared against the more symbolic approach of Getopt::Long.
Main features:
- Five option types: switches, counters, parameters, lists, and keypairs
- Three option styles: long, short (including bundled), and bare (without dashes)
- Specification of defaults, required options and option dependencies
- Validation of options with regexes or subroutines
- Negation of options on the command line
- Support for parsing any array, not just the default @ARGV
- Incorporation of external defaults (e.g. from a config file) with user control of precedence
Download (0.039MB)
Added: 2007-01-16 License: Perl Artistic License Price:
1012 downloads
Tk::Getopt 0.49
Tk::Getopt is a user configuration window for Tk with interface to Getopt::Long. more>>
Tk::Getopt is a user configuration window for Tk with interface to Getopt::Long.
SYNOPSIS
use Tk::Getopt;
@opttable = ([opt1, =s, default], [opt2, !, 1], ...);
$opt = new Tk::Getopt(-opttable => @opttable,
-options => %options,
-filename => "$ENV{HOME}/.options");
$opt->set_defaults; # set default values
$opt->load_options; # configuration file
$opt->get_options; # command line
$opt->process_options; # process callbacks, check restrictions ...
print $options->{opt1}, $options->{opt2} ...;
...
$top = new MainWindow;
$opt->option_editor($top);
or using a Getopt::Long-like interface
$opt = new Tk::Getopt(-getopt => [help => $HELP,
file:s => $FILE,
foo! => $FOO,
num:i => $NO,
]);
or an alternative Getopt::Long interface
%optctl = (foo => $foo,
bar => $bar);
$opt = new Tk::Getopt(-getopt => [%optctl, "foo!", "bar=s"]);
Tk::Getopt provides an interface to access command line options via Getopt::Long and editing with a graphical user interface via a Tk window.
Unlike Getopt::Long, this package uses a object oriented interface, so you have to create a new Tk::Getopt object with new. Unlike other packages in the Tk hierarchy, this package does not define a Tk widget. The graphical interface is calles by the method option_editor.
After creating an object with new, you can parse command line options by calling get_options. This method calls itself Getopt::Long::GetOptions.
<<lessSYNOPSIS
use Tk::Getopt;
@opttable = ([opt1, =s, default], [opt2, !, 1], ...);
$opt = new Tk::Getopt(-opttable => @opttable,
-options => %options,
-filename => "$ENV{HOME}/.options");
$opt->set_defaults; # set default values
$opt->load_options; # configuration file
$opt->get_options; # command line
$opt->process_options; # process callbacks, check restrictions ...
print $options->{opt1}, $options->{opt2} ...;
...
$top = new MainWindow;
$opt->option_editor($top);
or using a Getopt::Long-like interface
$opt = new Tk::Getopt(-getopt => [help => $HELP,
file:s => $FILE,
foo! => $FOO,
num:i => $NO,
]);
or an alternative Getopt::Long interface
%optctl = (foo => $foo,
bar => $bar);
$opt = new Tk::Getopt(-getopt => [%optctl, "foo!", "bar=s"]);
Tk::Getopt provides an interface to access command line options via Getopt::Long and editing with a graphical user interface via a Tk window.
Unlike Getopt::Long, this package uses a object oriented interface, so you have to create a new Tk::Getopt object with new. Unlike other packages in the Tk hierarchy, this package does not define a Tk widget. The graphical interface is calles by the method option_editor.
After creating an object with new, you can parse command line options by calling get_options. This method calls itself Getopt::Long::GetOptions.
Download (0.022MB)
Added: 2006-11-03 License: Perl Artistic License Price:
1085 downloads
Getopt::OO 0.07
Getopt::OO is an object oriented command line parser. more>>
Getopt::OO is an object oriented command line parser. It handles short, long and multi (--x ... -) value options. Getopt::OO module also incorporates help for options to simplify generation of usage statements.
SYNOPSIS
use Getopt::OO qw(Debug Verbose);
my ($handle) = Getopt::OO->new(@ARGV,
-d => {
help => turn on debug output,
callback => sub {Debug(1); 0},
},
-o => {
help => another option.,
},
-f => {
help => option that expects one more value.,
n_values => 1,
},
--long {
help => long option
},
--multiple_ => {
help => [
"Everything between --multiple_values and - is",
"an value for this options",
],
multi_value => 1,
multiple= => 1, # Can happen more than once on command line.
},
other_values => {
help => file_1 ... file_n,
multi_value => 1,
},
);
if ($handle->Values()) {
Debug("You will get output if -d was on command line");
if (my $f = handle->Values(-f)) {
print "Got $f with the -f value.n";
}
}
else {
print "No options found on command line.n";
}
Getopt::OO is an object oriented tool for parsing command line arguments. It expects a reference to the input arguments and uses a perl hash to describe how the command line arguments should be parsed. Note that by parsed, we mean what options expect values, etc. We check to make sure values exist on the command line as necessary -- nothing else. The caller is responsible for making sure that a value that he knows should be a file exists, is writable, or whatever.
Command line arguments can be broken into two distinct types: options and values that are associated with these options. In windows, options often start with a / but sometimes with a -, but in unix they almost universally start with a -. For this module options start with a -. We support two types of options: the short single dashed options and the long double dashed options.
The difference between these two is that with this module the short options can be combined into a single option, but the long options can not. For example, most of us will be familiar with the tar -xvf file command which can also be expressed as -x -v -f file. Long options can not be combined this way, so --help for example must always stand by itself.
The input template expects the option names as its keys. For instance if you were expecting -xv --hello as possible command line options, the keys for your template hash would be -x, -v, and --hello.
<<lessSYNOPSIS
use Getopt::OO qw(Debug Verbose);
my ($handle) = Getopt::OO->new(@ARGV,
-d => {
help => turn on debug output,
callback => sub {Debug(1); 0},
},
-o => {
help => another option.,
},
-f => {
help => option that expects one more value.,
n_values => 1,
},
--long {
help => long option
},
--multiple_ => {
help => [
"Everything between --multiple_values and - is",
"an value for this options",
],
multi_value => 1,
multiple= => 1, # Can happen more than once on command line.
},
other_values => {
help => file_1 ... file_n,
multi_value => 1,
},
);
if ($handle->Values()) {
Debug("You will get output if -d was on command line");
if (my $f = handle->Values(-f)) {
print "Got $f with the -f value.n";
}
}
else {
print "No options found on command line.n";
}
Getopt::OO is an object oriented tool for parsing command line arguments. It expects a reference to the input arguments and uses a perl hash to describe how the command line arguments should be parsed. Note that by parsed, we mean what options expect values, etc. We check to make sure values exist on the command line as necessary -- nothing else. The caller is responsible for making sure that a value that he knows should be a file exists, is writable, or whatever.
Command line arguments can be broken into two distinct types: options and values that are associated with these options. In windows, options often start with a / but sometimes with a -, but in unix they almost universally start with a -. For this module options start with a -. We support two types of options: the short single dashed options and the long double dashed options.
The difference between these two is that with this module the short options can be combined into a single option, but the long options can not. For example, most of us will be familiar with the tar -xvf file command which can also be expressed as -x -v -f file. Long options can not be combined this way, so --help for example must always stand by itself.
The input template expects the option names as its keys. For instance if you were expecting -xv --hello as possible command line options, the keys for your template hash would be -x, -v, and --hello.
Download (0.019MB)
Added: 2006-10-28 License: Perl Artistic License Price:
1091 downloads
Getopt::Simple 1.48
Getopt::Simple is a Perl module that provides a simple wrapper around Getopt::Long. more>>
Getopt::Simple is a Perl module that provides a simple wrapper around Getopt::Long.
SYNOPSIS
use Getopt::Simple;
# Or ...
# use Getopt::Simple qw($switch);
my($options) =
{
help =>
{
type => ,
env => -,
default => ,
# verbose => , # Not needed on every key.
order => 1,
},
username =>
{
type => =s, # As per Getopt::Long.
env => $USER, # Help text.
default => $ENV{USER} || RonSavage, # In case $USER is undef.
verbose => Specify the username on the remote machine,
order => 3, # Help text sort order.
},
password =>
{
type => =s,
env => -,
default => password,
verbose => Specify the password on the remote machine,
order => 4,
},
};
my($option) = Getopt::Simple -> new();
if (! $option -> getOptions($options, "Usage: testSimple.pl [options]") )
{
exit(-1); # Failure.
}
print "username: $$option{switch}{username}. n";
print "password: $$option{switch}{password}. n";
# Or, after use Getopt::Simple qw($switch); ...
# print "username: $$switch{username}. n";
# print "password: $$switch{password}. n";
Getopt::Simple is a pure Perl module.
The Getopt::Simple module provides a simple way of specifying:
Command line switches
Type information for switch values
Default values for the switches
Help text per switch
<<lessSYNOPSIS
use Getopt::Simple;
# Or ...
# use Getopt::Simple qw($switch);
my($options) =
{
help =>
{
type => ,
env => -,
default => ,
# verbose => , # Not needed on every key.
order => 1,
},
username =>
{
type => =s, # As per Getopt::Long.
env => $USER, # Help text.
default => $ENV{USER} || RonSavage, # In case $USER is undef.
verbose => Specify the username on the remote machine,
order => 3, # Help text sort order.
},
password =>
{
type => =s,
env => -,
default => password,
verbose => Specify the password on the remote machine,
order => 4,
},
};
my($option) = Getopt::Simple -> new();
if (! $option -> getOptions($options, "Usage: testSimple.pl [options]") )
{
exit(-1); # Failure.
}
print "username: $$option{switch}{username}. n";
print "password: $$option{switch}{password}. n";
# Or, after use Getopt::Simple qw($switch); ...
# print "username: $$switch{username}. n";
# print "password: $$switch{password}. n";
Getopt::Simple is a pure Perl module.
The Getopt::Simple module provides a simple way of specifying:
Command line switches
Type information for switch values
Default values for the switches
Help text per switch
Download (0.008MB)
Added: 2006-11-03 License: Perl Artistic License Price:
1085 downloads
Getopt::Helpful 0.04
Getopt::Helpful is an integrated option hash / help messages. more>>
Getopt::Helpful is an integrated option hash / help messages.
STATE
This module is still under development, but is being publish on CPAN to satisfy some code which depends on it. The interface may change in a future version and some of the functionality is not yet complete.
SYNOPSIS
This module provides methods which integrate help messages into a Getopt::Long option spec. This gathers documentation and declaration into one place and allows you to utilize perl code to state the default values of options in your online help messages (helping you utilize the single-point-of-truth principle.)
Additionally, it provides DWIM methods (Get) which allow you to cut some standard error-checking code from your scripts. There is even a handy usage() method which eliminates that silly block of code from the beginning.
#!/usr/bin/perl
use warnings;
use strict;
use Getopt::Helpful;
my $var1 = "default";
my $req_arg;
# declare this as our or $main::verbose
our $verbose = 0;
# every option must be passed into the constructor...
my $hopt = Getopt::Helpful->new(
usage => CALLER [options],
[
var=s, $default,
,
"setting for $var1 (default: $var1)"
],
[
a|arg, $req_arg,
,
required argument
],
+verbose,
+help,
);
# call GetOptions() behind the scenes (with error-checking)
$hopt->Get();
$req_arg or ($req_arg = shift);
# usage() called with a message results in non-zero exit code
$req_arg or $hopt->usage(missing required argument);
$verbose and warn "doing stuff nown";
# now do stuff...
<<lessSTATE
This module is still under development, but is being publish on CPAN to satisfy some code which depends on it. The interface may change in a future version and some of the functionality is not yet complete.
SYNOPSIS
This module provides methods which integrate help messages into a Getopt::Long option spec. This gathers documentation and declaration into one place and allows you to utilize perl code to state the default values of options in your online help messages (helping you utilize the single-point-of-truth principle.)
Additionally, it provides DWIM methods (Get) which allow you to cut some standard error-checking code from your scripts. There is even a handy usage() method which eliminates that silly block of code from the beginning.
#!/usr/bin/perl
use warnings;
use strict;
use Getopt::Helpful;
my $var1 = "default";
my $req_arg;
# declare this as our or $main::verbose
our $verbose = 0;
# every option must be passed into the constructor...
my $hopt = Getopt::Helpful->new(
usage => CALLER [options],
[
var=s, $default,
,
"setting for $var1 (default: $var1)"
],
[
a|arg, $req_arg,
,
required argument
],
+verbose,
+help,
);
# call GetOptions() behind the scenes (with error-checking)
$hopt->Get();
$req_arg or ($req_arg = shift);
# usage() called with a message results in non-zero exit code
$req_arg or $hopt->usage(missing required argument);
$verbose and warn "doing stuff nown";
# now do stuff...
Download (0.011MB)
Added: 2006-10-28 License: Perl Artistic License Price:
1091 downloads
Getopt::Long 2.36
Getopt::Long is an extended processing of command line options. more>>
Getopt::Long is an extended processing of command line options.
SYNOPSIS
use Getopt::Long;
my $data = "file.dat";
my $length = 24;
my $verbose;
$result = GetOptions ("length=i" => $length, # numeric
"file=s" => $data, # string
"verbose" => $verbose); # flag
The Getopt::Long module implements an extended getopt function called GetOptions(). This function adheres to the POSIX syntax for command line options, with GNU extensions.
In general, this means that options have long names instead of single letters, and are introduced with a double dash "--". Support for bundling of command line options, as was the case with the more traditional single-letter approach, is provided but not enabled by default.
<<lessSYNOPSIS
use Getopt::Long;
my $data = "file.dat";
my $length = 24;
my $verbose;
$result = GetOptions ("length=i" => $length, # numeric
"file=s" => $data, # string
"verbose" => $verbose); # flag
The Getopt::Long module implements an extended getopt function called GetOptions(). This function adheres to the POSIX syntax for command line options, with GNU extensions.
In general, this means that options have long names instead of single letters, and are introduced with a double dash "--". Support for bundling of command line options, as was the case with the more traditional single-letter approach, is provided but not enabled by default.
Download (0.040MB)
Added: 2007-08-10 License: Perl Artistic License Price:
806 downloads
Getopt::Tiny 1.02
Getopt::Tiny is yet another command line argument parsing module. more>>
Getopt::Tiny is yet another command line argument parsing module.
SYNOPSIS
use Getopt::Tiny;
my $arg = default value;
my @list;
my %hash;
my $flag;
my %set;
# begin usage info
my (%flags) = (
argx => $arg, # set a parameter
listx => @list, # fill in a list
hashx => %hash, # set key/value pairs
);
my (%switches) = (
flagx => $flag, # on or off
}
# end usage info
getopt(@ARGV, %flags, %switches, $what_comes_after);
Getopt::Tiny::usage(__FILE__, %flags, %switches, files);
or
use Getopt::Tiny;
%flags = ...
%switches = ...
getopt()
Getopt::Tiny::usage();
Getopt::Tiny is yet another argument parsing module. The results of the argument parsing are stored by using references that were provided to getopt(). Usage information is automatically generated. Getopt::Tiny expects all arguments to be switches -- no trailing list of files.
Getopt::Tiny can either call an existing usage() function or it can use its own builtin one. It trys to use the existing one by default. If that fails, it will use its own. It figures out how to describe things by reading the file where call to getopt() originated. In the file where getopt is called, the following two lines must appear exactly as written here:
# begin usage info
# end usage info
Between these two lines, lines that match the pattern of:
someflag => ... # a description
will be noticed and used to document each flag individually.
The usage() function of Getopt::Tiny can be called on its own. It can either have its arguments given to it explicitly or it can default them like getopt().
If a usage function is provided, it will be called with one parameter: the argument that didnt parse.
Getopt::Tiny can be used in situation where it is expected to parse the entire command line and in situations where there will be command line args left over. When Getopt::Tiny is expected to parse the whole command line, do not include a forth argument to getopt(). When it is expected that there will be stuff left over, pass a description of what should be left over as the forth argument to getopt().
<<lessSYNOPSIS
use Getopt::Tiny;
my $arg = default value;
my @list;
my %hash;
my $flag;
my %set;
# begin usage info
my (%flags) = (
argx => $arg, # set a parameter
listx => @list, # fill in a list
hashx => %hash, # set key/value pairs
);
my (%switches) = (
flagx => $flag, # on or off
}
# end usage info
getopt(@ARGV, %flags, %switches, $what_comes_after);
Getopt::Tiny::usage(__FILE__, %flags, %switches, files);
or
use Getopt::Tiny;
%flags = ...
%switches = ...
getopt()
Getopt::Tiny::usage();
Getopt::Tiny is yet another argument parsing module. The results of the argument parsing are stored by using references that were provided to getopt(). Usage information is automatically generated. Getopt::Tiny expects all arguments to be switches -- no trailing list of files.
Getopt::Tiny can either call an existing usage() function or it can use its own builtin one. It trys to use the existing one by default. If that fails, it will use its own. It figures out how to describe things by reading the file where call to getopt() originated. In the file where getopt is called, the following two lines must appear exactly as written here:
# begin usage info
# end usage info
Between these two lines, lines that match the pattern of:
someflag => ... # a description
will be noticed and used to document each flag individually.
The usage() function of Getopt::Tiny can be called on its own. It can either have its arguments given to it explicitly or it can default them like getopt().
If a usage function is provided, it will be called with one parameter: the argument that didnt parse.
Getopt::Tiny can be used in situation where it is expected to parse the entire command line and in situations where there will be command line args left over. When Getopt::Tiny is expected to parse the whole command line, do not include a forth argument to getopt(). When it is expected that there will be stuff left over, pass a description of what should be left over as the forth argument to getopt().
Download (0.005MB)
Added: 2007-04-11 License: Perl Artistic License Price:
926 downloads
Getopt::Popt 0.02
Getopt::Popt is a Perl interface to the popt(3) library. more>>
Getopt::Popt is a Perl interface to the popt(3) library.
SYNOPSIS
use Getopt::Popt qw(:all);
# setup the options array
push @options,new Getopt::Popt::Option(
longName => "long",
shortName => "l",
argInfo => POPT_ARG_STRING,
arg => $qux,
val => $val);
# or, if youre lazy, have Getopt::Popt automagically do the new()
push @options, { shortName => s,
argInfo => POPT_ARG_NONE,
arg => $quux,
val => s
};
# "val"s can be a single character or an integer:
push @options, { longName => xor,
argInfo => POPT_ARG_VAL | POPT_ARGFLAG_XOR,
arg => $quuux,
val => 0xbadf00d # integer
},
Enable automatic help/usage messages (--help or --usage):
push @options, POPT_AUTOHELP;
Create a new popt context:
$popt = new Getopt::Popt(name => $alias_name,
argv => @ARGV,
options => @options,
flags => $flags);
Setup option aliases:
# load some aliases
$popt->readDefaultConfig();
$popt->readConfigFile("/path/to/aliases");
# add your own alias
$alias = new Getopt::Popt::Alias(longName => "taco",
argv => [qw(--flavored --kisses)]);
$popt->addAlias($alias, $alias_flags);
Load options as you would in C:
# loop through the options, using the popt C way:
while(($rc = $popt->getNextOpt()) > 0) {
...
# one way to get the arg val
$bork = $popt->getOptArg();
...
# stuff some args
$popt->stuffArgs(qw(-q -u -x));
...
# start over
$popt->resetContext();
...
}
And handle errors as you would in C:
$errstr = $popt->strerror($rc);
$badopt = $popt->badOption($rc,$badopt_flags);
Or try the new perly way:
eval {
while(defined($val = $popt->getNextOptChar())) {
^^^^-- note!
# $val is a Scalar::Util::dualvar:
if($val eq "c") { # getArgs();
<<lessSYNOPSIS
use Getopt::Popt qw(:all);
# setup the options array
push @options,new Getopt::Popt::Option(
longName => "long",
shortName => "l",
argInfo => POPT_ARG_STRING,
arg => $qux,
val => $val);
# or, if youre lazy, have Getopt::Popt automagically do the new()
push @options, { shortName => s,
argInfo => POPT_ARG_NONE,
arg => $quux,
val => s
};
# "val"s can be a single character or an integer:
push @options, { longName => xor,
argInfo => POPT_ARG_VAL | POPT_ARGFLAG_XOR,
arg => $quuux,
val => 0xbadf00d # integer
},
Enable automatic help/usage messages (--help or --usage):
push @options, POPT_AUTOHELP;
Create a new popt context:
$popt = new Getopt::Popt(name => $alias_name,
argv => @ARGV,
options => @options,
flags => $flags);
Setup option aliases:
# load some aliases
$popt->readDefaultConfig();
$popt->readConfigFile("/path/to/aliases");
# add your own alias
$alias = new Getopt::Popt::Alias(longName => "taco",
argv => [qw(--flavored --kisses)]);
$popt->addAlias($alias, $alias_flags);
Load options as you would in C:
# loop through the options, using the popt C way:
while(($rc = $popt->getNextOpt()) > 0) {
...
# one way to get the arg val
$bork = $popt->getOptArg();
...
# stuff some args
$popt->stuffArgs(qw(-q -u -x));
...
# start over
$popt->resetContext();
...
}
And handle errors as you would in C:
$errstr = $popt->strerror($rc);
$badopt = $popt->badOption($rc,$badopt_flags);
Or try the new perly way:
eval {
while(defined($val = $popt->getNextOptChar())) {
^^^^-- note!
# $val is a Scalar::Util::dualvar:
if($val eq "c") { # getArgs();
Download (0.021MB)
Added: 2007-03-07 License: Perl Artistic License Price:
963 downloads
edonkey plus 0.01
edonkey plus is a free program peer to peer for the peer to peer network edonkey 2000,overnet etc. more>>
edonkey plus is a free program peer to peer (P2P) for the peer to peer network Edonkey 2000, Overnet etc.
Basic aMule Tips
- NEVER run aMule as root.
- If you are behind a firewall or router, be sure that the ports have been opened. The default ports are 4662 (TCP). 4665 (UDP) and 4672 (UDP). If these are blocked, you will receive a "LowID" which results in fewer available sources for the files you are downloading.
- Obtain an appropriate server.met: e.g., if you are a dialup, using a large server list is not appropiate.
- Set your temp and shared directories in Preferences->Directories
- To recursively select a certain directory, right-click over it.
- You should *NOT* share
- Your temp download directory!
- Your /etc directory
- Probably not your /var, /lib, /boot, or /usr directory
- Certainly make sure that any really confidential files (password files, private SSH keys, credit card numbers :) are *not* shared. So generally do not share your entire home directory, although you might want to share some files or directories in it.
- Remember that you get certain download priveledges with those clients (aMule, eMule, etc users) to whom you upload files, in the form of reduced queue waits.
- Please note that compilation with optimizations is supported. However, if you pull a Gentoo, we will probably just tell you to recompile aMule and/or your system with sane compiler-flags before we will attempt to address the problem.
<<lessBasic aMule Tips
- NEVER run aMule as root.
- If you are behind a firewall or router, be sure that the ports have been opened. The default ports are 4662 (TCP). 4665 (UDP) and 4672 (UDP). If these are blocked, you will receive a "LowID" which results in fewer available sources for the files you are downloading.
- Obtain an appropriate server.met: e.g., if you are a dialup, using a large server list is not appropiate.
- Set your temp and shared directories in Preferences->Directories
- To recursively select a certain directory, right-click over it.
- You should *NOT* share
- Your temp download directory!
- Your /etc directory
- Probably not your /var, /lib, /boot, or /usr directory
- Certainly make sure that any really confidential files (password files, private SSH keys, credit card numbers :) are *not* shared. So generally do not share your entire home directory, although you might want to share some files or directories in it.
- Remember that you get certain download priveledges with those clients (aMule, eMule, etc users) to whom you upload files, in the form of reduced queue waits.
- Please note that compilation with optimizations is supported. However, if you pull a Gentoo, we will probably just tell you to recompile aMule and/or your system with sane compiler-flags before we will attempt to address the problem.
Download (4.3MB)
Added: 2007-07-09 License: GPL (GNU General Public License) Price:
844 downloads
Getopt::EvaP 2.3.5
Getopt::EvaP is a Perl module to evaluate Perl command line parameters. more>>
Getopt::EvaP is a Perl module to evaluate Perl command line parameters.
SYNOPSIS
use vars qw/@PDT @MM %OPT/;
use Getopt::EvaP;
EvaP @PDT, @MM, %OPT;
EXPORT
use Getopt::EvaP exports the subs EvaP and EvaP_PAC into your name space.
@PDT is the Parameter Description Table, which is a reference to a list of strings describing the command line parameters, aliases, types and default values. @MM is the Message Module, which is also a reference to a list of strings describing the command and its parameters. %OPT is an optional hash reference where Evaluate Parameters should place its results. If specified, the historical behaviour of modifying the calling routines namespace by storing option values in %Options, %options and $opt* is disabled.
<<lessSYNOPSIS
use vars qw/@PDT @MM %OPT/;
use Getopt::EvaP;
EvaP @PDT, @MM, %OPT;
EXPORT
use Getopt::EvaP exports the subs EvaP and EvaP_PAC into your name space.
@PDT is the Parameter Description Table, which is a reference to a list of strings describing the command line parameters, aliases, types and default values. @MM is the Message Module, which is also a reference to a list of strings describing the command and its parameters. %OPT is an optional hash reference where Evaluate Parameters should place its results. If specified, the historical behaviour of modifying the calling routines namespace by storing option values in %Options, %options and $opt* is disabled.
Download (0.051MB)
Added: 2006-11-02 License: Perl Artistic License Price:
1087 downloads
translate plus 1.0
translate plus is a facelift, update, and re-code of the Translate theme from Suslik. more>>
translate plus is a facelift, update, and re-code of the Translate theme from Suslik. This version utilises a new technique for coding input boxes for Superkaramba, which was written (again) by Suslik.
This new technique allows for a transparent input box, which allows for a much nicer looking theme
<<lessThis new technique allows for a transparent input box, which allows for a much nicer looking theme
Download (0.058MB)
Added: 2007-04-17 License: GPL (GNU General Public License) Price:
924 downloads
Getopt::ExPar 0.01
Getopt::ExPar contains extended parameters command line parser. more>>
Getopt::ExPar contains extended parameters command line parser.
SYNOPSIS
use Getopt::ExPar;
my(@PDT, @MM, %OPT);
ExPar @PDT, @MM, $OPT;
EXPORT
use Getopt::ExPar exports the sub ExPar into your name space.
ExPar is a perl5 module used to parse command line parameters. This package uses the @PDT, Parameter Description Table, and the @MM, Message Module, to return %OPT which is a hash reference containing the command line option data. The function of Getopt::ExPar is based on Getopt::EvaP, created by Stephen O. Lidie.
Introduction
The ExPar function parses a perl command line. Using the option definitions in the @PDT, argument types are checked and the arguments themselves may be checked against a specified range or pattern. By using both @PDT and @MM, several types of help may be retured to the user. ExPar handles command lines with this format:
command [-parameters] [file_list]
where any parameters and file_list are optional.
Parameter Description Table (PDT) Syntax
Here is the PDT syntax. Optional constructs are enclosed in [], and the | character separates possible values in a list.
PDT [program_name, alias]
[parameter_name[, alias]: type [pattern | range] [ = [default_variable,] default_value]]
PDTEND [flag_list]
flag_list is one or more of the following flags: optional_file_list | required_file_list | no_file_list: specifies condition of list of files at end of command line. (only one of these may be specified) abbreviations: allows for abbreviations of commands or aliases as long as enough of the command is given to make it distinguishable from all others. If not, a message is printed so the user may be more specific. switchglomming: allows for multiple single-letter switch options to be specified as single option (must be first option). pdt_warnings: for debugging a @PDT, it prints out messages that are not necessarily errors, like inconsistent number of default values in a list, etc.
The default_variable is an environment variable - see the section Usage Notes for complete details.
So, the simplest possible PDT would be:
PDT
PDTEND
This PDT would simply define a -help switch for the command, but is rather useless.
A typical PDT would look more like this:
PDT frog
number, n: integer = 1
chars, c: string = "default_string"
PDTEND no_file_list
This PDT, for command frog, defines two parameters, number (or n), of type integer with a default value of 1, and chars (or c), of type string with a default value of "default_string". The PDTEND no_file_list indicator indicates that no trailing file_list can appear on the command line. Of course, the -help switch is defined automatically.
Each of these options may be further refined by using a range and a pattern, respectively:
PDT frog
number, n: integer (((#100, the # is implied. Other simple conditions are < and == (a single = is accepted as ==, not an assignment). Ex: This condition: (#>10, #<<less
SYNOPSIS
use Getopt::ExPar;
my(@PDT, @MM, %OPT);
ExPar @PDT, @MM, $OPT;
EXPORT
use Getopt::ExPar exports the sub ExPar into your name space.
ExPar is a perl5 module used to parse command line parameters. This package uses the @PDT, Parameter Description Table, and the @MM, Message Module, to return %OPT which is a hash reference containing the command line option data. The function of Getopt::ExPar is based on Getopt::EvaP, created by Stephen O. Lidie.
Introduction
The ExPar function parses a perl command line. Using the option definitions in the @PDT, argument types are checked and the arguments themselves may be checked against a specified range or pattern. By using both @PDT and @MM, several types of help may be retured to the user. ExPar handles command lines with this format:
command [-parameters] [file_list]
where any parameters and file_list are optional.
Parameter Description Table (PDT) Syntax
Here is the PDT syntax. Optional constructs are enclosed in [], and the | character separates possible values in a list.
PDT [program_name, alias]
[parameter_name[, alias]: type [pattern | range] [ = [default_variable,] default_value]]
PDTEND [flag_list]
flag_list is one or more of the following flags: optional_file_list | required_file_list | no_file_list: specifies condition of list of files at end of command line. (only one of these may be specified) abbreviations: allows for abbreviations of commands or aliases as long as enough of the command is given to make it distinguishable from all others. If not, a message is printed so the user may be more specific. switchglomming: allows for multiple single-letter switch options to be specified as single option (must be first option). pdt_warnings: for debugging a @PDT, it prints out messages that are not necessarily errors, like inconsistent number of default values in a list, etc.
The default_variable is an environment variable - see the section Usage Notes for complete details.
So, the simplest possible PDT would be:
PDT
PDTEND
This PDT would simply define a -help switch for the command, but is rather useless.
A typical PDT would look more like this:
PDT frog
number, n: integer = 1
chars, c: string = "default_string"
PDTEND no_file_list
This PDT, for command frog, defines two parameters, number (or n), of type integer with a default value of 1, and chars (or c), of type string with a default value of "default_string". The PDTEND no_file_list indicator indicates that no trailing file_list can appear on the command line. Of course, the -help switch is defined automatically.
Each of these options may be further refined by using a range and a pattern, respectively:
PDT frog
number, n: integer (((#100, the # is implied. Other simple conditions are < and == (a single = is accepted as ==, not an assignment). Ex: This condition: (#>10, #<<less
Download (0.018MB)
Added: 2007-08-07 License: Perl Artistic License Price:
808 downloads
Getopt::Fancy 0.02
Getopt::Fancy is an object approach to handling command line options, focusing on end user happiness. more>>
Getopt::Fancy is an object approach to handling command line options, focusing on end user happiness.
SYNOPSIS
use Getopt::Fancy;
my $opts = Getopt::Fancy->new();
$opts->add("db", GT => "=s",
EX => " ",
DESC => "The database to dump. Leave unset for all databases.",
DEF => "teen_titans",
ALLOWED => ["--all-databases", "mydb", "teen_titans"],
REGEX => ^[a-zA-Z0-9_]+$,
REQ => 0,
SECTION => "Required DB Params");
# Allow just printing out of set options
$opts->add("check_args", DESC => "Just print all the options", SECTION => "Misc Params");
# Allow user to specify list of options s/he needs help with
$opts->add("help", GT => ":s@", EX => "[option1,option2..]",
DESC => "Give option names and itll print the help for just those options, otherwise all.",
SECTION=>"Misc Params", COMMAS=>1);
# Get the command line options
my $error_msg = $opts->get_options();
print_usage($error_msg) if $error_msg;
print "Will dump this database: $opts->{db} n";
print "User wants help information on these: " . join(", ", @{$opts->{help}}) . "n" if ($opts->{help});
print_usage() if $opts->{help};
print_args() if $opts->{check_args};
sub print_args
{
print $opts->get_values();
exit(0);
}
sub print_usage
{
my $hopts;
my $msg = shift;
$hopts = $opts->{help} unless (scalar @{$opts->{help}} == 0);
print "usage: $0 n";
print $opts->get_usage($hopts);
print "ERROR: $msgn" if $msg;
exit(0);
}
Getopt::Fancy Allows command line options to be all in one place in your script including default values, allowed values, user-friendly descriptions, required flags and pattern matching requirements. Ofttimes script writers skimp on the usage information or have out-dated help information. This modules helps script writers to be better citizens.
This module uses Getopt::Long, so the same rules apply.
<<lessSYNOPSIS
use Getopt::Fancy;
my $opts = Getopt::Fancy->new();
$opts->add("db", GT => "=s",
EX => " ",
DESC => "The database to dump. Leave unset for all databases.",
DEF => "teen_titans",
ALLOWED => ["--all-databases", "mydb", "teen_titans"],
REGEX => ^[a-zA-Z0-9_]+$,
REQ => 0,
SECTION => "Required DB Params");
# Allow just printing out of set options
$opts->add("check_args", DESC => "Just print all the options", SECTION => "Misc Params");
# Allow user to specify list of options s/he needs help with
$opts->add("help", GT => ":s@", EX => "[option1,option2..]",
DESC => "Give option names and itll print the help for just those options, otherwise all.",
SECTION=>"Misc Params", COMMAS=>1);
# Get the command line options
my $error_msg = $opts->get_options();
print_usage($error_msg) if $error_msg;
print "Will dump this database: $opts->{db} n";
print "User wants help information on these: " . join(", ", @{$opts->{help}}) . "n" if ($opts->{help});
print_usage() if $opts->{help};
print_args() if $opts->{check_args};
sub print_args
{
print $opts->get_values();
exit(0);
}
sub print_usage
{
my $hopts;
my $msg = shift;
$hopts = $opts->{help} unless (scalar @{$opts->{help}} == 0);
print "usage: $0 n";
print $opts->get_usage($hopts);
print "ERROR: $msgn" if $msg;
exit(0);
}
Getopt::Fancy Allows command line options to be all in one place in your script including default values, allowed values, user-friendly descriptions, required flags and pattern matching requirements. Ofttimes script writers skimp on the usage information or have out-dated help information. This modules helps script writers to be better citizens.
This module uses Getopt::Long, so the same rules apply.
Download (0.005MB)
Added: 2006-11-04 License: Perl Artistic License Price:
1084 downloads
Getopt::Clade 0.0.1
Getopt::Clade is a Perl module with command-Line Argument Declaration Engine. more>>
Getopt::Clade is a Perl module with command-Line Argument Declaration Engine.
This module is a placeholder for the real Getopt::Clade module. The module was supposed to be released by July 2005, to support the book "Perl Best Practices". Unfortunately, due to a series of family medical crises, the release of the module has been delayed, probably to early September 2005.
I sincerely apologize for any inconvenience this delay may cause. If you are looking for an alternative Getopt:: module, you may like to consider Getopt::Declare or Getopt::Euclid.
<<lessThis module is a placeholder for the real Getopt::Clade module. The module was supposed to be released by July 2005, to support the book "Perl Best Practices". Unfortunately, due to a series of family medical crises, the release of the module has been delayed, probably to early September 2005.
I sincerely apologize for any inconvenience this delay may cause. If you are looking for an alternative Getopt:: module, you may like to consider Getopt::Declare or Getopt::Euclid.
Download (0.003MB)
Added: 2007-01-13 License: Perl Artistic License Price:
1014 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above getopt plus search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed