NAME

Sub::Spec::To::Text::Usage - Generate usage/help message from sub spec

VERSION

version 0.04

SYNOPSIS

use Sub::Spec::To::Text::Usage qw(spec_to_usage);
my $text = spec_to_usage(spec=>$spec, ...);

DESCRIPTION

FUNCTIONS

None are exported, but they are exportable.

spec_to_usage(%args) -> [STATUS_CODE, ERR_MSG, RESULT]

Generate usage text from spec.

Returns a 3-element arrayref. STATUS_CODE is 200 on success, or an error code between 3xx-5xx (just like in HTTP). ERR_MSG is a string containing error message, RESULT is the actual result.

Arguments (* denotes required arguments):

  • command_name => str

    Name of command.

  • is_cmdline => bool (default 0)

    Name of options.

  • options_name => str

    Name of options.

  • spec* => hash

    The sub spec.

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 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.