Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Import from MooseX::Getopt 0.31

  • Loading branch information...
commit fe516759c77302dab87756baa9bd76d5b18b6023 1 parent ff05e3f
FUJI Goro authored

Showing 35 changed files with 238 additions and 229 deletions. Show diff stats Hide diff stats

  1. +1 1  .gitignore
  2. +7 1 ChangeLog
  3. +9 6 dist.ini
  4. +17 17 lib/{MooseX → MouseX}/Getopt.pm
  5. +17 17 lib/{MooseX → MouseX}/Getopt/Basic.pm
  6. +10 10 lib/{MooseX → MouseX}/Getopt/Dashes.pm
  7. +8 8 lib/{MooseX → MouseX}/Getopt/GLD.pm
  8. +14 14 lib/{MooseX → MouseX}/Getopt/Meta/Attribute.pm
  9. +10 10 lib/{MooseX → MouseX}/Getopt/Meta/Attribute/NoGetopt.pm
  10. +15 15 lib/{MooseX → MouseX}/Getopt/Meta/Attribute/Trait.pm
  11. +8 8 lib/{MooseX → MouseX}/Getopt/Meta/Attribute/Trait/NoGetopt.pm
  12. +6 6 lib/{MooseX → MouseX}/Getopt/OptionTypeMap.pm
  13. +6 6 lib/{MooseX → MouseX}/Getopt/Strict.pm
  14. +1 1  t/000_load.t
  15. +8 8 t/001_basic.t
  16. +5 5 t/002_custom_option_type.t
  17. +4 4 t/003_inferred_option_type.t
  18. +3 3 t/004_nogetop.t
  19. +3 3 t/005_strict.t
  20. +7 7 t/006_metaclass_traits.t
  21. +3 3 t/007_nogetopt_trait.t
  22. +11 11 t/008_configfromfile.t
  23. +3 3 t/009_gld_and_explicit_options.t
  24. +3 3 t/010_dashes.t
  25. +3 3 t/100_gld_default_bug.t
  26. +4 4 t/101_argv_bug.t
  27. +8 8 t/102_basic_basic.t
  28. +2 2 t/103_uc_bug.t
  29. +2 2 t/104_override_usage.t
  30. +8 8 t/105_uc_bug_more.t
  31. +8 8 t/106_no_ignore_case.t
  32. +7 7 t/107_no_auto_help.t
  33. +6 6 t/108_usage_attr.t
  34. +2 2 t/109_help_flag.t
  35. +9 9 t/110_sort_usage_by_attr_order.t
2  .gitignore
... ... @@ -1,4 +1,4 @@
1   -MooseX-Getopt-*
  1 +MouseX-Getopt-*
2 2 pm_to_blib
3 3 inc
4 4 blib
8 ChangeLog
... ... @@ -1,4 +1,10 @@
1   -Revision history for Perl extension MooseX-Getopt
  1 +Revision history for Perl extension MouseX-Getopt
  2 +
  3 +0.31 Mon Jul 26 20:52:38 2010
  4 + * Just copied from MooseX-Getopt 0.31
  5 +
  6 +NOTE: This distribution is a copy of MooseX-Getopt, so the following history
  7 + is that of MooseX-Getopt's, not MouseX-Geopt's.
2 8
3 9 0.31 Wed 7 Jul 2010
4 10 * Fix issue causing tests to fail if MooseX::SimpleConfig isn't installed.
15 dist.ini
... ... @@ -1,5 +1,7 @@
1   -name = MooseX-Getopt
  1 +name = MouseX-Getopt
2 2 version = 0.31
  3 +author = NAKAGAWA Masaki <masaki@cpan.org>
  4 +author = FUJI Goro <gfuji@cpan.org>
3 5 author = Stevan Little <stevan@iinteractive.com>
4 6 author = Brandon L. Black <blblack@gmail.com>
5 7 author = Yuval Kogman <nothingmuch@woobling.org>
@@ -7,22 +9,23 @@ author = Ryan D Johnson <ryan@innerfence.com>
7 9 author = Drew Taylor <drew@drewtaylor.com>
8 10 author = Tomas Doran <bobtfish@bobtfish.net>
9 11 author = Florian Ragwitz <rafl@debian.org>
10   -author = Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
11   -author = Ævar Arnfjörð Bjarmason <avar@cpan.org>
  12 +author = Dagfinn Ilmari Mannsaker <ilmari@ilmari.org>
  13 +author = Avar Arnfjord Bjarmason <avar@cpan.org>
12 14 author = Chris Prather <perigrin@cpan.org>
13 15 license = Perl_5
14 16 copyright_holder = Infinity Interactive, Inc
15 17
16 18 [@FLORA]
17   -dist = MooseX-Getopt
18   -repository_at = gitmo
  19 +dist = MouseX-Getopt
  20 +repository_at = github
  21 +github_user = gfx
19 22 authority = cpan:STEVAN
20 23 auto_prereq = 0
21 24
22 25 [Prereq]
23 26 Getopt::Long = 2.37
24 27 Getopt::Long::Descriptive = 0.081
25   -Moose = 0.56
  28 +Mouse = 0.64
26 29
27 30 [Prereq / TestRequires]
28 31 Test::Exception = 0.21
34 lib/MooseX/Getopt.pm → lib/MouseX/Getopt.pm
... ... @@ -1,11 +1,11 @@
1   -package MooseX::Getopt;
2   -# ABSTRACT: A Moose role for processing command line options
  1 +package MouseX::Getopt;
  2 +# ABSTRACT: A Mouse role for processing command line options
3 3
4   -use Moose::Role 0.56;
  4 +use Mouse::Role;
5 5
6   -with 'MooseX::Getopt::GLD';
  6 +with 'MouseX::Getopt::GLD';
7 7
8   -no Moose::Role;
  8 +no Mouse::Role;
9 9
10 10 1;
11 11
@@ -13,9 +13,9 @@ no Moose::Role;
13 13
14 14 ## In your class
15 15 package My::App;
16   - use Moose;
  16 + use Mouse;
17 17
18   - with 'MooseX::Getopt';
  18 + with 'MouseX::Getopt';
