in reply to How to access GetOpt::ArgParse arguments?
I've never used this module either, but the documentation on CPAN has this to say:
parse_args
This object method accepts a list of arguments or @ARGV if unspecified, parses them for values, and stores the values in the namespace object.
[...]
The Namespace Object
The parsed values are stored in a namespace object. Any class with the following three methods:
- A constructor new()
- set_attr(name => value)
- get_attr(name)
can be used as the Namespace class.
The default one is Getopt::ArgParse::Namespace. It uses autoload to provide a readonly accessor method using dest names to access parsed values. [...]
What's a dest name, I hear you ask? You can specify them for options when calling add_arg by passing in an appropriate parameter, e.g. dest => 'count'; if you don't, "the name or the first option without leading dashes will be used as the name for retrieving values".
So all in all -- if you're intending to get fancy with this module, just use
$args->count;
after parsing, or alternatively
$ap->namespace->count;
and hopefully this should work as expected.
|
|---|