-
package MooseX::Getopt::GLD;
+# ABSTRACT: A Moose role for processing command line options with Getopt::Long::Descriptive
+
use Moose::Role;
-use Getopt::Long::Descriptive;
+use Getopt::Long::Descriptive 0.081;
with 'MooseX::Getopt::Basic';
+has usage => (
+ is => 'rw', isa => 'Getopt::Long::Descriptive::Usage',
+ traits => ['NoGetopt'],
+);
+
+# captures the options: --help --usage --?
+has help_flag => (
+ is => 'ro', isa => 'Bool',
+ traits => ['Getopt'],
+ cmd_flag => 'help',
+ cmd_aliases => [ qw(usage ?) ],
+ documentation => 'Prints this usage information.',
+);
+
around _getopt_spec => sub {
shift;
shift->_gld_spec(@_);
{
( ( $opt->{required} && !exists($constructor_params->{$opt->{init_arg}}) ) ? (required => $opt->{required}) : () ),
# NOTE:
- # remove this 'feature' because it didn't work
+ # remove this 'feature' because it didn't work
# all the time, and so is better to not bother
- # since Moose will handle the defaults just
+ # since Moose will handle the defaults just
# fine anyway.
# - SL
#( exists $opt->{default} ? (default => $opt->{default}) : () ),
return ( \@options, \%name_to_init_arg );
}
-no Moose::Role; 1;
-
-__END__
-
-=pod
+no Moose::Role;
-=head1 NAME
-
-MooseX::Getopt::GLD - A Moose role for processing command line options with Getopt::Long::Descriptive
+1;
=head1 SYNOPSIS
## on the command line
% perl my_app_script.pl -in file.input -out file.dump
-=head1 DESCRIPTION
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2009 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
=cut