19 19
20 20 has 'out' => (is => 'rw', isa => 'Str', required => 1);
21 21 has 'in' => (is => 'rw', isa => 'Str', required => 1);
@@ -44,17 +44,17 @@ of your attribute as the command line option, and if there is a type
44 44 constraint defined, it will configure Getopt::Long to handle the option
45 45 accordingly.
46 46
47   -You can use the trait L<MooseX::Getopt::Meta::Attribute::Trait> or the
48   -attribute metaclass L<MooseX::Getopt::Meta::Attribute> to get non-default
  47 +You can use the trait L<MouseX::Getopt::Meta::Attribute::Trait> or the
  48 +attribute metaclass L<MouseX::Getopt::Meta::Attribute> to get non-default
49 49 commandline option names and aliases.
50 50
51   -You can use the trait L<MooseX::Getopt::Meta::Attribute::Trait::NoGetopt>
52   -or the attribute metaclass L<MooseX::Getopt::Meta::Attribute::NoGetopt>
53   -to have C<MooseX::Getopt> ignore your attribute in the commandline options.
  51 +You can use the trait L<MouseX::Getopt::Meta::Attribute::Trait::NoGetopt>
  52 +or the attribute metaclass L<MouseX::Getopt::Meta::Attribute::NoGetopt>
  53 +to have C<MouseX::Getopt> ignore your attribute in the commandline options.
54 54
55 55 By default, attributes which start with an underscore are not given
56 56 commandline argument support, unless the attribute's metaclass is set
57   -to L<MooseX::Getopt::Meta::Attribute>. If you don't want your accessors
  57 +to L<MouseX::Getopt::Meta::Attribute>. If you don't want your accessors
58 58 to have the leading underscore in their name, you can do this:
59 59
60 60 # for read/write attributes
@@ -67,8 +67,8 @@ This will mean that Getopt will not handle a --foo param, but your
67 67 code can still call the C<foo> method.
68 68
69 69 If your class also uses a configfile-loading role based on
70   -L<MooseX::ConfigFromFile>, such as L<MooseX::SimpleConfig>,
71   -L<MooseX::Getopt>'s C<new_with_options> will load the configfile
  70 +L<MouseX::ConfigFromFile>, such as L<MouseX::SimpleConfig>,
  71 +L<MouseX::Getopt>'s C<new_with_options> will load the configfile
72 72 specified by the C<--configfile> option (or the default you've
73 73 given for the configfile attribute) for you.
74 74
@@ -145,7 +145,7 @@ so:
145 145
146 146 Then you register the mapping, like so:
147 147
148   - MooseX::Getopt::OptionTypeMap->add_option_type_to_map(
  148 + MouseX::Getopt::OptionTypeMap->add_option_type_to_map(
149 149 'ArrayOfInts' => '=i@'
150 150 );
151 151
@@ -173,7 +173,7 @@ Better examples are certainly welcome :)
173 173 If you define a custom subtype which is a subtype of one of the
174 174 standard L</Supported Type Constraints> above, and do not explicitly
175 175 provide custom support as in L</Custom Type Constraints> above,
176   -MooseX::Getopt will treat it like the parent type for Getopt
  176 +MouseX::Getopt will treat it like the parent type for Getopt
177 177 purposes.
178 178
179 179 For example, if you had the same custom C<ArrayOfInts> subtype
34 lib/MooseX/Getopt/Basic.pm → lib/MouseX/Getopt/Basic.pm
... ... @@ -1,11 +1,11 @@
1   -package MooseX::Getopt::Basic;
2   -# ABSTRACT: MooseX::Getopt::Basic - role to implement the Getopt::Long functionality
  1 +package MouseX::Getopt::Basic;
  2 +# ABSTRACT: MouseX::Getopt::Basic - role to implement the Getopt::Long functionality
3 3
4   -use Moose::Role;
  4 +use Mouse::Role;
5 5
6   -use MooseX::Getopt::OptionTypeMap;
7   -use MooseX::Getopt::Meta::Attribute;
8   -use MooseX::Getopt::Meta::Attribute::NoGetopt;
  6 +use MouseX::Getopt::OptionTypeMap;
  7 +use MouseX::Getopt::Meta::Attribute;
  8 +use MouseX::Getopt::Meta::Attribute::NoGetopt;
