App::Cmdline::Options::ExtBasic - set of basic options for command-line applications
version 0.1.2
# 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 ) ); }
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.
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" ],
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.
eval
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.
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):
$opt->quiet
execute()
sub execute { my ($self, $opt, $args) = @_; print STDERR "Started...\n" unless $opt->quiet; ... }
Martin Senger <martin.senger@gmail.com>
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.
To install App::Cmdline, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Cmdline
CPAN shell
perl -MCPAN -e shell install App::Cmdline
For more information on module installation, please visit the detailed CPAN module installation guide.