NAME
App::Cmdline::Options::ExtBasic - set of basic options for command-line applications
VERSION
version 0.1.2
SYNOPSIS
# In your module that represents a command-line application:
sub opt_spec {
my $self = shift;
return $self->check_for_duplicates (
[ 'check|c' => "only check the configuration" ],
...,
$self->composed_of (
'App::Cmdline::Options::ExtBasic', # here are the options added
)
);
}
DESCRIPTION
This is a kind of a role module, defining a particular set of command-line options and their validation. See more about how to write a module that represents a command-line application and that uses this set of options in App::Cmdline.
OPTIONS
Particularly, this module extends the basic options, adding mostly more documentation options. It inherits from App::Cmdline::Options::Basic module, and, therefore, provides the same basic options defined there, and it adds the following options:
[ 'help' => "display a full usage message" ],
[ 'man|m' => "display a full manual page" ],
[ 'quiet|q' => "skip various progress messages" ],
--help
It uses Pod::Usage module to print a (potentially) longer usage message created from embedded POD documentation, using its SYNOPSIS section, along with any section entitled OPTIONS, ARGUMENTS, or OPTIONS AND ARGUMENTS. The POD documentation is taken from the module that represents your application (not from the command-line script that uses your application module).
After producing this message, it exits in one of the two possible ways: If it is called from and eval
expression, it dies (so you can catch it and continue). Otherwise, it exists with the exit code zero.
--man
It uses Pod::Usage module to print a full manual page from embedded POD documentation. Then, it exits in the same way as described din the -help option.
--quiet
It creates a method $opt->quiet
that can be used in your application to ignore some messages. For example (remember that the full job in you application is done in its execute()
method):
sub execute {
my ($self, $opt, $args) = @_;
print STDERR "Started...\n" unless $opt->quiet;
...
}
AUTHOR
Martin Senger <martin.senger@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Martin Senger, CBRC - KAUST (Computational Biology Research Center - King Abdullah University of Science and Technology) All Rights Reserved.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.