+++ /dev/null
-^.git
-^_build
-^Build$
-^blib
-~$
-\.bak$
-^MANIFEST\.SKIP$
-CVS
-\.svn
-\.DS_Store
-cover_db
-\..*\.sw.?$
-^Makefile$
-^pm_to_blib$
-^MakeMaker-\d
-^blibdirs$
-\.old$
-^#.*#$
-^\.#
-^TODO$
-^MooseX-Getopt
+++ /dev/null
-use strict;
-use warnings;
-use inc::Module::Install 0.91;
-
-if ($Module::Install::AUTHOR) {
- require Module::Install::AuthorRequires;
- require Module::Install::AuthorTests;
-}
-
-name 'MooseX-Getopt';
-license 'perl';
-
-all_from 'lib/MooseX/Getopt.pm';
-
-requires 'Moose' => '0.56';
-requires 'Getopt::Long' => '2.37';
-
-# optional
-requires 'Getopt::Long::Descriptive' => '0.081';
-
-build_requires 'Test::Moose';
-build_requires 'Test::More' => '0.62';
-build_requires 'Test::Exception' => '0.21';
-
-author_requires 'Test::Pod' => 1.14;
-author_requires 'Test::Pod::Coverage' => '1.04';
-author_tests('t/author');
-
-resources repository => 'git://git.moose.perl.org/MooseX-Getopt.git';
-
-auto_manifest();
-
-WriteAll;
+++ /dev/null
-MooseX::Getopt version 0.27
-===========================
-
-See the individual module documentation for more information
-
-INSTALLATION
-
-To install this module type the following:
-
- perl Makefile.PL
- make
- make test
- make install
-
-DEPENDENCIES
-
-This module requires these other modules and libraries:
-
- Moose
- Getopt::Long
-
-COPYRIGHT AND LICENCE
-
-Copyright (C) 2007-2009 Infinity Interactive, Inc.
-
-http://www.iinteractive.com
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
--- /dev/null
+name = MooseX-Getopt
+version = 0.27
+author = Stevan Little <stevan@iinteractive.com>
+author = Brandon L. Black <blblack@gmail.com>
+author = Yuval Kogman <nothingmuch@woobling.org>
+author = Ryan D Johnson <ryan@innerfence.com>
+author = Drew Taylor <drew@drewtaylor.com>
+author = Tomas Doran <bobtfish@bobtfish.net>
+author = Florian Ragwitz <rafl@debian.org>
+author = Dagfinn Ilmari MannsE<aring>ker <ilmari@ilmari.org>
+author = E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avar@cpan.org>
+author = Chris Prather <perigrin@cpan.org>
+license = Perl_5
+copyright_holder = Infinity Interactive, Inc
+
+[@FLORA]
+dist = MooseX-Getopt
+repository_at = github
+authority = cpan:STEVAN
package MooseX::Getopt;
-use Moose::Role;
+# ABSTRACT: A Moose role for processing command line options
-use constant _HAVE_GLD => not not eval { require Getopt::Long::Descriptive };
+use Moose::Role 0.56;
-our $VERSION = '0.27';
-our $AUTHORITY = 'cpan:STEVAN';
+use constant _HAVE_GLD => not not eval { require Getopt::Long::Descriptive };
with _HAVE_GLD ? 'MooseX::Getopt::GLD' : 'MooseX::Getopt::Basic';
-no Moose::Role; 1;
-
-__END__
+no Moose::Role;
-=pod
-
-=head1 NAME
-
-MooseX::Getopt - A Moose role for processing command line options
+1;
=head1 SYNOPSIS
like a normal C<ArrayRef> type for Getopt purposes (that is,
C<=s@>).
-=head1 METHODS
-
-=over 4
-
-=item B<new_with_options (%params)>
+=method B<new_with_options (%params)>
This method will take a set of default C<%params> and then collect
params from the command line (possibly overriding those in C<%params>)
If you have L<Getopt::Long::Descriptive> the C<usage> param is also passed to
C<new>.
-=item B<ARGV>
+=method B<ARGV>
This accessor contains a reference to a copy of the C<@ARGV> array
as it originally existed at the time of C<new_with_options>.
-=item B<extra_argv>
+=method B<extra_argv>
This accessor contains an arrayref of leftover C<@ARGV> elements that
L<Getopt::Long> did not parse. Note that the real C<@ARGV> is left
un-mangled.
-=item B<meta>
+=method B<meta>
This returns the role meta object.
-=back
-
-=head1 BUGS
-
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
-
-=head1 AUTHOR
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-Brandon L. Black, E<lt>blblack@gmail.comE<gt>
-
-Yuval Kogman, E<lt>nothingmuch@woobling.orgE<gt>
-
-=head1 CONTRIBUTORS
-
-Ryan D Johnson, E<lt>ryan@innerfence.comE<gt>
-
-Drew Taylor, E<lt>drew@drewtaylor.comE<gt>
-
-Tomas Doran, (t0m) C<< <bobtfish@bobtfish.net> >>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2008 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
-
package MooseX::Getopt::Basic;
+# ABSTRACT: MooseX::Getopt::Basic - role to implement the Getopt::Long functionality
+
use Moose::Role;
use MooseX::Getopt::OptionTypeMap;
use MooseX::Getopt::Meta::Attribute::NoGetopt;
use Carp ();
-use Getopt::Long ();
+use Getopt::Long 2.37 ();
has ARGV => (is => 'rw', isa => 'ArrayRef', metaclass => "NoGetopt");
has extra_argv => (is => 'rw', isa => 'ArrayRef', metaclass => "NoGetopt");
return @options;
}
-no Moose::Role; 1;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-MooseX::Getopt::Basic - role to implement the Getopt::Long functionality
+no Moose::Role;
+1;
=head1 SYNOPSIS
This is like L<MooseX::Getopt> and can be used instead except that it
doesn't make use of L<Getopt::Long::Descriptive> (or "GLD" for short).
-=head1 METHODS
-
-=head2 new_with_options
+=method new_with_options
See L<MooseX::Getopt/new_with_options>.
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2008 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
-
package MooseX::Getopt::Dashes;
+# ABSTRACT: convert underscores in attribute names to dashes
+
use Moose::Role;
with 'MooseX::Getopt';
return ( $flag, @aliases );
};
-1;
-
-__END__
+no Moose::Role;
-=pod
-
-=head1 NAME
-
-MooseX::Getopt::Dashes - convert underscores in attribute names to dashes
+1;
=head1 SYNOPSIS
the command flag you'd like for a given attribute. No underscore to
dash replacement will be done on the C<cmd_flag>.
-=head1 METHODS
-
-=over 4
-
-=item meta
-
-=back
-
-=head1 BUGS
-
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
-
-=head1 AUTHOR
-
-Dagfinn Ilmari MannsE<aring>ker E<lt>ilmari@ilmari.orgE<gt>
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-Yuval Kogman C<< <nuffin@cpan.org> >>
-
-E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason E<lt>avar@cpan.orgE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2008 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
-
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';
return ( \@options, \%name_to_init_arg );
}
-no Moose::Role; 1;
-
-__END__
-
-=pod
-
-=head1 NAME
+no Moose::Role;
-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
-
package MooseX::Getopt::Meta::Attribute;
+# ABSTRACT: Optional meta attribute for custom option names
+
use Moose;
use Moose::Util::TypeConstraints;
-our $VERSION = '0.27';
-our $AUTHORITY = 'cpan:STEVAN';
-
extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)
with 'MooseX::Getopt::Meta::Attribute::Trait';
no Moose;
# register this as a metaclass alias ...
-package # stop confusing PAUSE
+package # stop confusing PAUSE
Moose::Meta::Attribute::Custom::Getopt;
sub register_implementation { 'MooseX::Getopt::Meta::Attribute' }
1;
-__END__
-
-=pod
-
-=head1 NAME
-
-MooseX::Getopt::Meta::Attribute - Optional meta attribute for custom option names
-
=head1 SYNOPSIS
package App;
use Moose;
-
+
with 'MooseX::Getopt';
-
+
has 'data' => (
- metaclass => 'MooseX::Getopt::Meta::Attribute',
+ metaclass => 'MooseX::Getopt::Meta::Attribute',
is => 'ro',
isa => 'Str',
default => 'file.dat',
- # tells MooseX::Getopt to use --somedata as the
- # command line flag instead of the normal
+ # tells MooseX::Getopt to use --somedata as the
+ # command line flag instead of the normal
# autogenerated one (--data)
cmd_flag => 'somedata',
=head1 DESCRIPTION
-This is a custom attribute metaclass which can be used to specify a
-the specific command line flag to use instead of the default one
-which L<MooseX::Getopt> will create for you.
+This is a custom attribute metaclass which can be used to specify a
+the specific command line flag to use instead of the default one
+which L<MooseX::Getopt> will create for you.
-This is certainly not the prettiest way to go about this, but for
+This is certainly not the prettiest way to go about this, but for
now it works for those who might need such a feature.
=head2 Custom Metaclass alias
-This now takes advantage of the Moose 0.19 feature to support
+This now takes advantage of the Moose 0.19 feature to support
custom attribute metaclass aliases. This means you can also
use this as the B<Getopt> alias, like so:
has 'foo' => (metaclass => 'Getopt', cmd_flag => 'f');
-=head1 METHODS
-
-These methods are of little use to most users, they are used interally
-within L<MooseX::Getopt>.
-
-=over 4
-
-=item B<cmd_flag>
+=method B<cmd_flag>
Changes the commandline flag to be this value, instead of the default,
which is the same as the attribute name.
-=item B<cmd_aliases>
+=method B<cmd_aliases>
Adds more aliases for this commandline flag, useful for short options
and such.
-=item B<has_cmd_flag>
-
-=item B<has_cmd_aliases>
-
-=item B<meta>
-
-=back
-
-=head1 BUGS
-
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
-
-=head1 AUTHOR
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-Brandon L. Black, E<lt>blblack@gmail.comE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2008 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
+=method B<has_cmd_flag>
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
+=method B<has_cmd_aliases>
=cut
-
package MooseX::Getopt::Meta::Attribute::NoGetopt;
-use Moose;
+# ABSTRACT: Optional meta attribute for ignoring params
-our $VERSION = '0.27';
-our $AUTHORITY = 'cpan:STEVAN';
+use Moose;
extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)
with 'MooseX::Getopt::Meta::Attribute::Trait::NoGetopt';
1;
-__END__
-
-=pod
-
-=head1 NAME
-
-MooseX::Getopt::Meta::Attribute::NoGetopt - Optional meta attribute for ignoring params
-
=head1 SYNOPSIS
package App;
use Moose;
-
+
with 'MooseX::Getopt';
-
+
has 'data' => (
- metaclass => 'NoGetopt', # do not attempt to capture this param
+ metaclass => 'NoGetopt', # do not attempt to capture this param
is => 'ro',
isa => 'Str',
default => 'file.dat',
=head1 DESCRIPTION
-This is a custom attribute metaclass which can be used to specify
-that a specific attribute should B<not> be processed by
-C<MooseX::Getopt>. All you need to do is specify the C<NoGetopt>
+This is a custom attribute metaclass which can be used to specify
+that a specific attribute should B<not> be processed by
+C<MooseX::Getopt>. All you need to do is specify the C<NoGetopt>
metaclass.
has 'foo' => (metaclass => 'NoGetopt', ... );
-=head1 METHODS
-
-=over 4
-
-=item B<meta>
-
-=back
-
-=head1 BUGS
-
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
-
-=head1 AUTHOR
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-Chris Prather C<< <perigrin@cpan.org> >>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2008 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
-
package MooseX::Getopt::Meta::Attribute::Trait;
+# ABSTRACT: Optional meta attribute trait for custom option names
+
use Moose::Role;
use Moose::Util::TypeConstraints;
-our $VERSION = '0.27';
-our $AUTHORITY = 'cpan:STEVAN';
-
has 'cmd_flag' => (
is => 'rw',
isa => 'Str',
# This subtype is to support scalar -> arrayref coercion
# without polluting the built-in types
subtype '_MooseX_Getopt_CmdAliases' => as 'ArrayRef';
-
+
coerce '_MooseX_Getopt_CmdAliases'
=> from 'Str'
=> via { [$_] };
coerce => 1,
);
+no Moose::Util::TypeConstraints;
no Moose::Role;
# register this as a metaclass alias ...
-package # stop confusing PAUSE
+package # stop confusing PAUSE
Moose::Meta::Attribute::Custom::Trait::Getopt;
sub register_implementation { 'MooseX::Getopt::Meta::Attribute::Trait' }
1;
-__END__
-
-=pod
-
-=head1 NAME
-
-MooseX::Getopt::Meta::Attribute::Trait - Optional meta attribute trait for custom option names
-
=head1 SYNOPSIS
package App;
use Moose;
-
+
with 'MooseX::Getopt';
-
+
has 'data' => (
- traits => [ 'Getopt' ],
+ traits => [ 'Getopt' ],
is => 'ro',
isa => 'Str',
default => 'file.dat',
- # tells MooseX::Getopt to use --somedata as the
- # command line flag instead of the normal
+ # tells MooseX::Getopt to use --somedata as the
+ # command line flag instead of the normal
# autogenerated one (--data)
cmd_flag => 'somedata',
=head1 DESCRIPTION
-This is a custom attribute metaclass trait which can be used to
-specify a the specific command line flag to use instead of the
-default one which L<MooseX::Getopt> will create for you.
-
-=head1 METHODS
-
-These methods are of little use to most users, they are used interally
-within L<MooseX::Getopt>.
+This is a custom attribute metaclass trait which can be used to
+specify a the specific command line flag to use instead of the
+default one which L<MooseX::Getopt> will create for you.
-=over 4
-
-=item B<cmd_flag>
+=method B<cmd_flag>
Changes the commandline flag to be this value, instead of the default,
which is the same as the attribute name.
-=item B<cmd_aliases>
+=method B<cmd_aliases>
Adds more aliases for this commandline flag, useful for short options
and such.
-=item B<has_cmd_flag>
-
-=item B<has_cmd_aliases>
-
-=item B<meta>
-
-=back
-
-=head1 BUGS
-
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
-
-=head1 AUTHOR
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2008 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
+=method B<has_cmd_flag>
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
+=method B<has_cmd_aliases>
=cut
-
package MooseX::Getopt::Meta::Attribute::Trait::NoGetopt;
-use Moose::Role;
-
-our $VERSION = '0.27';
-our $AUTHORITY = 'cpan:STEVAN';
+# ABSTRACT: Optional meta attribute trait for ignoring params
+use Moose::Role;
no Moose::Role;
# register this as a metaclass alias ...
1;
-__END__
-
-=pod
-
-=head1 NAME
-
-MooseX::Getopt::Meta::Attribute::Trait::NoGetopt - Optional meta attribute trait for ignoring params
-
=head1 SYNOPSIS
package App;
use Moose;
-
+
with 'MooseX::Getopt';
-
+
has 'data' => (
- traits => [ 'NoGetopt' ], # do not attempt to capture this param
+ traits => [ 'NoGetopt' ], # do not attempt to capture this param
is => 'ro',
isa => 'Str',
default => 'file.dat',
=head1 DESCRIPTION
-This is a custom attribute metaclass trait which can be used to
-specify that a specific attribute should B<not> be processed by
-C<MooseX::Getopt>. All you need to do is specify the C<NoGetopt>
+This is a custom attribute metaclass trait which can be used to
+specify that a specific attribute should B<not> be processed by
+C<MooseX::Getopt>. All you need to do is specify the C<NoGetopt>
metaclass trait.
has 'foo' => (traits => [ 'NoGetopt', ... ], ... );
-=head1 METHODS
-
-=over 4
-
-=item B<meta>
-
-=back
-
-=head1 BUGS
-
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
-
-=head1 AUTHOR
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2008 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
-
package MooseX::Getopt::OptionTypeMap;
+# ABSTRACT: Storage for the option to type mappings
use Moose 'confess', 'blessed';
use Moose::Util::TypeConstraints 'find_type_constraint';
-our $VERSION = '0.27';
-our $AUTHORITY = 'cpan:STEVAN';
-
my %option_type_map = (
'Bool' => '!',
'Str' => '=s',
'Int' => '=i',
'Num' => '=f',
'ArrayRef' => '=s@',
- 'HashRef' => '=s%',
+ 'HashRef' => '=s%',
);
sub has_option_type {
return 1 if exists $option_type_map{blessed($type_or_name) ? $type_or_name->name : $type_or_name};
my $current = blessed($type_or_name) ? $type_or_name : find_type_constraint($type_or_name);
-
+
(defined $current)
|| confess "Could not find the type constraint for '$type_or_name'";
-
+
while (my $parent = $current->parent) {
return 1 if exists $option_type_map{$parent->name};
$current = $parent;
return $option_type_map{$name} if exists $option_type_map{$name};
my $current = ref $type_or_name ? $type_or_name : find_type_constraint($type_or_name);
-
+
(defined $current)
- || confess "Could not find the type constraint for '$type_or_name'";
+ || confess "Could not find the type constraint for '$type_or_name'";
while ( $current = $current->parent ) {
return $option_type_map{$current->name}
$option_type_map{$type_name} = $option_string;
}
-no Moose; no Moose::Util::TypeConstraints; 1;
+no Moose::Util::TypeConstraints;
+no Moose;
-__END__
-
-
-=pod
-
-=head1 NAME
-
-MooseX::Getopt::OptionTypeMap - Storage for the option to type mappings
+1;
=head1 DESCRIPTION
See the I<Custom Type Constraints> section in the L<MooseX::Getopt> docs
for more info about how to use this module.
-=head1 METHODS
-
-These are all class methods and should be called as such.
-
-=over 4
-
-=item B<has_option_type ($type_or_name)>
-
-=item B<get_option_type ($type_or_name)>
-
-=item B<add_option_type_to_map ($type_name, $option_spec)>
-
-=item B<meta>
-
-=back
-
-=head1 BUGS
-
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
-
-=head1 AUTHOR
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2008 by Infinity Interactive, Inc.
+=method B<has_option_type ($type_or_name)>
-L<http://www.iinteractive.com>
+=method B<get_option_type ($type_or_name)>
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
+=method B<add_option_type_to_map ($type_name, $option_spec)>
=cut
-
package MooseX::Getopt::Strict;
+# ABSTRACT: only make options for attrs with the Getopt metaclass
+
use Moose::Role;
with 'MooseX::Getopt';
} $class->$next(@args);
};
-1;
-
-__END__
-
-=pod
+no Moose::Role;
-=head1 NAME
+1;
-MooseX::Getopt::Strict - only make options for attrs with the Getopt metaclass
-
=head1 DESCRIPTION
-This is an stricter version of C<MooseX::Getopt> which only processes the
+This is an stricter version of C<MooseX::Getopt> which only processes the
attributes if they explicitly set as C<Getopt> attributes. All other attributes
are ignored by the command line handler.
-
-=head1 METHODS
-
-=over 4
-
-=item meta
-
-=back
-
-=head1 BUGS
-
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
-
-=head1 AUTHOR
-
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
-
-Yuval Kogman C<< <nuffin@cpan.org> >>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2007-2008 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
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More;
-use Test::Pod 1.14;
-
-all_pod_files_ok();
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More;
-use Test::Pod::Coverage 1.04;
-
-all_pod_coverage_ok();