Search code examples
perlmoose

MooseX::Getopt - canonical way to specify usage message


What's the usual way to include "usage" text in a program using MooseX::Getopt? (i.e. running myprog --usage should print something like "myprog: make everything great")

The MooseX::Getopt documentation says:

"If Getopt::Long::Descriptive is installed and any of the following command line params are passed, the program will exit with usage information. You can add descriptions for each option by including a documentation option for each attribute to document."

but I'm having trouble parsing that last sentence.


Solution

  • Moose attributes can take a documentation option:

    has foo => (
      ...,
      documentation => "The foo attribute foofles the program",
    );