The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Getopt::Long::Util - Utilities for Getopt::Long

VERSION

This document describes version 0.76 of Getopt::Long::Util (from Perl distribution Getopt-Long-Util), released on 2014-07-23.

FUNCTIONS

parse_getopt_long_opt_spec($str) => hash

Parse Getopt::Long option specification. Will produce a hash with some keys: opts (array of option names), type (string, type name), desttype (either '', or '@' or '%'), is_neg (true for --opt!), is_inc (true for --opt+), min_vals (int, usually 0 or 1), max_vals (int, usually 0 or 1 except for option that requires multiple values), normalized (string, normalized form of $str: '--' prefix will be stripped, options will be sorted). Will return undef if it can't parse $str. Examples:

 $res = parse_getopt_long_opt_spec('help|h|?'); # {opts=>['?','h','help'], type=>undef, num_vals=>1}
 $res = parse_getopt_long_opt_spec('--foo=s');  # {opts=>['foo'], type=>'s', num_vals=>1}

humanize_getopt_long_opt_spec($str) => str

Convert Getopt::Long option specification like help|h|? or <--foo=s> or debug! into, respectively, --help, -h, -? or --foo=s or --(no)debug. Will die if can't parse $str. The output is suitable for including in help/usage text.

SEE ALSO

Getopt::Long

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Getopt-Long-Util.

SOURCE

Source repository is at https://github.com/sharyanto/perl-Getopt-Long-Util.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Getopt-Long-Util

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.