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:

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.


In reply to Re: How to access GetOpt::ArgParse arguments? by AppleFritter
in thread How to access GetOpt::ArgParse arguments? by SQADude

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.