Extend MooseX::Getopt with (colour) usage message and man page generated from attribute meta and POD.
## In your class
package My::App;
use Moose;
with 'MooseX::Getopt::Usage',
'MooseX::Getopt::Usage::Role::Man';
has verbose => ( is => 'ro', isa => 'Bool', default => 0,
documentation => qq{Say lots about what we are doing} );
has gumption => ( is => 'rw', isa => 'Int', default => 23,
documentation => qq{How much gumption to apply} );
# ... rest of class
## In your script
#!/usr/bin/perl
use My::App;
my $app = My::App->new_with_options;
Can now get help,
trap errors with usage,
and get a man page:
$ synopsis.pl --man
See the README for install instructions, the METACPAN page for latest release docs.
Copyright (C) 2012 Mark Pitchless
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.