[tpm] MooseX::Getopt questions
legrady at gmail.com
Wed Dec 2 19:01:17 PST 2009
I'm trying to work with Moose on a new project.
My habit in recent years has been to use Getopt::Long to parse command line
arguments, and Pod::Usage to display short --help or very long --man POD
So I want to use MooseX::Getopt to parse arguments which have been specified
/ described in Moose-ish style and Moosex::Getopt::GLD to store the command
line argument documentation with the Moose attribute.
But I can't figure out how to use M::G::GLD. GLD, which I've never used,
uses a single data structure to store all the arguments, and to associate a
Getopt::Long style description, such as 'firstname=s' to specify --firstname
accepting a string argument, and a description string, which, presumably, is
output if documentation is required. Moose associates everything to do with
one attribute in one place, which is the reverse of associating the getopt
strings ans descriptions for all the args into one structure. So how are you
supposed to specify things? How do you invoke it?
As well if you have an error in command line arguments, it generates an
error message and dies. My past experience is to stick --help or --man on
the command line, and view some helpful reminder to figure out what I was
doing wrong. That's possible because Getopt::Long doesn't go beyond
requiring an arg to be string or integer or float or bool. Type information
and data subtypes are handled later. That allows an opportunity for
POD::Usage to be invoked.
So what am i doing wrong, how do I do it right? I don't find Moose is
generous with examples ... only a few examples used over and over, so if it
doesn't answer your question there's nowhere to turn.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the toronto-pm