NAME
Perinci::Sub::GetArgs::Argv - Get subroutine arguments from command line arguments (@ARGV)
VERSION
version 0.30
SYNOPSIS
use Perinci::Sub::GetArgs::Argv;
my $res = get_args_from_argv(argv=>\@ARGV, meta=>$meta, ...);
DESCRIPTION
This module provides get_args_from_argv()
, which parses command line arguments (@ARGV
) into subroutine arguments (%args
). This module is used by Perinci::CmdLine. For explanation on how command-line options are processed, see Perinci::CmdLine's documentation.
This module uses Log::Any for logging framework.
This module has Rinci metadata.
FUNCTIONS
get_args_from_argv(%args) -> [status, msg, result, meta]
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
Arguments ('*' denotes required arguments):
allow_extra_elems => bool (default: 0)
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
argv => array
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
check_required_args => bool (default: 1)
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
extra_getopts_after => array
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
extra_getopts_before => array
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
meta* => hash
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
on_missing_required_args => code
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
per_arg_json => bool (default: 0)
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
per_arg_yaml => bool (default: 0)
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
strict => bool (default: 1)
{en_US Get subroutine arguments (%args) from command-line arguments (@ARGV)}.
{en_US Using information in function metadata's 'args' property, parse command line arguments '@argv' into hash '%args', suitable for passing into subs.
Currently uses Getopt::Long's GetOptions to do the parsing.
As with GetOptions, this function modifies its 'argv' argument.
Why would one use this function instead of using Getopt::Long directly? Among other reasons, we want to be able to parse complex types.
This function exists mostly to support command-line options parsing for Perinci::CmdLine. See its documentation, on the section of command-line options/argument parsing. }
Return value:
Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.
FAQ
SEE ALSO
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/Perinci-Sub-GetArgs-Argv.
SOURCE
Source repository is at https://github.com/sharyanto/perl-Perinci-Sub-GetArgs-Argv.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-Sub-GetArgs-Argv
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) 2013 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.