NAME
    Sub::Spec::GetArgs::Array - Get subroutine arguments from array

VERSION
    version 0.01

SYNOPSIS
     use Sub::Spec::GetArgs::Array;

     my $res = get_args_from_array(array=>\@ary, spec=>$spec, ...);

DESCRIPTION
    This module provides get_args_from_array() (and
    gencode_get_args_from_array(), upcoming). This module is used by, among
    others, Sub::Spec::GetArgs::Argv and Sub::Spec::Wrapper.

    This module uses Log::Any for logging framework.

    This module's functions has Sub::Spec specs.

FUNCTIONS
    None are exported by default, but they are exportable.

  get_args_from_array(%args) -> [STATUS_CODE, ERR_MSG, RESULT]
    Get subroutine arguments (%args) from array.

    Using information in sub spec's ~args~ clause (particularly the
    ~arg_pos~ and ~arg_greedy~ arg type clauses), extract arguments from an
    array into a hash \%args, suitable for passing into subs.

    Example:

    : my $spec = { : summary => 'Multiply 2 numbers (a & b)', : args => { :
    a => ['num*' => {arg_pos=>0}], : b => ['num*' => {arg_pos=>1}], : } : }

    then ~get_args_from_array(array=>[2, 3], spec=>$spec)~ will produce:

    : [200, "OK", {a=>2, b=>3}]

    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):

    *   allow_extra_elems => *bool* (default 0)

        Allow extra/unassigned elements in array.

        If set to 1, then if there are array elements unassigned to one of
        the arguments (due to missing ~arg_pos~, for example), instead of
        generating an error, the function will just ignore them.

    *   array* => *array*

    *   spec* => *hash*

SEE ALSO
    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.

