|
NAMEVenus::Opts - Opts Class ABSTRACTOpts Class for Perl 5 SYNOPSIS package main;
use Venus::Opts;
my $opts = Venus::Opts->new(
value => ['--resource', 'users', '--help'],
specs => ['resource|r=s', 'help|h'],
named => { method => 'resource' } # optional
);
# $opts->method; # $resource
# $opts->get('resource'); # $resource
# $opts->help; # $help
# $opts->get('help'); # $help
DESCRIPTIONThis package provides methods for handling command-line arguments. ATTRIBUTESThis package has the following attributes: namednamed(HashRef) This attribute is read-write, accepts "(HashRef)" values, is optional, and defaults to "{}". parsedparsed(HashRef) This attribute is read-write, accepts "(HashRef)" values, is optional, and defaults to "{}". specsspecs(ArrayRef) This attribute is read-write, accepts "(ArrayRef)" values, is optional, and defaults to "[]". warnswarns(ArrayRef) This attribute is read-write, accepts "(ArrayRef)" values, is optional, and defaults to "[]". unusedunused(ArrayRef) This attribute is read-write, accepts "(ArrayRef)" values, is optional, and defaults to "[]". INHERITSThis package inherits behaviors from: Venus::Kind::Utility INTEGRATESThis package integrates behaviors from: Venus::Role::Accessible Venus::Role::Buildable Venus::Role::Proxyable Venus::Role::Valuable METHODSThis package provides the following methods: defaultdefault() (arrayref) The default method returns the default value, i.e. "[@ARGV]". Since 0.01
existsexists(string $key) (boolean) The exists method takes a name or index and returns truthy if an associated value exists. Since 0.01
getget(string $key) (any) The get method takes a name or index and returns the associated value. Since 0.01
namename(string $key) (string | undef) The name method takes a name or index and returns index if the the associated value exists. Since 0.01
parseparse(arrayref $args) (Venus::Opts) The parse method optionally takes additional Getopt::Long parser configuration options and retuns the options found based on the object "args" and "spec" values. Since 0.01
reparsereparse(arrayref $specs, arrayref $args) (Venus::Opts) The reparse method resets the parser, calls the "parse" method and returns the result. Since 2.55
setset(string $key, any $data) (any) The set method takes a name or index and sets the value provided if the associated argument exists. Since 0.01
unnamedunnamed() (arrayref) The unnamed method returns an arrayref of values which have not been named using the "named" attribute. Since 0.01
AUTHORSAwncorp, "awncorp@cpan.org" LICENSECopyright (C) 2022, Awncorp, "awncorp@cpan.org". This program is free software, you can redistribute it and/or modify it under the terms of the Apache license version 2.0.
|