Name : perl-Getopt-Auto-Long-Usage
| |
Version : 0.03
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 1.41
| Date : 2024-08-05 18:54:49
|
Group : Unspecified
| Source RPM : perl-Getopt-Auto-Long-Usage-0.03-1.41.src.rpm
|
Size : 0.02 MB
| |
Packager : (none)
| |
Summary : Generate usage strings from Getopt::Long specs
|
Description :
\'Getopt::Auto::Long::Usage\' strives to be compatible with Getopt::LongUsage. In particular, it does not require supplementing existing arglist specs with additional data (e.g. descriptions are optional). However, the goal is to provide maximum maintainability with the least amount of code, not to achieve complete Getopt::Long coverage. So, there are some differences:
* * the generated usage clearly distinguishes boolean flags from arguments requiring an option, and prints type information for the latter. For negatable boolean options (\'longopt|s!\'), it will print the corresponding \'--no-longopt\' flag (but not \'--no-s\').
* * there are no dependencies; the main function can be copied directly into your source code, if necessary
* * it does not attempt to parse \'GetOptions()\' abbreviated / case-insensitive options, and in fact recommends that you disable those when using \'Getopt::Long\' for maintainability and predictability. One shortopt + one (or several) longopts, explicitly specified, will avoid nasty surprises (plus, suppose you decide to rewrite the code in some other language...)
The following example should print the generated help message either to stdout, if requested (\'--help\') or to stderr, if argument parsing fails.
use Getopt::Auto::Long::Usage; use Getopt::Long; my AATTgetoptargs = qw{ help delim:s eval|e! }; my %_O_; my AATTgetoptconf = (\\%_O_, AATTgetoptargs);
sub usage { my ($rc) = AATT_; my AATTdsc = ( delim => \'instead of newline\' ); print getoptlong2usage( Getopt_Long => \\AATTgetoptconf, # all others optional cli_use => \"Arguments: [OPTION]...\ Options:\"; footer => \"No other arguments may be supplied\" descriptions => \\AATTdsc ); exit $rc if defined( $rc ); }
Getopt::Long::Configure( qw( no_ignore_case no_auto_abbrev no_getopt_compat gnu_compat bundling )); unless( GetOptions( AATTgetoptconf ) ) { local *STDOUT = *STDERR; usage 1; } usage 0 if( $_O_{ help } );
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-G/openSUSE_Tumbleweed/noarch |