9 9 use Carp ();
10 10
11 11 use Getopt::Long 2.37 ();
@@ -17,7 +17,7 @@ sub new_with_options {
17 17 my ($class, @params) = @_;
18 18
19 19 my $config_from_file;
20   - if($class->meta->does_role('MooseX::ConfigFromFile')) {
  20 + if($class->meta->does_role('MouseX::ConfigFromFile')) {
21 21 local @ARGV = @ARGV;
22 22
23 23 # just get the configfile arg now; the rest of the args will be
@@ -160,11 +160,11 @@ sub _compute_getopt_attrs {
160 160 my $class = shift;
161 161 sort { $a->insertion_order <=> $b->insertion_order }
162 162 grep {
163   - $_->does("MooseX::Getopt::Meta::Attribute::Trait")
  163 + $_->does("MouseX::Getopt::Meta::Attribute::Trait")
164 164 or
165 165 $_->name !~ /^_/
166 166 } grep {
167   - !$_->does('MooseX::Getopt::Meta::Attribute::Trait::NoGetopt')
  167 + !$_->does('MouseX::Getopt::Meta::Attribute::Trait::NoGetopt')
168 168 } $class->meta->get_all_attributes
169 169 }
170 170
@@ -175,7 +175,7 @@ sub _get_cmd_flags_for_attr {
175 175
176 176 my @aliases;
177 177
178   - if ($attr->does('MooseX::Getopt::Meta::Attribute::Trait')) {
  178 + if ($attr->does('MouseX::Getopt::Meta::Attribute::Trait')) {
179 179 $flag = $attr->cmd_flag if $attr->has_cmd_flag;
180 180 @aliases = @{ $attr->cmd_aliases } if $attr->has_cmd_aliases;
181 181 }
@@ -199,8 +199,8 @@ sub _attrs_to_options {
199 199 }
200 200 elsif ($attr->has_type_constraint) {
201 201 my $type = $attr->type_constraint;
202   - if (MooseX::Getopt::OptionTypeMap->has_option_type($type)) {
203   - $opt_string .= MooseX::Getopt::OptionTypeMap->get_option_type($type)
  202 + if (MouseX::Getopt::OptionTypeMap->has_option_type($type)) {
  203 + $opt_string .= MouseX::Getopt::OptionTypeMap->get_option_type($type)
204 204 }
205 205 }
206 206
@@ -225,16 +225,16 @@ sub _attrs_to_options {
225 225 return @options;
226 226 }
227 227
228   -no Moose::Role;
  228 +no Mouse::Role;
229 229 1;
230 230
231 231 =head1 SYNOPSIS
232 232
233 233 ## In your class
234 234 package My::App;
235   - use Moose;
  235 + use Mouse;
236 236
237   - with 'MooseX::Getopt::Basic';
  237 + with 'MouseX::Getopt::Basic';
238 238
239 239 has 'out' => (is => 'rw', isa => 'Str', required => 1);
240 240 has 'in' => (is => 'rw', isa => 'Str', required => 1);
@@ -254,11 +254,11 @@ no Moose::Role;
254 254
255 255 =head1 DESCRIPTION
256 256
257   -This is like L<MooseX::Getopt> and can be used instead except that it
  257 +This is like L<MouseX::Getopt> and can be used instead except that it
258 258 doesn't make use of L<Getopt::Long::Descriptive> (or "GLD" for short).
259 259
260 260 =method new_with_options
261 261
262   -See L<MooseX::Getopt/new_with_options>.
  262 +See L<MouseX::Getopt/new_with_options>.
263 263
264 264 =cut
20 lib/MooseX/Getopt/Dashes.pm → lib/MouseX/Getopt/Dashes.pm
... ... @@ -1,9 +1,9 @@
1   -package MooseX::Getopt::Dashes;
  1 +package MouseX::Getopt::Dashes;
2 2 # ABSTRACT: convert underscores in attribute names to dashes
3 3
4   -use Moose::Role;
  4 +use Mouse::Role;
5 5
6   -with 'MooseX::Getopt';
  6 +with 'MouseX::Getopt';
7 7
8 8 around _get_cmd_flags_for_attr => sub {
9 9 my $next = shift;
@@ -11,21 +11,21 @@ around _get_cmd_flags_for_attr => sub {
11 11
12 12 my ( $flag, @aliases ) = $class->$next($attr, @rest);
13 13 $flag =~ tr/_/-/
14   - unless $attr->does('MooseX::Getopt::Meta::Attribute::Trait')
  14 + unless $attr->does('MouseX::Getopt::Meta::Attribute::Trait')
15 15 && $attr->has_cmd_flag;
16 16
17 17 return ( $flag, @aliases );
18 18 };
19 19
20   -no Moose::Role;
  20 +no Mouse::Role;
21 21
22 22 1;
23 23
24 24 =head1 SYNOPSIS
25 25
26 26 package My::App;
27   - use Moose;
28   - with 'MooseX::Getopt::Dashes';
  27 + use Mouse;
  28 + with 'MouseX::Getopt::Dashes';
29 29
30 30 # Will be called as --some-thingy, not --some_thingy
31 31 has 'some_thingy' => (
@@ -43,15 +43,15 @@ no Moose::Role;
43 43 default => 'foo'
44 44 );
45 45
46   - # use as MooseX::Getopt
  46 + # use as MouseX::Getopt
47 47
48 48 =head1 DESCRIPTION
49 49
50   -This is a version of C<MooseX::Getopt> which converts underscores in
  50 +This is a version of C<MouseX::Getopt> which converts underscores in
51 51 attribute names to dashes when generating command line flags.
52 52
53 53 You can selectively disable this on a per-attribute basis by supplying
54   -a L<cmd_flag|MooseX::Getopt::Meta::Attribute/METHODS> argument with
  54 +a L<cmd_flag|MouseX::Getopt::Meta::Attribute/METHODS> argument with
55 55 the command flag you'd like for a given attribute. No underscore to
56 56 dash replacement will be done on the C<cmd_flag>.
57 57
16 lib/MooseX/Getopt/GLD.pm → lib/MouseX/Getopt/GLD.pm
... ... @@ -1,11 +1,11 @@
1   -package MooseX::Getopt::GLD;
2   -# ABSTRACT: A Moose role for processing command line options with Getopt::Long::Descriptive
  1 +package MouseX::Getopt::GLD;
  2 +# ABSTRACT: A Mouse role for processing command line options with Getopt::Long::Descriptive
3 3
4   -use Moose::Role;
  4 +use Mouse::Role;
5 5
6 6 use Getopt::Long::Descriptive 0.081;
7 7
8   -with 'MooseX::Getopt::Basic';
  8 +with 'MouseX::Getopt::Basic';
9 9
10 10 has usage => (
11 11 is => 'rw', isa => 'Getopt::Long::Descriptive::Usage',
@@ -48,7 +48,7 @@ sub _gld_spec {
48 48 # NOTE:
49 49 # remove this 'feature' because it didn't work
50 50 # all the time, and so is better to not bother
51   - # since Moose will handle the defaults just
  51 + # since Mouse will handle the defaults just
52 52 # fine anyway.
53 53 # - SL
54 54 #( exists $opt->{default} ? (default => $opt->{default}) : () ),
@@ -64,7 +64,7 @@ sub _gld_spec {
64 64 return ( \@options, \%name_to_init_arg );
65 65 }
66 66
67   -no Moose::Role;
  67 +no Mouse::Role;
68 68
69 69 1;
70 70
@@ -72,9 +72,9 @@ no Moose::Role;
72 72
73 73 ## In your class
74 74 package My::App;
75   - use Moose;
  75 + use Mouse;
76 76
77   - with 'MooseX::Getopt::GLD';
  77 + with 'MouseX::Getopt::GLD';
78 78
79 79 has 'out' => (is => 'rw', isa => 'Str', required => 1);
80 80 has 'in' => (is => 'rw', isa => 'Str', required => 1);
28 lib/MooseX/Getopt/Meta/Attribute.pm → lib/MouseX/Getopt/Meta/Attribute.pm
... ... @@ -1,40 +1,40 @@
1   -package MooseX::Getopt::Meta::Attribute;
  1 +package MouseX::Getopt::Meta::Attribute;
2 2 # ABSTRACT: Optional meta attribute for custom option names
3 3
4   -use Moose;
5   -use Moose::Util::TypeConstraints;
  4 +use Mouse;
  5 +use Mouse::Util::TypeConstraints;
6 6
7   -extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)
8   - with 'MooseX::Getopt::Meta::Attribute::Trait';
  7 +extends 'Mouse::Meta::Attribute'; # << Mouse extending Mouse :)
  8 + with 'MouseX::Getopt::Meta::Attribute::Trait';
9 9
10   -no Moose;
  10 +no Mouse;
11 11
12 12 # register this as a metaclass alias ...
13 13 package # stop confusing PAUSE
14   - Moose::Meta::Attribute::Custom::Getopt;
15   -sub register_implementation { 'MooseX::Getopt::Meta::Attribute' }
  14 + Mouse::Meta::Attribute::Custom::Getopt;
  15 +sub register_implementation { 'MouseX::Getopt::Meta::Attribute' }
16 16
17 17 1;
18 18
19 19 =head1 SYNOPSIS
20 20
21 21 package App;
22   - use Moose;
  22 + use Mouse;
23 23
24   - with 'MooseX::Getopt';
  24 + with 'MouseX::Getopt';
25 25
26 26 has 'data' => (
27   - metaclass => 'MooseX::Getopt::Meta::Attribute',
  27 + metaclass => 'MouseX::Getopt::Meta::Attribute',
28 28 is => 'ro',
29 29 isa => 'Str',
30 30 default => 'file.dat',
31 31
32   - # tells MooseX::Getopt to use --somedata as the
  32 + # tells MouseX::Getopt to use --somedata as the
33 33 # command line flag instead of the normal
34 34 # autogenerated one (--data)
35 35 cmd_flag => 'somedata',
36 36
37   - # tells MooseX::Getopt to also allow --moosedata,
  37 + # tells MouseX::Getopt to also allow --moosedata,
38 38 # -m, and -d as aliases for this same option on
39 39 # the commandline.
40 40 cmd_aliases => [qw/ moosedata m d /],
@@ -47,7 +47,7 @@ sub register_implementation { 'MooseX::Getopt::Meta::Attribute' }
47 47
48 48 This is a custom attribute metaclass which can be used to specify a
49 49 the specific command line flag to use instead of the default one
50   -which L<MooseX::Getopt> will create for you.
  50 +which L<MouseX::Getopt> will create for you.
51 51
52 52 This is certainly not the prettiest way to go about this, but for
53 53 now it works for those who might need such a feature.
20 lib/MooseX/Getopt/Meta/Attribute/NoGetopt.pm → lib/MouseX/Getopt/Meta/Attribute/NoGetopt.pm
... ... @@ -1,26 +1,26 @@
1   -package MooseX::Getopt::Meta::Attribute::NoGetopt;
  1 +package MouseX::Getopt::Meta::Attribute::NoGetopt;
2 2 # ABSTRACT: Optional meta attribute for ignoring params
3 3
4   -use Moose;
  4 +use Mouse;
5 5
6   -extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)
7   - with 'MooseX::Getopt::Meta::Attribute::Trait::NoGetopt';
  6 +extends 'Mouse::Meta::Attribute'; # << Mouse extending Mouse :)
  7 + with 'MouseX::Getopt::Meta::Attribute::Trait::NoGetopt';
8 8
9   -no Moose;
  9 +no Mouse;
10 10
11 11 # register this as a metaclass alias ...
12 12 package # stop confusing PAUSE
13   - Moose::Meta::Attribute::Custom::NoGetopt;
14   -sub register_implementation { 'MooseX::Getopt::Meta::Attribute::NoGetopt' }
  13 + Mouse::Meta::Attribute::Custom::NoGetopt;
  14 +sub register_implementation { 'MouseX::Getopt::Meta::Attribute::NoGetopt' }
15 15
16 16 1;
17 17
18 18 =head1 SYNOPSIS
19 19
20 20 package App;
21   - use Moose;
  21 + use Mouse;
22 22
23   - with 'MooseX::Getopt';
  23 + with 'MouseX::Getopt';
24 24
25 25 has 'data' => (
26 26 metaclass => 'NoGetopt', # do not attempt to capture this param
@@ -33,7 +33,7 @@ sub register_implementation { 'MooseX::Getopt::Meta::Attribute::NoGetopt' }
33 33
34 34 This is a custom attribute metaclass which can be used to specify
35 35 that a specific attribute should B<not> be processed by
36   -C<MooseX::Getopt>. All you need to do is specify the C<NoGetopt>
  36 +C<MouseX::Getopt>. All you need to do is specify the C<NoGetopt>
37 37 metaclass.
38 38
39 39 has 'foo' => (metaclass => 'NoGetopt', ... );
30 lib/MooseX/Getopt/Meta/Attribute/Trait.pm → lib/MouseX/Getopt/Meta/Attribute/Trait.pm
... ... @@ -1,8 +1,8 @@
1   -package MooseX::Getopt::Meta::Attribute::Trait;
  1 +package MouseX::Getopt::Meta::Attribute::Trait;
2 2 # ABSTRACT: Optional meta attribute trait for custom option names
3 3
4   -use Moose::Role;
5   -use Moose::Util::TypeConstraints;
  4 +use Mouse::Role;
  5 +use Mouse::Util::TypeConstraints;
6 6
7 7 has 'cmd_flag' => (
8 8 is => 'rw',
@@ -12,35 +12,35 @@ has 'cmd_flag' => (
12 12
13 13 # This subtype is to support scalar -> arrayref coercion
14 14 # without polluting the built-in types
15   -subtype '_MooseX_Getopt_CmdAliases' => as 'ArrayRef';
  15 +subtype '_MouseX_Getopt_CmdAliases' => as 'ArrayRef';
16 16
17   -coerce '_MooseX_Getopt_CmdAliases'
  17 +coerce '_MouseX_Getopt_CmdAliases'
18 18 => from 'Str'
19 19 => via { [$_] };
20 20
21 21 has 'cmd_aliases' => (
22 22 is => 'rw',
23   - isa => '_MooseX_Getopt_CmdAliases',
  23 + isa => '_MouseX_Getopt_CmdAliases',
24 24 predicate => 'has_cmd_aliases',
25 25 coerce => 1,
26 26 );
27 27
28   -no Moose::Util::TypeConstraints;
29   -no Moose::Role;
  28 +no Mouse::Util::TypeConstraints;
  29 +no Mouse::Role;
30 30
31 31 # register this as a metaclass alias ...
32 32 package # stop confusing PAUSE
33   - Moose::Meta::Attribute::Custom::Trait::Getopt;
34   -sub register_implementation { 'MooseX::Getopt::Meta::Attribute::Trait' }
  33 + Mouse::Meta::Attribute::Custom::Trait::Getopt;
  34 +sub register_implementation { 'MouseX::Getopt::Meta::Attribute::Trait' }
35 35
36 36 1;
37 37
38 38 =head1 SYNOPSIS
39 39
40 40 package App;
41   - use Moose;
  41 + use Mouse;
42 42
43   - with 'MooseX::Getopt';
  43 + with 'MouseX::Getopt';
44 44
45 45 has 'data' => (
46 46 traits => [ 'Getopt' ],
@@ -48,12 +48,12 @@ sub register_implementation { 'MooseX::Getopt::Meta::Attribute::Trait' }
48 48 isa => 'Str',
49 49 default => 'file.dat',
50 50
51   - # tells MooseX::Getopt to use --somedata as the
  51 + # tells MouseX::Getopt to use --somedata as the
52 52 # command line flag instead of the normal
53 53 # autogenerated one (--data)
54 54 cmd_flag => 'somedata',
55 55
56   - # tells MooseX::Getopt to also allow --moosedata,
  56 + # tells MouseX::Getopt to also allow --moosedata,
57 57 # -m, and -d as aliases for this same option on
58 58 # the commandline.
59 59 cmd_aliases => [qw/ moosedata m d /],
@@ -66,7 +66,7 @@ sub register_implementation { 'MooseX::Getopt::Meta::Attribute::Trait' }
66 66
67 67 This is a custom attribute metaclass trait which can be used to
68 68 specify a the specific command line flag to use instead of the
69   -default one which L<MooseX::Getopt> will create for you.
  69 +default one which L<MouseX::Getopt> will create for you.
70 70
71 71 =method B<cmd_flag>
72 72
16 lib/MooseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm → lib/MouseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm
... ... @@ -1,22 +1,22 @@
1   -package MooseX::Getopt::Meta::Attribute::Trait::NoGetopt;
  1 +package MouseX::Getopt::Meta::Attribute::Trait::NoGetopt;
2 2 # ABSTRACT: Optional meta attribute trait for ignoring params
3 3
4   -use Moose::Role;
5   -no Moose::Role;
  4 +use Mouse::Role;
  5 +no Mouse::Role;
6 6
7 7 # register this as a metaclass alias ...
8 8 package # stop confusing PAUSE
9   - Moose::Meta::Attribute::Custom::Trait::NoGetopt;
10   -sub register_implementation { 'MooseX::Getopt::Meta::Attribute::Trait::NoGetopt' }
  9 + Mouse::Meta::Attribute::Custom::Trait::NoGetopt;
  10 +sub register_implementation { 'MouseX::Getopt::Meta::Attribute::Trait::NoGetopt' }
11 11
12 12 1;
13 13
14 14 =head1 SYNOPSIS
15 15
16 16 package App;
17   - use Moose;
  17 + use Mouse;
18 18
19   - with 'MooseX::Getopt';
  19 + with 'MouseX::Getopt';
20 20
21 21 has 'data' => (
22 22 traits => [ 'NoGetopt' ], # do not attempt to capture this param
@@ -29,7 +29,7 @@ sub register_implementation { 'MooseX::Getopt::Meta::Attribute::Trait::NoGetopt'
29 29
30 30 This is a custom attribute metaclass trait which can be used to
31 31 specify that a specific attribute should B<not> be processed by
32   -C<MooseX::Getopt>. All you need to do is specify the C<NoGetopt>
  32 +C<MouseX::Getopt>. All you need to do is specify the C<NoGetopt>
33 33 metaclass trait.
34 34
35 35 has 'foo' => (traits => [ 'NoGetopt', ... ], ... );
12 lib/MooseX/Getopt/OptionTypeMap.pm → lib/MouseX/Getopt/OptionTypeMap.pm
... ... @@ -1,8 +1,8 @@
1   -package MooseX::Getopt::OptionTypeMap;
  1 +package MouseX::Getopt::OptionTypeMap;
2 2 # ABSTRACT: Storage for the option to type mappings
3 3
4   -use Moose 'confess', 'blessed';
5   -use Moose::Util::TypeConstraints 'find_type_constraint';
  4 +use Mouse 'confess', 'blessed';
  5 +use Mouse::Util::TypeConstraints 'find_type_constraint';
6 6
7 7 my %option_type_map = (
8 8 'Bool' => '!',
@@ -66,14 +66,14 @@ sub add_option_type_to_map {
66 66 $option_type_map{$type_name} = $option_string;
67 67 }
68 68
69   -no Moose::Util::TypeConstraints;
70   -no Moose;
  69 +no Mouse::Util::TypeConstraints;
  70 +no Mouse;
71 71
72 72 1;
73 73
74 74 =head1 DESCRIPTION
75 75
76   -See the I<Custom Type Constraints> section in the L<MooseX::Getopt> docs
  76 +See the I<Custom Type Constraints> section in the L<MouseX::Getopt> docs
77 77 for more info about how to use this module.
78 78
79 79 =method B<has_option_type ($type_or_name)>
12 lib/MooseX/Getopt/Strict.pm → lib/MouseX/Getopt/Strict.pm
... ... @@ -1,25 +1,25 @@
1   -package MooseX::Getopt::Strict;
  1 +package MouseX::Getopt::Strict;
2 2 # ABSTRACT: only make options for attrs with the Getopt metaclass
3 3
4   -use Moose::Role;
  4 +use Mouse::Role;
5 5
6   -with 'MooseX::Getopt';
  6 +with 'MouseX::Getopt';
7 7
8 8 around '_compute_getopt_attrs' => sub {
9 9 my $next = shift;
10 10 my ( $class, @args ) = @_;
11 11 grep {
12   - $_->does("MooseX::Getopt::Meta::Attribute::Trait")
  12 + $_->does("MouseX::Getopt::Meta::Attribute::Trait")
13 13 } $class->$next(@args);
14 14 };
15 15
16   -no Moose::Role;
  16 +no Mouse::Role;
17 17
18 18 1;
19 19
20 20 =head1 DESCRIPTION
21 21
22   -This is an stricter version of C<MooseX::Getopt> which only processes the
  22 +This is an stricter version of C<MouseX::Getopt> which only processes the
23 23 attributes if they explicitly set as C<Getopt> attributes. All other attributes
24 24 are ignored by the command line handler.
25 25
2  t/000_load.t
@@ -6,5 +6,5 @@ use warnings;
6 6 use Test::More tests => 1;
7 7
8 8 BEGIN {
9   - use_ok('MooseX::Getopt');
  9 + use_ok('MouseX::Getopt');
10 10 }
16 t/001_basic.t
@@ -6,17 +6,17 @@ use warnings;
6 6 use Test::More tests => 69;
7 7
8 8 BEGIN {
9   - use_ok('MooseX::Getopt');
  9 + use_ok('MouseX::Getopt');
10 10 }
11 11
12 12 {
13 13 package App;
14   - use Moose;
  14 + use Mouse;
15 15
16   - with 'MooseX::Getopt';
  16 + with 'MouseX::Getopt';
17 17
18 18 has 'data' => (
19   - metaclass => 'MooseX::Getopt::Meta::Attribute',
  19 + metaclass => 'MouseX::Getopt::Meta::Attribute',
20 20 is => 'ro',
21 21 isa => 'Str',
22 22 default => 'file.dat',
@@ -32,7 +32,7 @@ BEGIN {
32 32 );
33 33
34 34 has 'horse' => (
35   - metaclass => 'MooseX::Getopt::Meta::Attribute',
  35 + metaclass => 'MouseX::Getopt::Meta::Attribute',
36 36 is => 'ro',
37 37 isa => 'Str',
38 38 default => 'bray',
@@ -70,7 +70,7 @@ BEGIN {
70 70 );
71 71
72 72 has '_private_stuff_cmdline' => (
73   - metaclass => 'MooseX::Getopt::Meta::Attribute',
  73 + metaclass => 'MouseX::Getopt::Meta::Attribute',
74 74 is => 'ro',
75 75 isa => 'Int',
76 76 default => 832,
@@ -81,8 +81,8 @@ BEGIN {
81 81
82 82 foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
83 83 my $attr = App->meta->get_attribute($attr_name);
84   - isa_ok($attr, 'Moose::Meta::Attribute');
85   - isa_ok($attr, 'MooseX::Getopt::Meta::Attribute');
  84 + isa_ok($attr, 'Mouse::Meta::Attribute');
  85 + isa_ok($attr, 'MouseX::Getopt::Meta::Attribute');
86 86 can_ok($attr, 'cmd_flag');
87 87 can_ok($attr, 'cmd_aliases');
88 88 }
10 t/002_custom_option_type.t
@@ -6,23 +6,23 @@ use warnings;
6 6 use Test::More tests => 6;
7 7
8 8 BEGIN {
9   - use_ok('MooseX::Getopt');
  9 + use_ok('MouseX::Getopt');
10 10 }
11 11
12 12 {
13 13 package App;
14   - use Moose;
15   - use Moose::Util::TypeConstraints;
  14 + use Mouse;
  15 + use Mouse::Util::TypeConstraints;
16 16
17 17 use Scalar::Util 'looks_like_number';
18 18
19   - with 'MooseX::Getopt';
  19 + with 'MouseX::Getopt';
20 20
21 21 subtype 'ArrayOfInts'
22 22 => as 'ArrayRef'
23 23 => where { scalar (grep { looks_like_number($_) } @$_) };
24 24
25   - MooseX::Getopt::OptionTypeMap->add_option_type_to_map(
  25 + MouseX::Getopt::OptionTypeMap->add_option_type_to_map(
26 26 'ArrayOfInts' => '=i@'
27 27 );
28 28
8 t/003_inferred_option_type.t
@@ -6,17 +6,17 @@ use warnings;
6 6 use Test::More tests => 5;
7 7
8 8 BEGIN {
9   - use_ok('MooseX::Getopt');
  9 + use_ok('MouseX::Getopt');
10 10 }
11 11
12 12 {
13 13 package App;
14   - use Moose;
15   - use Moose::Util::TypeConstraints;
  14 + use Mouse;
  15 + use Mouse::Util::TypeConstraints;
16 16
17 17 use Scalar::Util 'looks_like_number';
18 18
19   - with 'MooseX::Getopt';
  19 + with 'MouseX::Getopt';
20 20
21 21 subtype 'ArrayOfInts'
22 22 => as 'ArrayRef'
6 t/004_nogetop.t
@@ -7,14 +7,14 @@ use Test::More tests => 9;
7 7 use Test::Exception;
8 8
9 9 BEGIN {
10   - use_ok('MooseX::Getopt');
  10 + use_ok('MouseX::Getopt');
11 11 }
12 12
13 13 {
14 14 package App;
15   - use Moose;
  15 + use Mouse;
16 16
17   - with 'MooseX::Getopt';
  17 + with 'MouseX::Getopt';
18 18
19 19 has 'data' => (
20 20 metaclass => 'Getopt',
6 t/005_strict.t
@@ -7,15 +7,15 @@ use Test::More tests => 10;
7 7 use Test::Exception;
8 8
9 9 BEGIN {
10   - use_ok('MooseX::Getopt');
  10 + use_ok('MouseX::Getopt');
11 11 }
12 12
13 13 {
14 14
15 15 package App;
16   - use Moose;
  16 + use Mouse;
17 17
18   - with 'MooseX::Getopt::Strict';
  18 + with 'MouseX::Getopt::Strict';
19 19
20 20 has 'data' => (
21 21 metaclass => 'Getopt',
14 t/006_metaclass_traits.t
@@ -4,20 +4,20 @@ use strict;
4 4 use warnings;
5 5
6 6 use Test::More tests => 69;
7   -use Test::Moose;
  7 +use Test::Mouse;
8 8
9 9 BEGIN {
10   - use_ok('MooseX::Getopt');
  10 + use_ok('MouseX::Getopt');
11 11 }
12 12
13 13 {
14 14 package App;
15   - use Moose;
  15 + use Mouse;
16 16
17   - with 'MooseX::Getopt';
  17 + with 'MouseX::Getopt';
18 18
19 19 has 'data' => (
20   - traits => [ 'MooseX::Getopt::Meta::Attribute::Trait' ],
  20 + traits => [ 'MouseX::Getopt::Meta::Attribute::Trait' ],
21 21 is => 'ro',
22 22 isa => 'Str',
23 23 default => 'file.dat',
@@ -82,8 +82,8 @@ BEGIN {
82 82
83 83 foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
84 84 my $attr = App->meta->get_attribute($attr_name);
85   - isa_ok($attr, 'Moose::Meta::Attribute');
86   - does_ok($attr, 'MooseX::Getopt::Meta::Attribute::Trait');
  85 + isa_ok($attr, 'Mouse::Meta::Attribute');
  86 + does_ok($attr, 'MouseX::Getopt::Meta::Attribute::Trait');
87 87
88 88 can_ok($attr, 'cmd_flag');
89 89 can_ok($attr, 'cmd_aliases');
6 t/007_nogetopt_trait.t
@@ -7,14 +7,14 @@ use Test::More tests => 9;
7 7 use Test::Exception;
8 8
9 9 BEGIN {
10   - use_ok('MooseX::Getopt');
  10 + use_ok('MouseX::Getopt');
11 11 }
12 12
13 13 {
14 14 package App;
15   - use Moose;
  15 + use Mouse;
16 16
17   - with 'MooseX::Getopt';
  17 + with 'MouseX::Getopt';
18 18
19 19 has 'data' => (
20 20 traits => ['Getopt'],
22 t/008_configfromfile.t
@@ -7,9 +7,9 @@ use Test::Exception;
7 7 use Test::More;
8 8 use File::Spec;
9 9
10   -if ( !eval { require MooseX::ConfigFromFile } )
  10 +if ( !eval { require MouseX::ConfigFromFile } )
11 11 {
12   - plan skip_all => 'Test requires MooseX::ConfigFromFile';
  12 + plan skip_all => 'Test requires MouseX::ConfigFromFile';
13 13 }
14 14 else
15 15 {
@@ -19,9 +19,9 @@ else
19 19 {
20 20 package App;
21 21
22   - use Moose;
23   - with 'MooseX::Getopt';
24   - with 'MooseX::ConfigFromFile';
  22 + use Mouse;
  23 + with 'MouseX::Getopt';
  24 + with 'MouseX::ConfigFromFile';
25 25
26 26 has 'config_from_override' => (
27 27 is => 'ro',
@@ -68,7 +68,7 @@ else
68 68 {
69 69 package App::DefaultConfigFile;
70 70
71   - use Moose;
  71 + use Mouse;
72 72 extends 'App';
73 73
74 74 has '+configfile' => (
@@ -79,7 +79,7 @@ else
79 79 {
80 80 package App::DefaultConfigFileCodeRef;
81 81
82   - use Moose;
  82 + use Mouse;
83 83 extends 'App';
84 84
85 85 has '+configfile' => (
@@ -193,17 +193,17 @@ else
193 193
194 194 {
195 195 package BaseApp::WithConfig;
196   - use Moose;
197   - with 'MooseX::ConfigFromFile';
  196 + use Mouse;
  197 + with 'MouseX::ConfigFromFile';
198 198
199 199 sub get_config_from_file { return {}; }
200 200 }
201 201
202 202 {
203 203 package DerivedApp::Getopt;
204   - use Moose;
  204 + use Mouse;
205 205 extends 'BaseApp::WithConfig';
206   - with 'MooseX::Getopt';
  206 + with 'MouseX::Getopt';
207 207 }
208 208
209 209 # With DerivedApp, the Getopt role was applied at a different level
6 t/009_gld_and_explicit_options.t
@@ -10,14 +10,14 @@ BEGIN {
10 10 eval 'use Getopt::Long::Descriptive;';
11 11 plan skip_all => "Getopt::Long::Descriptive required for this test" if $@;
12 12 plan tests => 5;
13   - use_ok('MooseX::Getopt');
  13 + use_ok('MouseX::Getopt');
14 14 }
15 15
16 16 {
17 17 package Testing::Foo;
18   - use Moose;
  18 + use Mouse;
19 19
20   - with 'MooseX::Getopt';
  20 + with 'MouseX::Getopt';
21 21
22 22 has 'bar' => (
23 23 is => 'ro',
6 t/010_dashes.t
@@ -9,14 +9,14 @@ use Test::Exception;
9 9
10 10
11 11 BEGIN {
12   - use_ok('MooseX::Getopt');
  12 + use_ok('MouseX::Getopt');
13 13 }
14 14
15 15 {
16 16 package App;
17   - use Moose;
  17 + use Mouse;
18 18
19   - with 'MooseX::Getopt::Dashes';
  19 + with 'MouseX::Getopt::Dashes';
20 20
21 21 has 'some_thingy' => ( is => 'ro', isa => 'Str', default => 'foo' );
22 22 has 'another_thingy' => ( is => 'ro', isa => 'Str', default => 'foo', cmd_flag => 'another_thingy', traits => [ 'Getopt' ], );
6 t/100_gld_default_bug.t
@@ -10,14 +10,14 @@ BEGIN {
10 10 eval 'use Getopt::Long::Descriptive;';
11 11 plan skip_all => "Getopt::Long::Descriptive required for this test" if $@;
12 12 plan tests => 5;
13   - use_ok('MooseX::Getopt');
  13 + use_ok('MouseX::Getopt');
14 14 }
15 15
16 16 {
17 17 package Engine::Foo;
18   - use Moose;
  18 + use Mouse;
19 19
20   - with 'MooseX::Getopt';
  20 + with 'MouseX::Getopt';
21 21
22 22 has 'nproc' => (
23 23 metaclass => 'Getopt',
8 t/101_argv_bug.t
@@ -5,13 +5,13 @@ use warnings;
5 5
6 6 use Test::More tests => 3;
7 7
8   -use MooseX::Getopt;
  8 +use MouseX::Getopt;
9 9
10 10 {
11 11 package App;
12   - use Moose;
  12 + use Mouse;
13 13
14   - with 'MooseX::Getopt';
  14 + with 'MouseX::Getopt';
15 15
16 16 has 'length' => (
17 17 is => 'ro',
@@ -24,7 +24,7 @@ use MooseX::Getopt;
24 24 isa => 'Bool',
25 25 default => 0,
26 26 );
27   - no Moose;
  27 + no Mouse;
28 28 }
29 29
30 30 {
16 t/102_basic_basic.t
@@ -6,17 +6,17 @@ use warnings;
6 6 use Test::More tests => 69;
7 7
8 8 BEGIN {
9   - use_ok('MooseX::Getopt::Basic');
  9 + use_ok('MouseX::Getopt::Basic');
10 10 }
11 11
12 12 {
13 13 package App;
14   - use Moose;
  14 + use Mouse;
15 15
16   - with 'MooseX::Getopt::Basic';
  16 + with 'MouseX::Getopt::Basic';
17 17
18 18 has 'data' => (
19   - metaclass => 'MooseX::Getopt::Meta::Attribute',
  19 + metaclass => 'MouseX::Getopt::Meta::Attribute',
20 20 is => 'ro',
21 21 isa => 'Str',
22 22 default => 'file.dat',
@@ -32,7 +32,7 @@ BEGIN {
32 32 );
33 33
34 34 has 'horse' => (
35   - metaclass => 'MooseX::Getopt::Meta::Attribute',
  35 + metaclass => 'MouseX::Getopt::Meta::Attribute',
36 36 is => 'ro',
37 37 isa => 'Str',
38 38 default => 'bray',
@@ -70,7 +70,7 @@ BEGIN {
70 70 );
71 71
72 72 has '_private_stuff_cmdline' => (
73   - metaclass => 'MooseX::Getopt::Meta::Attribute',
  73 + metaclass => 'MouseX::Getopt::Meta::Attribute',
74 74 is => 'ro',
75 75 isa => 'Int',
76 76 default => 832,
@@ -81,8 +81,8 @@ BEGIN {
81 81
82 82 foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) {
83 83 my $attr = App->meta->get_attribute($attr_name);
84   - isa_ok($attr, 'Moose::Meta::Attribute');
85   - isa_ok($attr, 'MooseX::Getopt::Meta::Attribute');
  84 + isa_ok($attr, 'Mouse::Meta::Attribute');
  85 + isa_ok($attr, 'MouseX::Getopt::Meta::Attribute');
86 86 can_ok($attr, 'cmd_flag');
87 87 can_ok($attr, 'cmd_aliases');
88 88 }
4 t/103_uc_bug.t
@@ -7,8 +7,8 @@ use Test::More tests => 3;
7 7
8 8 {
9 9 package App;
10   - use Moose;
11   - with qw(MooseX::Getopt);
  10 + use Mouse;
  11 + with qw(MouseX::Getopt);
12 12
13 13 has 'TrackingNumber' => (
14 14 is => 'rw',
4 t/104_override_usage.t
@@ -5,9 +5,9 @@ use Test::Exception;
5 5
6 6 {
7 7 package MyScript;
8   - use Moose;
  8 + use Mouse;
9 9
10   - with 'MooseX::Getopt';
  10 + with 'MouseX::Getopt';
11 11
12 12 has foo => ( isa => 'Int', is => 'ro', documentation => 'A foo' );
13 13
16 t/105_uc_bug_more.t
... ... @@ -1,18 +1,18 @@
1 1 use strict;
2 2 use warnings;
3 3 use Test::More;
4   -use Moose ();
5   -use Moose::Meta::Class;
  4 +use Mouse ();
  5 +use Mouse::Meta::Class;
6 6
7 7 foreach my $role (qw/
8   - MooseX::Getopt
9   - MooseX::Getopt::GLD
10   - MooseX::Getopt::Basic
  8 + MouseX::Getopt
  9 + MouseX::Getopt::GLD
  10 + MouseX::Getopt::Basic
11 11 /) {
12   - Class::MOP::load_class($role);
  12 + Mouse::Util::load_class($role);
13 13
14   - my $meta = Moose::Meta::Class->create_anon_class(
15   - superclasses => ['Moose::Object'],
  14 + my $meta = Mouse::Meta::Class->create_anon_class(
  15 + superclasses => ['Mouse::Object'],
16 16 );
17 17 $meta->add_attribute('Debug', traits => ['Getopt'], isa => 'Bool',
18 18 cmd_aliases => ['d'], is => 'ro');
16 t/106_no_ignore_case.t
... ... @@ -1,18 +1,18 @@
1 1 use strict;
2 2 use warnings;
3 3 use Test::More;
4   -use Moose ();
5   -use Moose::Meta::Class;
  4 +use Mouse ();
  5 +use Mouse::Meta::Class;
6 6
7 7 foreach my $role (qw/
8   - MooseX::Getopt
9   - MooseX::Getopt::GLD
10   - MooseX::Getopt::Basic
  8 + MouseX::Getopt
  9 + MouseX::Getopt::GLD
  10 + MouseX::Getopt::Basic
11 11 /) {
12   - Class::MOP::load_class($role);
  12 + Mouse::Util::load_class($role);
13 13
14