![]() |
![]()
| ![]() |
![]()
NAMEData::Object::OptsABSTRACTOpts Class for Perl 5SYNOPSISpackage main; use Data::Object::Opts; my $opts = Data::Object::Opts->new( args => ['--resource', 'users', '--help'], spec => ['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 accessing command-line arguments.INTEGRATESThis package integrates behaviors from:Data::Object::Role::Buildable Data::Object::Role::Proxyable Data::Object::Role::Stashable LIBRARIESThis package uses type constraints from:Types::Standard ATTRIBUTESThis package has the following attributes:argsargs(ArrayRef[Str]) This attribute is read-only, accepts "(ArrayRef[Str])" values, and is optional. namednamed(HashRef) This attribute is read-only, accepts "(HashRef)" values, and is optional. specspec(ArrayRef[Str]) This attribute is read-only, accepts "(ArrayRef[Str])" values, and is optional. METHODSThis package implements the following methods:existsexists(Str $key) : Any The exists method takes a name or index and returns truthy if an associated value exists.
getget(Str $key) : Any The get method takes a name or index and returns the associated value.
namename(Str $key) : Any The name method takes a name or index and returns index if the the associated value exists.
parseparse(Maybe[ArrayRef] $config) : HashRef The parse method optionally takes additional Getopt::Long parser configuration options and retuns the options found based on the object "args" and "spec" values.
setset(Str $key, Maybe[Any] $value) : Any The set method takes a name or index and sets the value provided if the associated argument exists.
stashedstashed() : HashRef The stashed method returns the stashed data associated with the object.
warnedwarned() : Num The warned method returns the number of warnings emitted during option parsing.
warningswarnings() : ArrayRef[ArrayRef[Str]] The warnings method returns the set of warnings emitted during option parsing.
AUTHORAl Newkirk, "awncorp@cpan.org"LICENSECopyright (C) 2011-2019, Al Newkirk, et al.This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file" <https://github.com/iamalnewkirk/data-object-opts/blob/master/LICENSE>. PROJECTWiki <https://github.com/iamalnewkirk/data-object-opts/wiki>Project <https://github.com/iamalnewkirk/data-object-opts> Initiatives <https://github.com/iamalnewkirk/data-object-opts/projects> Milestones <https://github.com/iamalnewkirk/data-object-opts/milestones> Contributing <https://github.com/iamalnewkirk/data-object-opts/blob/master/CONTRIBUTE.md> Issues <https://github.com/iamalnewkirk/data-object-opts/issues>
|