Getopt::Declare 1.11 review
DownloadGetopt::Declare is a Perl module with Declaratively Expressed Command-Line Arguments via Regular Expressions. SYNOPSIS use Get
|
|
Getopt::Declare is a Perl module with Declaratively Expressed Command-Line Arguments via Regular Expressions.
SYNOPSIS
use Getopt::Declare;
$args = Getopt::Declare->new($specification_string, $optional_source);
# or:
use Getopt::Declare $specification_string => $args;
Getopt::Declare is yet another command-line argument parser, one which is specifically designed to be powerful but exceptionally easy to use.
To parse the command-line in @ARGV, one simply creates a Getopt::Declare object, by passing Getopt::Declare::new() a specification of the various parameters that may be encountered:
use Getopt::Declare;
$args = Getopt::Declare->new($specification);
This may also be done in a one-liner:
use Getopt::Declare, $specification => $args;
The specification is a single string such as this:
$specification = q(
-a Process all data
-b < N:n > Set mean byte length threshold to
{ bytelen = $N; }
+c < FILE > Create new file
--del Delete old file
{ delold() }
delete [ditto]
e < H:i >x< W:i > Expand image to height < H > and width < W >
{ expand($H,$W); }
-F < file >... Process named file(s)
{ defer {for (@file) {process()}} }
=getrand [< N >] Get a random number
(or, optionally, < N > of them)
{ $N = 1 unless defined $N; }
-- Traditionally indicates end of arguments
{ finish }
Requirements:
Perl
Getopt::Declare 1.11 search tags