Build.PL100644000765000024 313112507103627 14550 0ustar00gfxstaff000000000000MouseX-Getopt-0.36# ========================================================================= # THIS FILE IS AUTOMATICALLY GENERATED BY MINILLA. # DO NOT EDIT DIRECTLY. # ========================================================================= use 5.008_001; use strict; use warnings; use utf8; use Module::Build; use File::Basename; use File::Spec; my %args = ( license => 'perl', dynamic_config => 0, configure_requires => { 'Module::Build' => 0.38, }, name => 'MouseX-Getopt', module_name => 'MouseX::Getopt', allow_pureperl => 0, script_files => [glob('script/*'), glob('bin/*')], c_source => [qw()], PL_files => {}, test_files => ((-d '.git' || $ENV{RELEASE_TESTING}) && -d 'xt') ? 't/ xt/' : 't/', recursive_test_files => 1, ); if (-d 'share') { $args{share_dir} = 'share'; } my $builder = Module::Build->subclass( class => 'MyBuilder', code => q{ sub ACTION_distmeta { die "Do not run distmeta. Install Minilla and `minil install` instead.\n"; } sub ACTION_installdeps { die "Do not run installdeps. Run `cpanm --installdeps .` instead.\n"; } } )->new(%args); $builder->create_build_script(); use File::Copy; print "cp META.json MYMETA.json\n"; copy("META.json","MYMETA.json") or die "Copy failed(META.json): $!"; if (-f 'META.yml') { print "cp META.yml MYMETA.yml\n"; copy("META.yml","MYMETA.yml") or die "Copy failed(META.yml): $!"; } else { print "There is no META.yml... You may install this module from the repository...\n"; } Changes100644000765000024 2150312507103627 14572 0ustar00gfxstaff000000000000MouseX-Getopt-0.36Revision history for Perl extension MouseX-Getopt 0.36 2015-04-02T00:04:11Z * Fix tests that follow GLD changes (#6) 0.35 2014-03-10T07:02:02Z * GLD 0.097 no longer defaults to no_ignore_case https://rt.cpan.org/Public/Bug/Display.html?id=93593 See also https://github.com/moose/MooseX-Getopt/commit/c8459ee3ab47cdd7e0b1ccde1787f 0.32 Thu Jul 29 20:21:56 JST 2010 * added workaround for $@ issue in Data::Util. 0.31 Mon Jul 26 20:52:38 2010 * Just copied from MooseX-Getopt 0.31. See MouseX-Getopt.diff for details. NOTE: This distribution is a copy of MooseX-Getopt, so the following history is that of MooseX-Getopt's, not MouseX-Geopt's. 0.31 Wed 7 Jul 2010 * Fix issue causing tests to fail if MooseX::SimpleConfig isn't installed. 0.30 Tue 6 Jul 2010 * MooseX::Getopt::Basic - uses attribute insertion order when determining the order in which options are documented in the usage (e.g. in $obj->usage->text). (Karen Etheridge) * MooseX::Getopt::Basic - store the usage object to the usage attr (RT#58715) - properly checks whether the *option* --help, --usage, or --? were used, rather than the attribute 'help', 'usage' or '?' were set * MooseX::Getopt::GLD - add the usage attribute for storing the Getopt::Long::Descriptive::Usage object, and the help attribute for storing --help, --usage and --? state (RT#47865, RT#56783, RT#52474). (Karen Etheridge) * MooseX::Getopt::Basic - Disable auto_help config in Getopt::Long, to avoid calling into pod2usage when the --help option is used while MooseX::ConfigFromFile is in use (the intent is just to fetch the value of the configfile option) (RT#57683). (Karen Etheridge) 0.29 Tue. Jun 15 2010 * Fix repository metadata. Thanks Robert Bohne for noticing! 0.28 Sat. Jun 05 2010 * MooseX::Getopt::Strict - Make it work with Getopt attribute traits in addition to attribute metaclasses. * Switch from Module::Install to Dist::Zilla. 0.27 Sun. Feb 10 2010 * Makefile.PL: - Bump dependency to Getopt::Long::Descriptive to 0.081 in an attempt to avoid test failures. * MooseX::Getopt::Dashes - Document that using a cmd_flag argument to attributes can be used to override the tr/_/-/ replacement ::Dashes does on attribute names 0.26 Thu. Dec 10 2009 * MooseX::Getopt::Basic - Fix bug with attribute names containing upper case letters. * Test suite: - Add t/106_no_ignore_case.t for testing the compatibility with no_ignore_case 0.25 Thu. Nov 26 2009 * MooseX::Getopt - Split out the warnings and the exception from Getopt so that they can be overridden. - Split out calling ->die on Getopt::Long::Descriptive::Usage so that it can be overridden. - Properly split roles as promised in 0.22. 0.24 Fri. Oct 23 2009 * MooseX::Getopt - Fix bug with mixed case attribute names (MAROS) 0.23 Fri. Oct 02 2009 * MooseX::Getopt - Allow the config file to return a code ref which is called to return the config file location (Gordon Irving) 0.22 Sat. Sept 05 2009 - Require GLD 0.077 for RT#49427 as some versions are broken * MooseX::Getopt - Split into MooseX::Getopt::Basic (without the G::L::Descriptive support) and MooseX::Getopt::GLD. * Tests - Ensure author tests get run when in author mode. 0.21 Thu. Aug 27 2009 * MooseX::Getopt - Enable and document the argv parameter to the constructor. - Applied patches in RT43200 and RT43255 - Applied patch from RT#47766 to not die if SimpleConfig cannot find the default config file name. 0.20 Wed. July 9 2009 - fix MANIFEST.SKIP to avoid double-packaging 0.19 Wed. July 8 2009 * MooseX::Getopt - Fix Getopt config spec for --configfile (t0m) - Add support for --usage/--help/--? (drew@drewtaylor.com) - Fix new_with_options to accept a hashref (DOUGDUDE@cpan.org) * Tests - Fix warning from tests with new Moose (t0m) - Fix tests on Win32 from RT#44909 (taro-nishino) 0.18 Thu. April 9 2009 * MooseX::Getopt::Dashes - New module, for converting undercores to dashes (ilmari) 0.17 Wed. April 8 2009 * MooseX::Getopt - work with latest Moose (hdp) ~ unify module version numbers with dist version (hdp) 0.16 Tue. February 17 2009 * t/ - run pod tests only if RELEASE_TESTING env var is set 0.15 Sat. July 26 2008 * MooseX::Getopt::OptionTypeMap - Accept type constraint objects in the type mapping, not just names 0.14 Thurs. July 10, 2008 * MooseX::Getopt::OptionTypeMap - Change 'Float' which doesn't exist to 'Num' which does (perigrin) * MooseX::Getopt - removed the default handling with Getopt::Long::Descriptive as it would override constructor parameters and that was bad. Besides, Moose will just DWIM on this anyway. (stevan) - added test for it (stevan) * t/ - fixed Getopt::Long::Descriptive specific tests to only run if Getopt::Long::Descriptive is there (stevan) 0.13 Saturday, May 24, 2008 * MooseX::Getopt - Commandline option shouldn't be required in the case that the given "required" attribute has been loaded from config (MooseX::ConfigFromFile) - Support for MooseX::ConfigFromFile shouldn't require that role be added at the same level as Getopt. - fixed miscapitalization of NoGetopt in the docs - added links to the traits in the docs ~ converted to Module::Install instead of Module::Build 0.12 Fri. March 14, 2008 ~~ updated copyright dates ~~ - upped the Moose dependency to support the custom metaclass traits - added Getopt::Long::Descriptive as an optional dependency * MooseX::Getopt MooseX::Getopt::Meta::Attribute MooseX::Getopt::Meta::Attribute::Trait MooseX::Getopt::Meta::Attribute::NoGetopt MooseX::Getopt::Meta::Attribute::Trait::NoGetopt - added support for custom metaclass traits - added tests for this 0.11 Sun. Jan. 27, 2008 * MooseX::Getopt - Commandline option shouldn't be required in the case that the given "required" attribute has a default or a builder method. 0.10 Wed. Jan. 23, 2008 * MooseX::Getopt - Support default configfile attribute when used with MooseX::ConfigFromFile-based roles 0.09 Tues. Jan. 22, 2008 * MooseX::Getopt - Use Getopt::Long::Descriptive if it's available 0.08 Tues. Dec. 8, 2007 * MooseX::Getopt - Added support for configfile loading via MooseX::ConfigFromFile-based roles with the -configfile commandline option. 0.07 Tues. Dec. 4, 2007 * MooseX::Getopt::Meta::Attribute::NoGetopt - fixed miscapitalization of NoGetopt in the docs 0.06 Fri. Nov. 23, 2007 * MooseX::Getopt - refactored &new_with_option some so that this will work better with other Getopt modules (nuffin) + MooseX::Getopt::Strict - version of MooseX::Getopt which requires you to specify which attributes you want processed explicity - added tests for this + MooseX::Getopt::Meta::Attribute::NoGetopt - a custom meta-attribute which can be used to specify that an attribute should not be processed - added tests for this 0.05 Tues. July 3, 2007 * MooseX::Getopt::OptionTypeMap - added some checks to make sure that the type constraints are found properly and to give better diagnostics 0.04 Tues. June 26, 2007 * MooseX::Getopt::OptionTypeMap - Added support for subtype constraint inference from parent types - added tests and docs for this * MooseX::Getopt - Added extra_argv attribute - added tests and docs for this - We now unmangle the Getopt::Long-mangled @ARGV - added tests and docs for this - We now throw an exception from new_with_options if Getopt fails due to bad arguments. - added tests and docs for this 0.03 Wed. May 2nd, 2007 ~ downgraded the Getopt version requirement to 2.35 as per RT #26844 ~ adding blblack to the authors list * MooseX::Getopt - doc update to show simple way to of excluding an attribute, but not having accessors with underscores (thanks to Zaba on #moose for this) * MooseX::Getopt::Meta::Attribute - tightening up the type constraint in the cmd_alias coercion to only accept strings 0.02 Friday, April 6, 2007 * MooseX::Getopt - added the ARGV attribute (thanks to blblack) - added tests and docs for this * MooseX::Getopt::Meta::Attribute - added the cmd_aliases attribute (thanks to blblack) - added tests and docs for this - added support for Moose 0.19's custom attribute metaclass alias registry. - added tests and docs for this 0.01 Friday, March 9, 2007 - module released to CPAN LICENSE100644000765000024 4412507103627 14221 0ustar00gfxstaff000000000000MouseX-Getopt-0.36Minilla cannot detect license terms.META.json100644000765000024 1041412507103627 14717 0ustar00gfxstaff000000000000MouseX-Getopt-0.36{ "abstract" : "A Mouse role for processing command line options", "author" : [ "=over 4" ], "dynamic_config" : 0, "generated_by" : "Minilla/v2.3.0", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "MouseX-Getopt", "no_index" : { "directory" : [ "t", "xt", "inc", "share", "eg", "examples", "author", "builder" ] }, "prereqs" : { "configure" : { "requires" : { "Module::Build" : "0.38" } }, "develop" : { "requires" : { "Test::CPAN::Meta" : "0", "Test::MinimumVersion::Fast" : "0.04", "Test::PAUSE::Permissions" : "0.04", "Test::Pod" : "1.41", "Test::Spellunker" : "v0.2.7" } }, "runtime" : { "requires" : { "Getopt::Long" : "2.37", "Getopt::Long::Descriptive" : "0.091", "Mouse" : "0.64", "Mouse::Meta::Attribute" : "0", "Mouse::Role" : "0", "Mouse::Util::TypeConstraints" : "0" } }, "test" : { "requires" : { "Mouse::Meta::Class" : "0", "MouseX::ConfigFromFile" : "0", "MouseX::SimpleConfig" : "0", "Scalar::Util" : "0", "Test::Exception" : "0.21", "Test::More" : "0.88", "Test::Mouse" : "0", "Test::Warn" : "0.21" } } }, "provides" : { "MouseX::Getopt" : { "file" : "lib/MouseX/Getopt.pm", "version" : "0.36" }, "MouseX::Getopt::Basic" : { "file" : "lib/MouseX/Getopt/Basic.pm" }, "MouseX::Getopt::Dashes" : { "file" : "lib/MouseX/Getopt/Dashes.pm" }, "MouseX::Getopt::GLD" : { "file" : "lib/MouseX/Getopt/GLD.pm" }, "MouseX::Getopt::Meta::Attribute" : { "file" : "lib/MouseX/Getopt/Meta/Attribute.pm" }, "MouseX::Getopt::Meta::Attribute::NoGetopt" : { "file" : "lib/MouseX/Getopt/Meta/Attribute/NoGetopt.pm" }, "MouseX::Getopt::Meta::Attribute::Trait" : { "file" : "lib/MouseX/Getopt/Meta/Attribute/Trait.pm" }, "MouseX::Getopt::Meta::Attribute::Trait::NoGetopt" : { "file" : "lib/MouseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm" }, "MouseX::Getopt::OptionTypeMap" : { "file" : "lib/MouseX/Getopt/OptionTypeMap.pm" }, "MouseX::Getopt::Strict" : { "file" : "lib/MouseX/Getopt/Strict.pm" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/gfx/mousex-getopt/issues" }, "homepage" : "https://github.com/gfx/mousex-getopt", "repository" : { "url" : "git://github.com/gfx/mousex-getopt.git", "web" : "https://github.com/gfx/mousex-getopt" } }, "version" : "0.36", "x_authority" : "cpan:GFUJI", "x_contributors" : [ "Brandon L Black ", "Ryan D Johnson ", "Todd Hepler ", "John Goulah ", "Chris Prather ", "Stevan Little ", "Yuval Kogman ", "Dagfinn Ilmari Mannsåker ", "Hans Dieter Pearcey ", "Nelo Onyiah ", "Ricardo SIGNES ", "Devin Austin ", "Gordon Irving ", "Shlomi Fish ", "Hinrik Örn Sigurðsson ", "Tomas Doran (t0m) ", "Ævar Arnfjörð Bjarmason ", "Jesse Luehrs ", "Florian Ragwitz ", "Karen Etheridge ", "Justin Hunter ", "Tomas Doran ", "Mark Gardner ", "Tokuhiro Matsuno ", "Paul Howarth ", "FUJI Goro (gfx) " ] } README.md100644000765000024 2100512507103627 14553 0ustar00gfxstaff000000000000MouseX-Getopt-0.36# SYNOPSIS ## In your class package My::App; use Mouse; with 'MouseX::Getopt'; has 'out' => (is => 'rw', isa => 'Str', required => 1); has 'in' => (is => 'rw', isa => 'Str', required => 1); # ... rest of the class here ## in your script #!/usr/bin/perl use My::App; my $app = My::App->new_with_options(); # ... rest of the script here ## on the command line % perl my_app_script.pl -in file.input -out file.dump # DESCRIPTION This is a role which provides an alternate constructor for creating objects using parameters passed in from the command line. This module attempts to DWIM as much as possible with the command line params by introspecting your class's attributes. It will use the name of your attribute as the command line option, and if there is a type constraint defined, it will configure Getopt::Long to handle the option accordingly. You can use the trait [MouseX::Getopt::Meta::Attribute::Trait](https://metacpan.org/pod/MouseX::Getopt::Meta::Attribute::Trait) or the attribute metaclass [MouseX::Getopt::Meta::Attribute](https://metacpan.org/pod/MouseX::Getopt::Meta::Attribute) to get non-default commandline option names and aliases. You can use the trait [MouseX::Getopt::Meta::Attribute::Trait::NoGetopt](https://metacpan.org/pod/MouseX::Getopt::Meta::Attribute::Trait::NoGetopt) or the attribute metaclass [MouseX::Getopt::Meta::Attribute::NoGetopt](https://metacpan.org/pod/MouseX::Getopt::Meta::Attribute::NoGetopt) to have `MouseX::Getopt` ignore your attribute in the commandline options. By default, attributes which start with an underscore are not given commandline argument support, unless the attribute's metaclass is set to [MouseX::Getopt::Meta::Attribute](https://metacpan.org/pod/MouseX::Getopt::Meta::Attribute). If you don't want your accessors to have the leading underscore in their name, you can do this: # for read/write attributes has '_foo' => (accessor => 'foo', ...); # or for read-only attributes has '_bar' => (reader => 'bar', ...); This will mean that Getopt will not handle a --foo param, but your code can still call the `foo` method. If your class also uses a configfile-loading role based on [MouseX::ConfigFromFile](https://metacpan.org/pod/MouseX::ConfigFromFile), such as [MouseX::SimpleConfig](https://metacpan.org/pod/MouseX::SimpleConfig), [MouseX::Getopt](https://metacpan.org/pod/MouseX::Getopt)'s `new_with_options` will load the configfile specified by the `--configfile` option (or the default you've given for the configfile attribute) for you. Options specified in multiple places follow the following precedence order: commandline overrides configfile, which overrides explicit new\_with\_options parameters. ## Supported Type Constraints - _Bool_ A _Bool_ type constraint is set up as a boolean option with Getopt::Long. So that this attribute description: has 'verbose' => (is => 'rw', isa => 'Bool'); would translate into `verbose!` as a Getopt::Long option descriptor, which would enable the following command line options: % my_script.pl --verbose % my_script.pl --noverbose - _Int_, _Float_, _Str_ These type constraints are set up as properly typed options with Getopt::Long, using the `=i`, `=f` and `=s` modifiers as appropriate. - _ArrayRef_ An _ArrayRef_ type constraint is set up as a multiple value option in Getopt::Long. So that this attribute description: has 'include' => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } ); would translate into `includes=s@` as a Getopt::Long option descriptor, which would enable the following command line options: % my_script.pl --include /usr/lib --include /usr/local/lib - _HashRef_ A _HashRef_ type constraint is set up as a hash value option in Getopt::Long. So that this attribute description: has 'define' => ( is => 'rw', isa => 'HashRef', default => sub { {} } ); would translate into `define=s%` as a Getopt::Long option descriptor, which would enable the following command line options: % my_script.pl --define os=linux --define vendor=debian ## Custom Type Constraints It is possible to create custom type constraint to option spec mappings if you need them. The process is fairly simple (but a little verbose maybe). First you create a custom subtype, like so: subtype 'ArrayOfInts' => as 'ArrayRef' => where { scalar (grep { looks_like_number($_) } @$_) }; Then you register the mapping, like so: MouseX::Getopt::OptionTypeMap->add_option_type_to_map( 'ArrayOfInts' => '=i@' ); Now any attribute declarations using this type constraint will get the custom option spec. So that, this: has 'nums' => ( is => 'ro', isa => 'ArrayOfInts', default => sub { [0] } ); Will translate to the following on the command line: % my_script.pl --nums 5 --nums 88 --nums 199 This example is fairly trivial, but more complex validations are easily possible with a little creativity. The trick is balancing the type constraint validations with the Getopt::Long validations. Better examples are certainly welcome :) ## Inferred Type Constraints If you define a custom subtype which is a subtype of one of the standard ["Supported Type Constraints"](#supported-type-constraints) above, and do not explicitly provide custom support as in ["Custom Type Constraints"](#custom-type-constraints) above, MouseX::Getopt will treat it like the parent type for Getopt purposes. For example, if you had the same custom `ArrayOfInts` subtype from the examples above, but did not add a new custom option type for it to the `OptionTypeMap`, it would be treated just like a normal `ArrayRef` type for Getopt purposes (that is, `=s@`). - __new\_with\_options (%params)__ This method will take a set of default `%params` and then collect params from the command line (possibly overriding those in `%params`) and then return a newly constructed object. The special parameter `argv`, if specified should point to an array reference with an array to use instead of `@ARGV`. If ["GetOptions" in Getopt::Long](https://metacpan.org/pod/Getopt::Long#GetOptions) fails (due to invalid arguments), `new_with_options` will throw an exception. If [Getopt::Long::Descriptive](https://metacpan.org/pod/Getopt::Long::Descriptive) is installed and any of the following command line params are passed, the program will exit with usage information (and the option's state will be stored in the help\_flag attribute). You can add descriptions for each option by including a __documentation__ option for each attribute to document. --? --help --usage If you have [Getopt::Long::Descriptive](https://metacpan.org/pod/Getopt::Long::Descriptive) the `usage` param is also passed to `new` as the usage option. - __ARGV__ This accessor contains a reference to a copy of the `@ARGV` array as it originally existed at the time of `new_with_options`. - __extra\_argv__ This accessor contains an arrayref of leftover `@ARGV` elements that [Getopt::Long](https://metacpan.org/pod/Getopt::Long) did not parse. Note that the real `@ARGV` is left un-mangled. - __usage__ This accessor contains the [Getopt::Long::Descriptive::Usage](https://metacpan.org/pod/Getopt::Long::Descriptive::Usage) object (if [Getopt::Long::Descriptive](https://metacpan.org/pod/Getopt::Long::Descriptive) is used). - __help\_flag__ This accessor contains the boolean state of the --help, --usage and --? options (true if any of these options were passed on the command line). - __meta__ This returns the role meta object. # AUTHORS - NAKAGAWA Masaki - FUJI Goro - Stevan Little - Brandon L. Black - Yuval Kogman - Ryan D Johnson - Drew Taylor - Tomas Doran - Florian Ragwitz - Dagfinn Ilmari Mannsaker - Avar Arnfjord Bjarmason - Chris Prather - Mark Gardner - Tokuhiro Matsuno # COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. cpanfile100644000765000024 77112507103627 14747 0ustar00gfxstaff000000000000MouseX-Getopt-0.36requires 'Getopt::Long', '2.37'; requires 'Getopt::Long::Descriptive', '0.091'; requires 'Mouse', '0.64'; requires 'Mouse::Meta::Attribute'; requires 'Mouse::Role'; requires 'Mouse::Util::TypeConstraints'; on test => sub { requires 'Mouse::Meta::Class'; requires 'MouseX::ConfigFromFile'; requires 'MouseX::SimpleConfig'; requires 'Scalar::Util'; requires 'Test::Exception', '0.21'; requires 'Test::More', '0.88'; requires 'Test::Mouse'; requires 'Test::Warn', '0.21'; }; Getopt.pm100644000765000024 1753312507103627 17075 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/lib/MouseXpackage MouseX::Getopt; # ABSTRACT: A Mouse role for processing command line options our $VERSION = "0.36"; use Mouse::Role; with 'MouseX::Getopt::GLD'; no Mouse::Role; 1; =for stopwords metaclass commandline params configfile =head1 SYNOPSIS ## In your class package My::App; use Mouse; with 'MouseX::Getopt'; has 'out' => (is => 'rw', isa => 'Str', required => 1); has 'in' => (is => 'rw', isa => 'Str', required => 1); # ... rest of the class here ## in your script #!/usr/bin/perl use My::App; my $app = My::App->new_with_options(); # ... rest of the script here ## on the command line % perl my_app_script.pl -in file.input -out file.dump =head1 DESCRIPTION This is a role which provides an alternate constructor for creating objects using parameters passed in from the command line. This module attempts to DWIM as much as possible with the command line params by introspecting your class's attributes. It will use the name of your attribute as the command line option, and if there is a type constraint defined, it will configure Getopt::Long to handle the option accordingly. You can use the trait L or the attribute metaclass L to get non-default commandline option names and aliases. You can use the trait L or the attribute metaclass L to have C ignore your attribute in the commandline options. By default, attributes which start with an underscore are not given commandline argument support, unless the attribute's metaclass is set to L. If you don't want your accessors to have the leading underscore in their name, you can do this: # for read/write attributes has '_foo' => (accessor => 'foo', ...); # or for read-only attributes has '_bar' => (reader => 'bar', ...); This will mean that Getopt will not handle a --foo param, but your code can still call the C method. If your class also uses a configfile-loading role based on L, such as L, L's C will load the configfile specified by the C<--configfile> option (or the default you've given for the configfile attribute) for you. Options specified in multiple places follow the following precedence order: commandline overrides configfile, which overrides explicit new_with_options parameters. =head2 Supported Type Constraints =over 4 =item I A I type constraint is set up as a boolean option with Getopt::Long. So that this attribute description: has 'verbose' => (is => 'rw', isa => 'Bool'); would translate into C as a Getopt::Long option descriptor, which would enable the following command line options: % my_script.pl --verbose % my_script.pl --noverbose =item I, I, I These type constraints are set up as properly typed options with Getopt::Long, using the C<=i>, C<=f> and C<=s> modifiers as appropriate. =item I An I type constraint is set up as a multiple value option in Getopt::Long. So that this attribute description: has 'include' => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } ); would translate into C as a Getopt::Long option descriptor, which would enable the following command line options: % my_script.pl --include /usr/lib --include /usr/local/lib =item I A I type constraint is set up as a hash value option in Getopt::Long. So that this attribute description: has 'define' => ( is => 'rw', isa => 'HashRef', default => sub { {} } ); would translate into C as a Getopt::Long option descriptor, which would enable the following command line options: % my_script.pl --define os=linux --define vendor=debian =back =head2 Custom Type Constraints It is possible to create custom type constraint to option spec mappings if you need them. The process is fairly simple (but a little verbose maybe). First you create a custom subtype, like so: subtype 'ArrayOfInts' => as 'ArrayRef' => where { scalar (grep { looks_like_number($_) } @$_) }; Then you register the mapping, like so: MouseX::Getopt::OptionTypeMap->add_option_type_to_map( 'ArrayOfInts' => '=i@' ); Now any attribute declarations using this type constraint will get the custom option spec. So that, this: has 'nums' => ( is => 'ro', isa => 'ArrayOfInts', default => sub { [0] } ); Will translate to the following on the command line: % my_script.pl --nums 5 --nums 88 --nums 199 This example is fairly trivial, but more complex validations are easily possible with a little creativity. The trick is balancing the type constraint validations with the Getopt::Long validations. Better examples are certainly welcome :) =head2 Inferred Type Constraints If you define a custom subtype which is a subtype of one of the standard L above, and do not explicitly provide custom support as in L above, MouseX::Getopt will treat it like the parent type for Getopt purposes. For example, if you had the same custom C subtype from the examples above, but did not add a new custom option type for it to the C, it would be treated just like a normal C type for Getopt purposes (that is, C<=s@>). =over 4 =item B This method will take a set of default C<%params> and then collect params from the command line (possibly overriding those in C<%params>) and then return a newly constructed object. The special parameter C, if specified should point to an array reference with an array to use instead of C<@ARGV>. If L fails (due to invalid arguments), C will throw an exception. If L is installed and any of the following command line params are passed, the program will exit with usage information (and the option's state will be stored in the help_flag attribute). You can add descriptions for each option by including a B option for each attribute to document. --? --help --usage If you have L the C param is also passed to C as the usage option. =item B This accessor contains a reference to a copy of the C<@ARGV> array as it originally existed at the time of C. =item B This accessor contains an arrayref of leftover C<@ARGV> elements that L did not parse. Note that the real C<@ARGV> is left un-mangled. =item B This accessor contains the L object (if L is used). =item B This accessor contains the boolean state of the --help, --usage and --? options (true if any of these options were passed on the command line). =item B This returns the role meta object. =back =head1 AUTHORS =over 4 =item NAKAGAWA Masaki =item FUJI Goro =item Stevan Little =item Brandon L. Black =item Yuval Kogman =item Ryan D Johnson =item Drew Taylor =item Tomas Doran =item Florian Ragwitz =item Dagfinn Ilmari Mannsaker =item Avar Arnfjord Bjarmason =item Chris Prather =item Mark Gardner =item Tokuhiro Matsuno =back =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2012 by Infinity Interactive, Inc. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Basic.pm100644000765000024 1662412507103627 20116 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/lib/MouseX/Getoptpackage MouseX::Getopt::Basic; # ABSTRACT: MouseX::Getopt::Basic - role to implement the Getopt::Long functionality use Mouse::Role; use MouseX::Getopt::OptionTypeMap; use MouseX::Getopt::Meta::Attribute; use MouseX::Getopt::Meta::Attribute::NoGetopt; use Carp (); use Getopt::Long 2.37 (); has ARGV => (is => 'rw', isa => 'ArrayRef', metaclass => "NoGetopt"); has extra_argv => (is => 'rw', isa => 'ArrayRef', metaclass => "NoGetopt"); sub new_with_options { my ($class, @params) = @_; my $config_from_file; if($class->meta->does_role('MouseX::ConfigFromFile')) { local @ARGV = @ARGV; # just get the configfile arg now; the rest of the args will be # fetched later my $configfile; my $opt_parser = Getopt::Long::Parser->new( config => [ qw( no_auto_help pass_through ) ] ); $opt_parser->getoptions( "configfile=s" => \$configfile ); if(!defined $configfile) { my $cfmeta = $class->meta->find_attribute_by_name('configfile'); $configfile = $cfmeta->default if $cfmeta->has_default; if (ref $configfile eq 'CODE') { # not sure theres a lot you can do with the class and may break some assumptions # warn? $configfile = &$configfile($class); } if (defined $configfile) { $config_from_file = eval { $class->get_config_from_file($configfile); }; if ($@) { die $@ unless $@ =~ /Specified configfile '\Q$configfile\E' does not exist/; } } } else { $config_from_file = $class->get_config_from_file($configfile); } } my $constructor_params = ( @params == 1 ? $params[0] : {@params} ); Carp::croak("Single parameters to new_with_options() must be a HASH ref") unless ref($constructor_params) eq 'HASH'; my %processed = $class->_parse_argv( options => [ $class->_attrs_to_options( $config_from_file ) ], params => $constructor_params, ); my $params = $config_from_file ? { %$config_from_file, %{$processed{params}} } : $processed{params}; # did the user request usage information? if ( $processed{usage} and $params->{help_flag} ) { $class->_getopt_full_usage($processed{usage}); } $class->new( ARGV => $processed{argv_copy}, extra_argv => $processed{argv}, ( $processed{usage} ? ( usage => $processed{usage} ) : () ), %$constructor_params, # explicit params to ->new %$params, # params from CLI ); } sub _getopt_spec { shift->_traditional_spec(@_); } sub _parse_argv { my ( $class, %params ) = @_; local @ARGV = @{ $params{params}{argv} || \@ARGV }; my ( $opt_spec, $name_to_init_arg ) = $class->_getopt_spec(%params); # Get a clean copy of the original @ARGV my $argv_copy = [ @ARGV ]; my @warnings; my ( $parsed_options, $usage ) = eval { local $SIG{__WARN__} = sub { push @warnings, @_ }; return $class->_getopt_get_options(\%params, $opt_spec); }; my $e = $@; $class->_getopt_spec_warnings(@warnings) if @warnings; $class->_getopt_spec_exception(\@warnings, $e) if $e; # Get a copy of the Getopt::Long-mangled @ARGV my $argv_mangled = [ @ARGV ]; my %constructor_args = ( map { $name_to_init_arg->{$_} => $parsed_options->{$_} } keys %$parsed_options, ); return ( params => \%constructor_args, argv_copy => $argv_copy, argv => $argv_mangled, ( defined($usage) ? ( usage => $usage ) : () ), ); } sub _getopt_get_options { my ($class, $params, $opt_spec) = @_; my %options; Getopt::Long::GetOptions(\%options, @$opt_spec); return ( \%options, undef ); } sub _getopt_spec_warnings { } sub _getopt_spec_exception { my ($self, $warnings, $exception) = @_; die @$warnings, $exception; } sub _getopt_full_usage { my ($self, $usage) = @_; $usage->die; } sub _usage_format { return "usage: %c %o"; } sub _traditional_spec { my ( $class, %params ) = @_; my ( @options, %name_to_init_arg, %options ); foreach my $opt ( @{ $params{options} } ) { push @options, $opt->{opt_string}; my $identifier = $opt->{name}; $identifier =~ s/\W/_/g; # Getopt::Long does this to all option names $name_to_init_arg{$identifier} = $opt->{init_arg}; } return ( \@options, \%name_to_init_arg ); } sub _compute_getopt_attrs { my $class = shift; sort { $a->insertion_order <=> $b->insertion_order } grep { $_->does("MouseX::Getopt::Meta::Attribute::Trait") or $_->name !~ /^_/ } grep { !$_->does('MouseX::Getopt::Meta::Attribute::Trait::NoGetopt') } $class->meta->get_all_attributes } sub _get_cmd_flags_for_attr { my ( $class, $attr ) = @_; my $flag = $attr->name; my @aliases; if ($attr->does('MouseX::Getopt::Meta::Attribute::Trait')) { $flag = $attr->cmd_flag if $attr->has_cmd_flag; @aliases = @{ $attr->cmd_aliases } if $attr->has_cmd_aliases; } return ( $flag, @aliases ); } sub _attrs_to_options { my $class = shift; my $config_from_file = shift || {}; my @options; foreach my $attr ($class->_compute_getopt_attrs) { my ( $flag, @aliases ) = $class->_get_cmd_flags_for_attr($attr); my $opt_string = join(q{|}, $flag, @aliases); if ($attr->name eq 'configfile') { $opt_string .= '=s'; } elsif ($attr->has_type_constraint) { my $type = $attr->type_constraint; if (MouseX::Getopt::OptionTypeMap->has_option_type($type)) { $opt_string .= MouseX::Getopt::OptionTypeMap->get_option_type($type) } } push @options, { name => $flag, init_arg => $attr->init_arg, opt_string => $opt_string, required => $attr->is_required && !$attr->has_default && !$attr->has_builder && !exists $config_from_file->{$attr->name}, # NOTE: # this "feature" was breaking because # Getopt::Long::Descriptive would return # the default value as if it was a command # line flag, which would then override the # one passed into a constructor. # See 100_gld_default_bug.t for an example # - SL #( ( $attr->has_default && ( $attr->is_default_a_coderef xor $attr->is_lazy ) ) ? ( default => $attr->default({}) ) : () ), ( $attr->has_documentation ? ( doc => $attr->documentation ) : () ), } } return @options; } no Mouse::Role; 1; =head1 SYNOPSIS ## In your class package My::App; use Mouse; with 'MouseX::Getopt::Basic'; has 'out' => (is => 'rw', isa => 'Str', required => 1); has 'in' => (is => 'rw', isa => 'Str', required => 1); # ... rest of the class here ## in your script #!/usr/bin/perl use My::App; my $app = My::App->new_with_options(); # ... rest of the script here ## on the command line % perl my_app_script.pl --in file.input --out file.dump =head1 DESCRIPTION This is like L and can be used instead except that it doesn't make use of L (or "GLD" for short). =over 4 =item new_with_options See L. =back =cut Dashes.pm100644000765000024 256312507103627 20261 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/lib/MouseX/Getoptpackage MouseX::Getopt::Dashes; # ABSTRACT: convert underscores in attribute names to dashes use Mouse::Role; with 'MouseX::Getopt'; around _get_cmd_flags_for_attr => sub { my $next = shift; my ( $class, $attr, @rest ) = @_; my ( $flag, @aliases ) = $class->$next($attr, @rest); $flag =~ tr/_/-/ unless $attr->does('MouseX::Getopt::Meta::Attribute::Trait') && $attr->has_cmd_flag; return ( $flag, @aliases ); }; no Mouse::Role; 1; =head1 SYNOPSIS package My::App; use Mouse; with 'MouseX::Getopt::Dashes'; # Will be called as --some-thingy, not --some_thingy has 'some_thingy' => ( is => 'ro', isa => 'Str', default => 'foo' ); # Will be called as --another_thingy, not --another-thingy has 'another_thingy' => ( traits => [ 'Getopt' ], cmd_flag => 'another_thingy' is => 'ro', isa => 'Str', default => 'foo' ); # use as MouseX::Getopt =head1 DESCRIPTION This is a version of C which converts underscores in attribute names to dashes when generating command line flags. You can selectively disable this on a per-attribute basis by supplying a L argument with the command flag you'd like for a given attribute. No underscore to dash replacement will be done on the C. =cut GLD.pm100644000765000024 451112507103627 17453 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/lib/MouseX/Getoptpackage MouseX::Getopt::GLD; # ABSTRACT: A Mouse role for processing command line options with Getopt::Long::Descriptive use Mouse::Role; use Getopt::Long::Descriptive 0.081; with 'MouseX::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(@_); }; around _getopt_get_options => sub { shift; my ($class, $params, $opt_spec) = @_; return Getopt::Long::Descriptive::describe_options($class->_usage_format(%$params), @$opt_spec); }; sub _gld_spec { my ( $class, %params ) = @_; my ( @options, %name_to_init_arg ); my $constructor_params = $params{params}; foreach my $opt ( @{ $params{options} } ) { push @options, [ $opt->{opt_string}, $opt->{doc} || ' ', # FIXME new GLD shouldn't need this hack { ( ( $opt->{required} && !exists($constructor_params->{$opt->{init_arg}}) ) ? (required => $opt->{required}) : () ), # NOTE: # remove this 'feature' because it didn't work # all the time, and so is better to not bother # since Mouse will handle the defaults just # fine anyway. # - SL #( exists $opt->{default} ? (default => $opt->{default}) : () ), }, ]; my $identifier = lc($opt->{name}); $identifier =~ s/\W/_/g; # Getopt::Long does this to all option names $name_to_init_arg{$identifier} = $opt->{init_arg}; } return ( \@options, \%name_to_init_arg ); } no Mouse::Role; 1; =head1 SYNOPSIS ## In your class package My::App; use Mouse; with 'MouseX::Getopt::GLD'; has 'out' => (is => 'rw', isa => 'Str', required => 1); has 'in' => (is => 'rw', isa => 'Str', required => 1); # ... rest of the class here ## in your script #!/usr/bin/perl use My::App; my $app = My::App->new_with_options(); # ... rest of the script here ## on the command line % perl my_app_script.pl -in file.input -out file.dump =cut Attribute.pm100644000765000024 401712507103627 21677 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/lib/MouseX/Getopt/Metapackage MouseX::Getopt::Meta::Attribute; # ABSTRACT: Optional meta attribute for custom option names use Mouse; use Mouse::Util::TypeConstraints; extends 'Mouse::Meta::Attribute'; # << Mouse extending Mouse :) with 'MouseX::Getopt::Meta::Attribute::Trait'; no Mouse; # register this as a metaclass alias ... package # stop confusing PAUSE Mouse::Meta::Attribute::Custom::Getopt; sub register_implementation { 'MouseX::Getopt::Meta::Attribute' } 1; =for stopwords metaclass commandline params configfile =head1 SYNOPSIS package App; use Mouse; with 'MouseX::Getopt'; has 'data' => ( metaclass => 'MouseX::Getopt::Meta::Attribute', is => 'ro', isa => 'Str', default => 'file.dat', # tells MouseX::Getopt to use --somedata as the # command line flag instead of the normal # autogenerated one (--data) cmd_flag => 'somedata', # tells MouseX::Getopt to also allow --moosedata, # -m, and -d as aliases for this same option on # the commandline. cmd_aliases => [qw/ moosedata m d /], # Or, you can use a plain scalar for a single alias: cmd_aliases => 'm', ); =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 will create for you. 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 custom attribute metaclass aliases. This means you can also use this as the B alias, like so: has 'foo' => (metaclass => 'Getopt', cmd_flag => 'f'); =over 4 =item B Changes the commandline flag to be this value, instead of the default, which is the same as the attribute name. =item B Adds more aliases for this commandline flag, useful for short options and such. =item B =item B =back =cut NoGetopt.pm100644000765000024 176712507103627 23447 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/lib/MouseX/Getopt/Meta/Attributepackage MouseX::Getopt::Meta::Attribute::NoGetopt; # ABSTRACT: Optional meta attribute for ignoring params use Mouse; extends 'Mouse::Meta::Attribute'; # << Mouse extending Mouse :) with 'MouseX::Getopt::Meta::Attribute::Trait::NoGetopt'; no Mouse; # register this as a metaclass alias ... package # stop confusing PAUSE Mouse::Meta::Attribute::Custom::NoGetopt; sub register_implementation { 'MouseX::Getopt::Meta::Attribute::NoGetopt' } 1; =for stopwords metaclass commandline =head1 SYNOPSIS package App; use Mouse; with 'MouseX::Getopt'; has 'data' => ( 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 be processed by C. All you need to do is specify the C metaclass. has 'foo' => (metaclass => 'NoGetopt', ... ); =cut Trait.pm100644000765000024 410512507103627 22760 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/lib/MouseX/Getopt/Meta/Attributepackage MouseX::Getopt::Meta::Attribute::Trait; # ABSTRACT: Optional meta attribute trait for custom option names use Mouse::Role; use Mouse::Util::TypeConstraints; has 'cmd_flag' => ( is => 'rw', isa => 'Str', predicate => 'has_cmd_flag', ); # This subtype is to support scalar -> arrayref coercion # without polluting the built-in types subtype '_MouseX_Getopt_CmdAliases' => as 'ArrayRef'; coerce '_MouseX_Getopt_CmdAliases' => from 'Str' => via { [$_] }; has 'cmd_aliases' => ( is => 'rw', isa => '_MouseX_Getopt_CmdAliases', predicate => 'has_cmd_aliases', coerce => 1, ); no Mouse::Util::TypeConstraints; no Mouse::Role; # register this as a metaclass alias ... package # stop confusing PAUSE Mouse::Meta::Attribute::Custom::Trait::Getopt; sub register_implementation { 'MouseX::Getopt::Meta::Attribute::Trait' } 1; =for stopwords metaclass commandline params configfile =head1 SYNOPSIS package App; use Mouse; with 'MouseX::Getopt'; has 'data' => ( traits => [ 'Getopt' ], is => 'ro', isa => 'Str', default => 'file.dat', # tells MouseX::Getopt to use --somedata as the # command line flag instead of the normal # autogenerated one (--data) cmd_flag => 'somedata', # tells MouseX::Getopt to also allow --moosedata, # -m, and -d as aliases for this same option on # the commandline. cmd_aliases => [qw/ moosedata m d /], # Or, you can use a plain scalar for a single alias: cmd_aliases => 'm', ); =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 will create for you. =over 4 =item B Changes the commandline flag to be this value, instead of the default, which is the same as the attribute name. =item B Adds more aliases for this commandline flag, useful for short options and such. =item B =item B =back =cut NoGetopt.pm100644000765000024 165612507103627 24527 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/lib/MouseX/Getopt/Meta/Attribute/Traitpackage MouseX::Getopt::Meta::Attribute::Trait::NoGetopt; # ABSTRACT: Optional meta attribute trait for ignoring params use Mouse::Role; no Mouse::Role; # register this as a metaclass alias ... package # stop confusing PAUSE Mouse::Meta::Attribute::Custom::Trait::NoGetopt; sub register_implementation { 'MouseX::Getopt::Meta::Attribute::Trait::NoGetopt' } 1; =for stopwords metaclass commandline =head1 SYNOPSIS package App; use Mouse; with 'MouseX::Getopt'; has 'data' => ( 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 be processed by C. All you need to do is specify the C metaclass trait. has 'foo' => (traits => [ 'NoGetopt', ... ], ... ); =cut OptionTypeMap.pm100644000765000024 432712507103627 21622 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/lib/MouseX/Getoptpackage MouseX::Getopt::OptionTypeMap; # ABSTRACT: Storage for the option to type mappings use Mouse 'confess', 'blessed'; use Mouse::Util::TypeConstraints 'find_type_constraint'; my %option_type_map = ( 'Bool' => '!', 'Str' => '=s', 'Int' => '=i', 'Num' => '=f', 'ArrayRef' => '=s@', 'HashRef' => '=s%', ); sub has_option_type { my (undef, $type_or_name) = @_; 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 0; } sub get_option_type { my (undef, $type_or_name) = @_; my $name = blessed($type_or_name) ? $type_or_name->name : $type_or_name; 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'"; while ( $current = $current->parent ) { return $option_type_map{$current->name} if exists $option_type_map{$current->name}; } return; } sub add_option_type_to_map { my (undef, $type_name, $option_string) = @_; (defined $type_name && defined $option_string) || confess "You must supply both a type name and an option string"; if ( blessed($type_name) ) { $type_name = $type_name->name; } else { (find_type_constraint($type_name)) || confess "The type constraint '$type_name' does not exist"; } $option_type_map{$type_name} = $option_string; } no Mouse::Util::TypeConstraints; no Mouse; 1; =head1 DESCRIPTION See the I section in the L docs for more info about how to use this module. =over 4 =item B =item B =item B =back =cut Strict.pm100644000765000024 110212507103627 20306 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/lib/MouseX/Getoptpackage MouseX::Getopt::Strict; # ABSTRACT: only make options for attrs with the Getopt metaclass use Mouse::Role; with 'MouseX::Getopt'; around '_compute_getopt_attrs' => sub { my $next = shift; my ( $class, @args ) = @_; grep { $_->does("MouseX::Getopt::Meta::Attribute::Trait") } $class->$next(@args); }; no Mouse::Role; 1; =head1 DESCRIPTION This is an stricter version of C which only processes the attributes if they explicitly set as C attributes. All other attributes are ignored by the command line handler. =cut minil.toml100644000765000024 5412507103627 15222 0ustar00gfxstaff000000000000MouseX-Getopt-0.36name="MouseX-Getopt" authority="cpan:GFUJI" 000_load.t100644000765000024 16012507103627 15161 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; BEGIN { use_ok('MouseX::Getopt'); } 001_basic.t100644000765000024 1351412507103627 15373 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 69; BEGIN { use_ok('MouseX::Getopt'); } { package App; use Mouse; with 'MouseX::Getopt'; has 'data' => ( metaclass => 'MouseX::Getopt::Meta::Attribute', is => 'ro', isa => 'Str', default => 'file.dat', cmd_flag => 'f', ); has 'cow' => ( metaclass => 'Getopt', is => 'ro', isa => 'Str', default => 'moo', cmd_aliases => [qw/ moocow m c /], ); has 'horse' => ( metaclass => 'MouseX::Getopt::Meta::Attribute', is => 'ro', isa => 'Str', default => 'bray', cmd_flag => 'horsey', cmd_aliases => 'x', ); has 'length' => ( is => 'ro', isa => 'Int', default => 24 ); has 'verbose' => ( is => 'ro', isa => 'Bool', ); has 'libs' => ( is => 'ro', isa => 'ArrayRef', default => sub { [] }, ); has 'details' => ( is => 'ro', isa => 'HashRef', default => sub { {} }, ); has '_private_stuff' => ( is => 'ro', isa => 'Int', default => 713 ); has '_private_stuff_cmdline' => ( metaclass => 'MouseX::Getopt::Meta::Attribute', is => 'ro', isa => 'Int', default => 832, cmd_flag => 'p', ); } foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) { my $attr = App->meta->get_attribute($attr_name); isa_ok($attr, 'Mouse::Meta::Attribute'); isa_ok($attr, 'MouseX::Getopt::Meta::Attribute'); can_ok($attr, 'cmd_flag'); can_ok($attr, 'cmd_aliases'); } { local @ARGV = (); my $app = App->new_with_options; isa_ok($app, 'App'); ok(!$app->verbose, '... verbosity is off as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... data is file.dat as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--verbose', '--length', 50); my $app = App->new_with_options; isa_ok($app, 'App'); ok($app->verbose, '... verbosity is turned on as expected'); is($app->length, 50, '... length is 50 as expected'); is($app->data, 'file.dat', '... data is file.dat as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--verbose', '-f', 'foo.txt'); my $app = App->new_with_options; isa_ok($app, 'App'); ok($app->verbose, '... verbosity is turned on as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'foo.txt', '... data is foo.txt as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--verbose', '--libs', 'libs/', '--libs', 'includes/lib'); my $app = App->new_with_options; isa_ok($app, 'App'); ok($app->verbose, '... verbosity is turned on as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... data is foo.txt as expected'); is_deeply($app->libs, ['libs/', 'includes/lib'], '... libs is [libs/, includes/lib] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--details', 'os=mac', '--details', 'name=foo'); my $app = App->new_with_options; isa_ok($app, 'App'); ok(!$app->verbose, '... verbosity is turned on as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... data is foo.txt as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, { os => 'mac', name => 'foo' }, '... details is { os => mac, name => foo } as expected'); } { # Test negation on booleans too ... local @ARGV = ('--noverbose'); my $app = App->new_with_options; isa_ok($app, 'App'); ok(!$app->verbose, '... verbosity is turned off as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... file is file.dat as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } # Test cmd_alias without cmd_flag { local @ARGV = ('--cow', '42'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->cow, 42, 'cmd_alias, but not using it'); } { local @ARGV = ('--moocow', '88'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->cow, 88, 'cmd_alias, using long one'); } { local @ARGV = ('-c', '99'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->cow, 99, 'cmd_alias, using short one'); } # Test cmd_alias + cmd_flag { local @ARGV = ('--horsey', '123'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->horse, 123, 'cmd_alias+cmd_flag, using flag'); } { local @ARGV = ('-x', '321'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->horse, 321, 'cmd_alias+cmd_flag, using alias'); } # Test _foo + cmd_flag { local @ARGV = ('-p', '666'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->_private_stuff_cmdline, 666, '_foo + cmd_flag'); } # Test ARGV support { my @args = ('-p', 12345, '-c', 99, '-'); local @ARGV = @args; my $app = App->new_with_options; isa_ok($app, 'App'); is_deeply($app->ARGV, \@args, 'ARGV accessor'); is_deeply(\@ARGV, \@args, '@ARGV unmangled'); is_deeply($app->extra_argv, ['-'], 'extra_argv accessor'); } 002_custom_option_type.t100644000765000024 233012507103627 20230 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 6; BEGIN { use_ok('MouseX::Getopt'); } { package App; use Mouse; use Mouse::Util::TypeConstraints; use Scalar::Util 'looks_like_number'; with 'MouseX::Getopt'; subtype 'ArrayOfInts' => as 'ArrayRef' => where { scalar (grep { looks_like_number($_) } @$_) }; MouseX::Getopt::OptionTypeMap->add_option_type_to_map( 'ArrayOfInts' => '=i@' ); has 'nums' => ( is => 'ro', isa => 'ArrayOfInts', default => sub { [0] } ); } { local @ARGV = (); my $app = App->new_with_options; isa_ok($app, 'App'); is_deeply($app->nums, [0], '... nums is [0] as expected'); } { local @ARGV = ('--nums', 3, '--nums', 5); my $app = App->new_with_options; isa_ok($app, 'App'); is_deeply($app->nums, [3, 5], '... nums is [3, 5] as expected'); } # Make sure it really used our =i@, instead of falling back # to =s@ via the type system, and test that exceptions work # while we're at it. eval { local @ARGV = ('--nums', 3, '--nums', 'foo'); my $app = App->new_with_options; }; like($@, qr/Value "foo" invalid/, 'Numeric constraint enforced'); 003_inferred_option_type.t100644000765000024 150312507103627 20516 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 5; BEGIN { use_ok('MouseX::Getopt'); } { package App; use Mouse; use Mouse::Util::TypeConstraints; use Scalar::Util 'looks_like_number'; with 'MouseX::Getopt'; subtype 'ArrayOfInts' => as 'ArrayRef' => where { scalar (grep { looks_like_number($_) } @$_) }; has 'nums' => ( is => 'ro', isa => 'ArrayOfInts', default => sub { [0] } ); } { local @ARGV = (); my $app = App->new_with_options; isa_ok($app, 'App'); is_deeply($app->nums, [0], '... nums is [0] as expected'); } { local @ARGV = ('--nums', 3, '--nums', 5); my $app = App->new_with_options; isa_ok($app, 'App'); is_deeply($app->nums, [3, 5], '... nums is [3, 5] as expected'); } 004_nogetop.t100644000765000024 414112507103627 15744 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 9; use Test::Exception; BEGIN { use_ok('MouseX::Getopt'); } { package App; use Mouse; with 'MouseX::Getopt'; has 'data' => ( metaclass => 'Getopt', is => 'ro', isa => 'Str', default => 'file.dat', cmd_flag => 'f', ); has 'cow' => ( metaclass => 'Getopt', is => 'ro', isa => 'Str', default => 'moo', cmd_aliases => [qw/ moocow m c /], ); has 'horse' => ( metaclass => 'Getopt', is => 'ro', isa => 'Str', default => 'bray', cmd_flag => 'horsey', cmd_aliases => 'x', ); has 'length' => ( is => 'ro', isa => 'Int', default => 24 ); has 'verbose' => ( is => 'ro', isa => 'Bool', ); has 'libs' => ( is => 'ro', isa => 'ArrayRef', default => sub { [] }, ); has 'details' => ( is => 'ro', isa => 'HashRef', default => sub { {} }, ); has 'private_stuff' => ( metaclass => 'NoGetopt', is => 'ro', isa => 'Int', default => 713 ); has '_private_stuff_cmdline' => ( metaclass => 'Getopt', is => 'ro', isa => 'Int', default => 832, cmd_flag => 'p', ); } { local @ARGV = (); my $app = App->new_with_options; isa_ok( $app, 'App' ); ok( !$app->verbose, '... verbosity is off as expected' ); is( $app->length, 24, '... length is 24 as expected' ); is( $app->data, 'file.dat', '... data is file.dat as expected' ); is_deeply( $app->libs, [], '... libs is [] as expected' ); is_deeply( $app->details, {}, '... details is {} as expected' ); is($app->private_stuff, 713, '... private stuff is 713 as expected'); } { local @ARGV = (qw/--private_stuff 317/); throws_ok { App->new_with_options } qr/Unknown option: private_stuff/; } 005_strict.t100644000765000024 400412507103627 15600 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 10; use Test::Exception; BEGIN { use_ok('MouseX::Getopt'); } { package App; use Mouse; with 'MouseX::Getopt::Strict'; has 'data' => ( metaclass => 'Getopt', is => 'ro', isa => 'Str', default => 'file.dat', cmd_flag => 'f', ); has 'cow' => ( metaclass => 'Getopt', is => 'ro', isa => 'Str', default => 'moo', cmd_aliases => [qw/ moocow m c /], ); has 'horse' => ( traits => ['Getopt'], is => 'ro', isa => 'Str', default => 'bray', cmd_flag => 'horsey', cmd_aliases => 'x', ); has 'length' => ( is => 'ro', isa => 'Int', default => 24 ); has 'verbose' => ( is => 'ro', isa => 'Bool', ); has 'libs' => ( is => 'ro', isa => 'ArrayRef', default => sub { [] }, ); has 'details' => ( is => 'ro', isa => 'HashRef', default => sub { {} }, ); has 'private_stuff' => ( is => 'ro', isa => 'Int', default => 713 ); } { local @ARGV = (); my $app = App->new_with_options; isa_ok( $app, 'App' ); ok( !$app->verbose, '... verbosity is off as expected' ); is( $app->length, 24, '... length is 24 as expected' ); is( $app->data, 'file.dat', '... data is file.dat as expected' ); is_deeply( $app->libs, [], '... libs is [] as expected' ); is_deeply( $app->details, {}, '... details is {} as expected' ); is($app->private_stuff, 713, '... private stuff is 713 as expected'); } { local @ARGV = (qw/--private_stuff 317/); throws_ok { App->new_with_options } qr/Unknown option: private_stuff/; } { local @ARGV = (qw/--length 100/); throws_ok { App->new_with_options } qr/Unknown option: length/; } 006_metaclass_traits.t100644000765000024 1351312507103627 17660 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 69; use Test::Mouse; BEGIN { use_ok('MouseX::Getopt'); } { package App; use Mouse; with 'MouseX::Getopt'; has 'data' => ( traits => [ 'MouseX::Getopt::Meta::Attribute::Trait' ], is => 'ro', isa => 'Str', default => 'file.dat', cmd_flag => 'f', ); has 'cow' => ( traits => [ 'Getopt' ], is => 'ro', isa => 'Str', default => 'moo', cmd_aliases => [qw/ moocow m c /], ); has 'horse' => ( traits => [ 'Getopt' ], is => 'ro', isa => 'Str', default => 'bray', cmd_flag => 'horsey', cmd_aliases => 'x', ); has 'length' => ( is => 'ro', isa => 'Int', default => 24 ); has 'verbose' => ( is => 'ro', isa => 'Bool', ); has 'libs' => ( is => 'ro', isa => 'ArrayRef', default => sub { [] }, ); has 'details' => ( is => 'ro', isa => 'HashRef', default => sub { {} }, ); has '_private_stuff' => ( is => 'ro', isa => 'Int', default => 713 ); has '_private_stuff_cmdline' => ( traits => [ 'Getopt' ], is => 'ro', isa => 'Int', default => 832, cmd_flag => 'p', ); } foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) { my $attr = App->meta->get_attribute($attr_name); isa_ok($attr, 'Mouse::Meta::Attribute'); does_ok($attr, 'MouseX::Getopt::Meta::Attribute::Trait'); can_ok($attr, 'cmd_flag'); can_ok($attr, 'cmd_aliases'); } { local @ARGV = (); my $app = App->new_with_options; isa_ok($app, 'App'); ok(!$app->verbose, '... verbosity is off as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... data is file.dat as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--verbose', '--length', 50); my $app = App->new_with_options; isa_ok($app, 'App'); ok($app->verbose, '... verbosity is turned on as expected'); is($app->length, 50, '... length is 50 as expected'); is($app->data, 'file.dat', '... data is file.dat as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--verbose', '-f', 'foo.txt'); my $app = App->new_with_options; isa_ok($app, 'App'); ok($app->verbose, '... verbosity is turned on as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'foo.txt', '... data is foo.txt as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--verbose', '--libs', 'libs/', '--libs', 'includes/lib'); my $app = App->new_with_options; isa_ok($app, 'App'); ok($app->verbose, '... verbosity is turned on as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... data is foo.txt as expected'); is_deeply($app->libs, ['libs/', 'includes/lib'], '... libs is [libs/, includes/lib] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--details', 'os=mac', '--details', 'name=foo'); my $app = App->new_with_options; isa_ok($app, 'App'); ok(!$app->verbose, '... verbosity is turned on as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... data is foo.txt as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, { os => 'mac', name => 'foo' }, '... details is { os => mac, name => foo } as expected'); } { # Test negation on booleans too ... local @ARGV = ('--noverbose'); my $app = App->new_with_options; isa_ok($app, 'App'); ok(!$app->verbose, '... verbosity is turned off as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... file is file.dat as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } # Test cmd_alias without cmd_flag { local @ARGV = ('--cow', '42'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->cow, 42, 'cmd_alias, but not using it'); } { local @ARGV = ('--moocow', '88'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->cow, 88, 'cmd_alias, using long one'); } { local @ARGV = ('-c', '99'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->cow, 99, 'cmd_alias, using short one'); } # Test cmd_alias + cmd_flag { local @ARGV = ('--horsey', '123'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->horse, 123, 'cmd_alias+cmd_flag, using flag'); } { local @ARGV = ('-x', '321'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->horse, 321, 'cmd_alias+cmd_flag, using alias'); } # Test _foo + cmd_flag { local @ARGV = ('-p', '666'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->_private_stuff_cmdline, 666, '_foo + cmd_flag'); } # Test ARGV support { my @args = ('-p', 12345, '-c', 99, '-'); local @ARGV = @args; my $app = App->new_with_options; isa_ok($app, 'App'); is_deeply($app->ARGV, \@args, 'ARGV accessor'); is_deeply(\@ARGV, \@args, '@ARGV unmangled'); is_deeply($app->extra_argv, ['-'], 'extra_argv accessor'); } 007_nogetopt_trait.t100644000765000024 415212507103627 17340 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 9; use Test::Exception; BEGIN { use_ok('MouseX::Getopt'); } { package App; use Mouse; with 'MouseX::Getopt'; has 'data' => ( traits => ['Getopt'], is => 'ro', isa => 'Str', default => 'file.dat', cmd_flag => 'f', ); has 'cow' => ( traits => ['Getopt'], is => 'ro', isa => 'Str', default => 'moo', cmd_aliases => [qw/ moocow m c /], ); has 'horse' => ( traits => ['Getopt'], is => 'ro', isa => 'Str', default => 'bray', cmd_flag => 'horsey', cmd_aliases => 'x', ); has 'length' => ( is => 'ro', isa => 'Int', default => 24 ); has 'verbose' => ( is => 'ro', isa => 'Bool', ); has 'libs' => ( is => 'ro', isa => 'ArrayRef', default => sub { [] }, ); has 'details' => ( is => 'ro', isa => 'HashRef', default => sub { {} }, ); has 'private_stuff' => ( traits => ['NoGetopt'], is => 'ro', isa => 'Int', default => 713 ); has '_private_stuff_cmdline' => ( traits => ['Getopt'], is => 'ro', isa => 'Int', default => 832, cmd_flag => 'p', ); } { local @ARGV = (); my $app = App->new_with_options; isa_ok( $app, 'App' ); ok( !$app->verbose, '... verbosity is off as expected' ); is( $app->length, 24, '... length is 24 as expected' ); is( $app->data, 'file.dat', '... data is file.dat as expected' ); is_deeply( $app->libs, [], '... libs is [] as expected' ); is_deeply( $app->details, {}, '... details is {} as expected' ); is($app->private_stuff, 713, '... private stuff is 713 as expected'); } { local @ARGV = (qw/--private_stuff 317/); throws_ok { App->new_with_options } qr/Unknown option: private_stuff/; } 008_configfromfile.t100644000765000024 1244412507103627 17313 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/env perl use strict; use warnings; use Test::Exception; use Test::More; use File::Spec; if ( !eval { require MouseX::ConfigFromFile } ) { plan skip_all => 'Test requires MouseX::ConfigFromFile'; } else { plan tests => 37; } { package App; use Mouse; with 'MouseX::Getopt'; with 'MouseX::ConfigFromFile'; has 'config_from_override' => ( is => 'ro', isa => 'Bool', default => 0, ); has 'optional_from_config' => ( is => 'ro', isa => 'Str', required => 0, ); has 'required_from_config' => ( is => 'ro', isa => 'Str', required => 1, ); has 'required_from_argv' => ( is => 'ro', isa => 'Str', required => 1, ); sub get_config_from_file { my ( $class, $file ) = @_; my %config = ( required_from_config => 'from_config_1', optional_from_config => 'from_config_2', ); my $cpath = File::Spec->canonpath('/notused/default'); if ( $file ne $cpath ) { $config{config_from_override} = 1; } return \%config; } } { package App::DefaultConfigFile; use Mouse; extends 'App'; has '+configfile' => ( default => File::Spec->canonpath('/notused/default'), ); } { package App::DefaultConfigFileCodeRef; use Mouse; extends 'App'; has '+configfile' => ( default => sub { return File::Spec->canonpath('/notused/default') }, ); } # No config specified { local @ARGV = qw( --required_from_argv 1 ); throws_ok { App->new_with_options } qr/Mandatory parameter 'required_from_config' missing/; { my $app = App::DefaultConfigFile->new_with_options; isa_ok( $app, 'App::DefaultConfigFile' ); app_ok( $app ); ok( !$app->config_from_override, '... config_from_override false as expected' ); is( $app->configfile, File::Spec->canonpath('/notused/default'), '... configfile is /notused/default as expected' ); } } # No config specified { local @ARGV = qw( --required_from_argv 1 ); { my $app = App::DefaultConfigFileCodeRef->new_with_options; isa_ok( $app, 'App::DefaultConfigFileCodeRef' ); app_ok( $app ); ok( !$app->config_from_override, '... config_from_override false as expected' ); is( $app->configfile, File::Spec->canonpath('/notused/default'), '... configfile is /notused/default as expected' ); } } # Config specified { local @ARGV = qw( --configfile /notused --required_from_argv 1 ); { my $app = App->new_with_options; isa_ok( $app, 'App' ); app_ok( $app ); } { my $app = App::DefaultConfigFile->new_with_options; isa_ok( $app, 'App::DefaultConfigFile' ); app_ok( $app ); ok( $app->config_from_override, '... config_from_override true as expected' ); is( $app->configfile, File::Spec->canonpath('/notused'), '... configfile is /notused as expected' ); } { my $app = App::DefaultConfigFileCodeRef->new_with_options; isa_ok( $app, 'App::DefaultConfigFileCodeRef' ); app_ok( $app ); ok( $app->config_from_override, '... config_from_override true as expected' ); is( $app->configfile, File::Spec->canonpath('/notused'), '... configfile is /notused as expected' ); } } # Required arg not supplied from cmdline { local @ARGV = qw( --configfile /notused ); throws_ok { App->new_with_options } qr/Mandatory parameter 'required_from_argv' missing/; } # Config file value overriden from cmdline { local @ARGV = qw( --configfile /notused --required_from_argv 1 --required_from_config override ); my $app = App->new_with_options; isa_ok( $app, 'App' ); is( $app->required_from_config, 'override', '... required_from_config is override as expected' ); is( $app->optional_from_config, 'from_config_2', '... optional_from_config is from_config_2 as expected' ); } # No config file { local @ARGV = qw( --required_from_argv 1 --required_from_config noconfig ); my $app = App->new_with_options; isa_ok( $app, 'App' ); is( $app->required_from_config, 'noconfig', '... required_from_config is noconfig as expected' ); ok( !defined $app->optional_from_config, '... optional_from_config is undef as expected' ); } { package BaseApp::WithConfig; use Mouse; with 'MouseX::ConfigFromFile'; sub get_config_from_file { return {}; } } { package DerivedApp::Getopt; use Mouse; extends 'BaseApp::WithConfig'; with 'MouseX::Getopt'; } # With DerivedApp, the Getopt role was applied at a different level # than the ConfigFromFile role { lives_ok { DerivedApp::Getopt->new_with_options } 'Can create DerivedApp'; } sub app_ok { my $app = shift; is( $app->required_from_config, 'from_config_1', '... required_from_config is from_config_1 as expected' ); is( $app->optional_from_config, 'from_config_2', '... optional_from_config is from_config_2 as expected' ); is( $app->required_from_argv, '1', '... required_from_argv is 1 as expected' ); } 009_gld_and_explicit_options.t100644000765000024 144112507103627 21342 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::Exception; BEGIN { eval 'use Getopt::Long::Descriptive;'; plan skip_all => "Getopt::Long::Descriptive required for this test" if $@; plan tests => 5; use_ok('MouseX::Getopt'); } { package Testing::Foo; use Mouse; with 'MouseX::Getopt'; has 'bar' => ( is => 'ro', isa => 'Int', required => 1, ); has 'baz' => ( is => 'ro', isa => 'Int', required => 1, ); } @ARGV = qw(--bar 10); my $foo; lives_ok { $foo = Testing::Foo->new_with_options(baz => 100); } '... this should work'; isa_ok($foo, 'Testing::Foo'); is($foo->bar, 10, '... got the right values'); is($foo->baz, 100, '... got the right values'); 010_dashes.t100644000765000024 166412507103627 15544 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 5; use Test::Exception; BEGIN { use_ok('MouseX::Getopt'); } { package App; use Mouse; with 'MouseX::Getopt::Dashes'; has 'some_thingy' => ( is => 'ro', isa => 'Str', default => 'foo' ); has 'another_thingy' => ( is => 'ro', isa => 'Str', default => 'foo', cmd_flag => 'another_thingy', traits => [ 'Getopt' ], ); } { local @ARGV = (qw/--some-thingy bar/); lives_and { is( App->new_with_options->some_thingy, 'bar') } 'Dash in option name'; } { local @ARGV = (qw/--some_thingy bar/); throws_ok { App->new_with_options } qr/Unknown option: some_thingy/; } { local @ARGV = (qw/--another_thingy bar/); lives_and { is( App->new_with_options->another_thingy, 'bar' ) } 'Underscore in option name'; } { local @ARGV = (qw/--another-thingy bar/); throws_ok { App->new_with_options } qr/Unknown option: another-thingy/; } 100_gld_default_bug.t100644000765000024 157512507103627 17405 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More; use Test::Exception; BEGIN { eval 'use Getopt::Long::Descriptive;'; plan skip_all => "Getopt::Long::Descriptive required for this test" if $@; plan tests => 5; use_ok('MouseX::Getopt'); } { package Engine::Foo; use Mouse; with 'MouseX::Getopt'; has 'nproc' => ( metaclass => 'Getopt', is => 'ro', isa => 'Int', default => sub { 1 }, cmd_aliases => 'n', ); } @ARGV = (); { my $foo = Engine::Foo->new_with_options(nproc => 10); isa_ok($foo, 'Engine::Foo'); is($foo->nproc, 10, '... got the right value (10), not the default (1)'); } { my $foo = Engine::Foo->new_with_options(); isa_ok($foo, 'Engine::Foo'); is($foo->nproc, 1, '... got the right value (1), without GLD needing to handle defaults'); } 101_argv_bug.t100644000765000024 114712507103627 16066 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/env perl use strict; use warnings; use Test::More tests => 3; use MouseX::Getopt; { package App; use Mouse; with 'MouseX::Getopt'; has 'length' => ( is => 'ro', isa => 'Int', default => 24, ); has 'verbose' => ( is => 'ro', isa => 'Bool', default => 0, ); no Mouse; } { my $app = App->new_with_options(argv => [ '--verbose', '--length', 50 ]); isa_ok($app, 'App'); ok($app->verbose, '... verbosity is turned on as expected'); is($app->length, 50, '... length is 50 as expected'); } 102_basic_basic.t100644000765000024 1353212507103627 16536 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 69; BEGIN { use_ok('MouseX::Getopt::Basic'); } { package App; use Mouse; with 'MouseX::Getopt::Basic'; has 'data' => ( metaclass => 'MouseX::Getopt::Meta::Attribute', is => 'ro', isa => 'Str', default => 'file.dat', cmd_flag => 'f', ); has 'cow' => ( metaclass => 'Getopt', is => 'ro', isa => 'Str', default => 'moo', cmd_aliases => [qw/ moocow m c /], ); has 'horse' => ( metaclass => 'MouseX::Getopt::Meta::Attribute', is => 'ro', isa => 'Str', default => 'bray', cmd_flag => 'horsey', cmd_aliases => 'x', ); has 'length' => ( is => 'ro', isa => 'Int', default => 24 ); has 'verbose' => ( is => 'ro', isa => 'Bool', ); has 'libs' => ( is => 'ro', isa => 'ArrayRef', default => sub { [] }, ); has 'details' => ( is => 'ro', isa => 'HashRef', default => sub { {} }, ); has '_private_stuff' => ( is => 'ro', isa => 'Int', default => 713 ); has '_private_stuff_cmdline' => ( metaclass => 'MouseX::Getopt::Meta::Attribute', is => 'ro', isa => 'Int', default => 832, cmd_flag => 'p', ); } foreach my $attr_name (qw(data cow horse _private_stuff_cmdline)) { my $attr = App->meta->get_attribute($attr_name); isa_ok($attr, 'Mouse::Meta::Attribute'); isa_ok($attr, 'MouseX::Getopt::Meta::Attribute'); can_ok($attr, 'cmd_flag'); can_ok($attr, 'cmd_aliases'); } { local @ARGV = (); my $app = App->new_with_options; isa_ok($app, 'App'); ok(!$app->verbose, '... verbosity is off as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... data is file.dat as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--verbose', '--length', 50); my $app = App->new_with_options; isa_ok($app, 'App'); ok($app->verbose, '... verbosity is turned on as expected'); is($app->length, 50, '... length is 50 as expected'); is($app->data, 'file.dat', '... data is file.dat as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--verbose', '-f', 'foo.txt'); my $app = App->new_with_options; isa_ok($app, 'App'); ok($app->verbose, '... verbosity is turned on as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'foo.txt', '... data is foo.txt as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--verbose', '--libs', 'libs/', '--libs', 'includes/lib'); my $app = App->new_with_options; isa_ok($app, 'App'); ok($app->verbose, '... verbosity is turned on as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... data is foo.txt as expected'); is_deeply($app->libs, ['libs/', 'includes/lib'], '... libs is [libs/, includes/lib] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } { local @ARGV = ('--details', 'os=mac', '--details', 'name=foo'); my $app = App->new_with_options; isa_ok($app, 'App'); ok(!$app->verbose, '... verbosity is turned on as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... data is foo.txt as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, { os => 'mac', name => 'foo' }, '... details is { os => mac, name => foo } as expected'); } { # Test negation on booleans too ... local @ARGV = ('--noverbose'); my $app = App->new_with_options; isa_ok($app, 'App'); ok(!$app->verbose, '... verbosity is turned off as expected'); is($app->length, 24, '... length is 24 as expected'); is($app->data, 'file.dat', '... file is file.dat as expected'); is_deeply($app->libs, [], '... libs is [] as expected'); is_deeply($app->details, {}, '... details is {} as expected'); } # Test cmd_alias without cmd_flag { local @ARGV = ('--cow', '42'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->cow, 42, 'cmd_alias, but not using it'); } { local @ARGV = ('--moocow', '88'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->cow, 88, 'cmd_alias, using long one'); } { local @ARGV = ('-c', '99'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->cow, 99, 'cmd_alias, using short one'); } # Test cmd_alias + cmd_flag { local @ARGV = ('--horsey', '123'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->horse, 123, 'cmd_alias+cmd_flag, using flag'); } { local @ARGV = ('-x', '321'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->horse, 321, 'cmd_alias+cmd_flag, using alias'); } # Test _foo + cmd_flag { local @ARGV = ('-p', '666'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->_private_stuff_cmdline, 666, '_foo + cmd_flag'); } # Test ARGV support { my @args = ('-p', 12345, '-c', 99, '-'); local @ARGV = @args; my $app = App->new_with_options; isa_ok($app, 'App'); is_deeply($app->ARGV, \@args, 'ARGV accessor'); is_deeply(\@ARGV, \@args, '@ARGV unmangled'); is_deeply($app->extra_argv, ['-'], 'extra_argv accessor'); } 103_uc_bug.t100644000765000024 113012507103627 15530 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/perl use strict; use warnings; use Test::More tests => 3; { package App; use Mouse; with qw(MouseX::Getopt); has 'TrackingNumber' => ( is => 'rw', isa => 'Str', ); has 'otherparam' => ( is => 'rw', isa => 'Str', ); } { local @ARGV = ('--TrackingNumber','1Z1234567812345670','--otherparam','foo'); my $app = App->new_with_options; isa_ok($app, 'App'); is($app->TrackingNumber, '1Z1234567812345670', '... TrackingNumber is as expected'); is($app->otherparam, 'foo', '... otherparam is as expected'); } 104_override_usage.t100644000765000024 315712507103627 17303 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/tuse strict; use warnings; use Test::More 0.88; use Test::Exception; { package MyScript; use Mouse; with 'MouseX::Getopt'; has foo => ( isa => 'Int', is => 'ro', documentation => 'A foo' ); our $usage = 0; before _getopt_full_usage => sub { $usage++; }; our @warnings; before _getopt_spec_warnings => sub { shift; push(@warnings, @_) }; our @exception; before _getopt_spec_exception => sub { shift; push(@exception, @{ shift() }, shift()) }; } { local $MyScript::usage; local @MyScript::warnings; local @MyScript::exception; local @ARGV = ('--foo', '1'); my $i = MyScript->new_with_options; ok $i; is $i->foo, 1; is $MyScript::usage, undef; } { local $MyScript::usage; local @MyScript::warnings; local @MyScript::exception; local @ARGV = ('--help'); throws_ok { MyScript->new_with_options } qr/A foo/; is $MyScript::usage, 1; } { local $MyScript::usage; local @MyScript::warnings; local @MyScript::exception; local @ARGV = ('-q'); # Does not exist throws_ok { MyScript->new_with_options } qr/A foo/; is_deeply \@MyScript::warnings, [ 'Unknown option: q ' ]; my $exp = [ 'Unknown option: q ', $Getopt::Long::Descriptive::VERSION < 0.099 ? qq{usage: 104_override_usage.t [-?] [long options...] \t-? --usage --help Prints this usage information. \t--foo A foo } : qq{usage: 104_override_usage.t [-?] [long options...] \t-? --usage --help Prints this usage information. \t--foo INT A foo } ]; is_deeply \@MyScript::exception, $exp; } done_testing; 105_uc_bug_more.t100644000765000024 172512507103627 16566 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/tuse strict; use warnings; use Test::More; use Mouse (); use Mouse::Meta::Class; foreach my $role (qw/ MouseX::Getopt MouseX::Getopt::GLD MouseX::Getopt::Basic /) { Mouse::Util::load_class($role); my $meta = Mouse::Meta::Class->create_anon_class( superclasses => ['Mouse::Object'], ); $meta->add_attribute('debug', traits => ['Getopt'], isa => 'Bool', cmd_aliases => ['d'], is => 'ro'); $role->meta->apply($meta); ok($meta->name->new_with_options({ argv => ['-d'] })->debug, "debug was set for argv -d on $role"); { local @ARGV = ('-d'); ok($meta->name->new_with_options()->debug, "debug was set for ARGV on $role"); } ok($meta->name->new_with_options({ argv => ['--debug'] })->debug, "debug was set for argv --debug on $role"); ok($meta->name->new_with_options({ argv => ['--debug'] })->debug, "debug was set for argv --debug on $role"); } done_testing; 106_no_ignore_case.t100644000765000024 304112507103627 17244 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/tuse strict; use warnings; use Test::More; use Mouse (); use Mouse::Meta::Class; foreach my $role (qw/ MouseX::Getopt MouseX::Getopt::GLD MouseX::Getopt::Basic /) { Mouse::Util::load_class($role); my $meta = Mouse::Meta::Class->create_anon_class( superclasses => ['Mouse::Object'], ); $meta->add_attribute('BigD', traits => ['Getopt'], isa => 'Bool', cmd_aliases => ['D'], is => 'ro'); $meta->add_attribute('SmallD', traits => ['Getopt'], isa => 'Bool', cmd_aliases => ['d'], is => 'ro'); $role->meta->apply($meta); { my $obj = $meta->name->new_with_options( { argv => ["-d"], no_ignore_case => 1} ); ok((! $obj->BigD), "BigD was not set for argv -d on $role"); ok($obj->SmallD, "SmallD was set for argv -d on $role"); } ok($meta->name->new_with_options({ argv => ['-d'], no_ignore_case => 1}) ->SmallD, "SmallD was set for argv -d on $role"); { local @ARGV = ('-d'); ok($meta->name->new_with_options()->SmallD, "SmallD was set for ARGV on $role"); } ok($meta->name->new_with_options({ argv => ['-D'], no_ignore_case => 1}) ->BigD, "BigD was set for argv -d on $role"); { my $obj = $meta->name->new_with_options( { argv => ['-D', "-d"], no_ignore_case => 1} ); ok($obj->BigD, "BigD was set for argv -D -d on $role"); ok($obj->SmallD, "SmallD was set for argv -D -d on $role"); } } done_testing; 107_no_auto_help.t100644000765000024 355012507103627 16754 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t# Related information: # https://rt.cpan.org/Public/Bug/Display.html?id=47865 # https://rt.cpan.org/Public/Bug/Display.html?id=52474 # https://rt.cpan.org/Public/Bug/Display.html?id=57683 # http://www.nntp.perl.org/group/perl.moose/2010/06/msg1767.html # Summary: If we disable the "auto_help" option in Getopt::Long, then # getoptions() will not call into pod2usage() (causing program termination) # when --help is passed (and MouseX::ConfigFromFile is in use). use strict; use warnings; use Test::More; BEGIN { plan skip_all => 'This test needs MouseX::SimpleConfig 0.07' unless eval { require MouseX::SimpleConfig && MouseX::SimpleConfig->VERSION(0.07); }; } my $fail_on_exit = 1; { package Class; use strict; use warnings; use Mouse; with 'MouseX::SimpleConfig', 'MouseX::Getopt'; # this is a hacky way of being able to check that we made it past the # $opt_parser->getoptions() call in new_with_options, because it is # still going to bail out later on, on seeing the --help flag has configfile => ( is => 'ro', isa => 'Str', default => sub { $fail_on_exit = 0; 'this_value_unimportant', }, ); no Mouse; 1; } use Test::Warn; use Test::Exception; END { ok(!$fail_on_exit, 'getoptions() lives'); done_testing; # cancel the non-zero exit status from _getopt_full_usage() exit 0; } @ARGV = ('--help'); warning_like { throws_ok { Class->new_with_options } #usage: 107_no_auto_help.t [-?] [long options...] qr/^usage: [\d\w]+\Q.t [-?] [long options...]\E.\s+\Q-? --usage --help\E\s+\QPrints this usage information.\E.\s+--configfile/ms, 'usage information looks good'; } qr/^Specified configfile \'this_value_unimportant\' does not exist, is empty, or is not readable$/, 'Our dummy config file doesn\'t exist'; 108_usage_attr.t100644000765000024 165112507103627 16437 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/env perl # Re RT#58715 and the claim in the documentation: # If you have Getopt::Long::Descriptive the usage param is also passed to new. # This tests the fix (that fulfills the documentation claim). use strict; use warnings; use Test::More tests => 3; { package MyClass; use strict; use warnings; use Mouse; with 'MouseX::Getopt'; } Mouse::Meta::Class->create('MyClassWithBasic', superclasses => ['MyClass'], roles => [ 'MouseX::Getopt::Basic' ], ); my $basic_obj = MyClassWithBasic->new_with_options(); ok(!$basic_obj->meta->has_attribute('usage'), 'basic class has no usage attribute'); Mouse::Meta::Class->create('MyClassWithGLD', superclasses => ['MyClass'], roles => [ 'MouseX::Getopt' ], ); my $gld_obj = MyClassWithGLD->new_with_options(); ok($gld_obj->meta->has_attribute('usage'), 'class has usage attribute'); isa_ok($gld_obj->usage, 'Getopt::Long::Descriptive::Usage'); 109_help_flag.t100644000765000024 331212507103627 16217 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t#!/usr/bin/env perl # The documentation claims: # If Getopt::Long::Descriptive is installed and any of the following command # line params are passed (--help, --usage, --?), the program will exit with # usage information... # This is not actually true (as of 0.29), as: # 1. the consuming class must set up a attributes named 'help', 'usage' and # '?' to contain these command line options, which is not clearly # documented as a requirement # 2. the code is checking whether an option was parsed into an attribute # *called* 'help', 'usage' or '?', not whether the option --help, --usage # or --? was passed on the command-line (the mapping could be different, # if cmd_flag or cmd_aliases is used), # This inconsistency is the underlying cause of RT#52474, RT#57683, RT#47865. use strict; use warnings; use Test::More tests => 6; use Test::Exception; { package MyClass; use strict; use warnings; use Mouse; with 'MouseX::Getopt'; } # before fix, prints this on stderr: #Unknown option: ? #usage: test1.t # after fix, prints this on stderr: #usage: test1.t [-?] [long options...] # -? --usage --help Prints this usage information. foreach my $args ( ['--help'], ['--usage'], ['--?'], ['-?'] ) { local @ARGV = @$args; throws_ok { MyClass->new_with_options() } qr/^usage: (?:[\d\w]+)\Q.t [-?] [long options...]\E.^\t\Q-? --usage --help\E\s+\QPrints this usage information.\E$/ms, 'Help request detected; usage information properly printed'; } # now call again, and ensure we got the usage info. my $obj = MyClass->new_with_options(); ok($obj->meta->has_attribute('usage'), 'class has usage attribute'); isa_ok($obj->usage, 'Getopt::Long::Descriptive::Usage'); 110_sort_usage_by_attr_order.t100644000765000024 321312507103627 21360 0ustar00gfxstaff000000000000MouseX-Getopt-0.36/t # The usage information prints the 'documentation' value for all Getopt # attributes, except the order is not deterministic (rather, it uses the order # in which the attributes are stored in the metaclass 'attributes' hash). # Let's sort them by insertion order, which should lead to nicer output: # If MouseX::Getopt is applied early, the help options will be on top # the help options will always be on top (assuming this role is applied # early), followed by options added by parent classes and roles, and then # options added by this class. use strict; use warnings; use Test::More tests => 1; use Test::Exception; { package MyClass; use strict; use warnings; use Mouse; with 'MouseX::Getopt'; has $_ => ( is => 'ro', isa => 'Str', traits => ['Getopt'], documentation => 'Documentation for "' . $_ . '"', ) foreach qw(foo bar baz); } my $obj = MyClass->new_with_options(); my $expected = <<'USAGE'; usage: 110_sort_usage_by_attr_order.t [-?] [long options...] -? --usage --help Prints this usage information. --foo Documentation for "foo" --bar Documentation for "bar" --baz Documentation for "baz" USAGE if ( $Getopt::Long::Descriptive::VERSION >= 0.099 ) { $expected = <<'USAGE'; usage: 110_sort_usage_by_attr_order.t [-?] [long options...] -? --usage --help Prints this usage information. --foo STR Documentation for "foo" --bar STR Documentation for "bar" --baz STR Documentation for "baz" USAGE } $expected =~ s/^[ ]{4}/\t/xmsg; is($obj->usage->text, $expected, 'Usage text has nicely sorted options'); META.yml100644000765000024 565512507103627 14542 0ustar00gfxstaff000000000000MouseX-Getopt-0.36--- abstract: 'A Mouse role for processing command line options' author: - '=over 4' build_requires: Mouse::Meta::Class: '0' MouseX::ConfigFromFile: '0' MouseX::SimpleConfig: '0' Scalar::Util: '0' Test::Exception: '0.21' Test::More: '0.88' Test::Mouse: '0' Test::Warn: '0.21' configure_requires: Module::Build: '0.38' dynamic_config: 0 generated_by: 'Minilla/v2.3.0, CPAN::Meta::Converter version 2.133380' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: MouseX-Getopt no_index: directory: - t - xt - inc - share - eg - examples - author - builder provides: MouseX::Getopt: file: lib/MouseX/Getopt.pm version: '0.36' MouseX::Getopt::Basic: file: lib/MouseX/Getopt/Basic.pm MouseX::Getopt::Dashes: file: lib/MouseX/Getopt/Dashes.pm MouseX::Getopt::GLD: file: lib/MouseX/Getopt/GLD.pm MouseX::Getopt::Meta::Attribute: file: lib/MouseX/Getopt/Meta/Attribute.pm MouseX::Getopt::Meta::Attribute::NoGetopt: file: lib/MouseX/Getopt/Meta/Attribute/NoGetopt.pm MouseX::Getopt::Meta::Attribute::Trait: file: lib/MouseX/Getopt/Meta/Attribute/Trait.pm MouseX::Getopt::Meta::Attribute::Trait::NoGetopt: file: lib/MouseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm MouseX::Getopt::OptionTypeMap: file: lib/MouseX/Getopt/OptionTypeMap.pm MouseX::Getopt::Strict: file: lib/MouseX/Getopt/Strict.pm requires: Getopt::Long: '2.37' Getopt::Long::Descriptive: '0.091' Mouse: '0.64' Mouse::Meta::Attribute: '0' Mouse::Role: '0' Mouse::Util::TypeConstraints: '0' resources: bugtracker: https://github.com/gfx/mousex-getopt/issues homepage: https://github.com/gfx/mousex-getopt repository: git://github.com/gfx/mousex-getopt.git version: '0.36' x_authority: cpan:GFUJI x_contributors: - 'Brandon L Black ' - 'Ryan D Johnson ' - 'Todd Hepler ' - 'John Goulah ' - 'Chris Prather ' - 'Stevan Little ' - 'Yuval Kogman ' - 'Dagfinn Ilmari Mannsåker ' - 'Hans Dieter Pearcey ' - 'Nelo Onyiah ' - 'Ricardo SIGNES ' - 'Devin Austin ' - 'Gordon Irving ' - 'Shlomi Fish ' - 'Hinrik Örn Sigurðsson ' - 'Tomas Doran (t0m) ' - 'Ævar Arnfjörð Bjarmason ' - 'Jesse Luehrs ' - 'Florian Ragwitz ' - 'Karen Etheridge ' - 'Justin Hunter ' - 'Tomas Doran ' - 'Mark Gardner ' - 'Tokuhiro Matsuno ' - 'Paul Howarth ' - 'FUJI Goro (gfx) ' MANIFEST100644000765000024 156612507103627 14417 0ustar00gfxstaff000000000000MouseX-Getopt-0.36Build.PL Changes LICENSE META.json README.md cpanfile lib/MouseX/Getopt.pm lib/MouseX/Getopt/Basic.pm lib/MouseX/Getopt/Dashes.pm lib/MouseX/Getopt/GLD.pm lib/MouseX/Getopt/Meta/Attribute.pm lib/MouseX/Getopt/Meta/Attribute/NoGetopt.pm lib/MouseX/Getopt/Meta/Attribute/Trait.pm lib/MouseX/Getopt/Meta/Attribute/Trait/NoGetopt.pm lib/MouseX/Getopt/OptionTypeMap.pm lib/MouseX/Getopt/Strict.pm minil.toml t/000_load.t t/001_basic.t t/002_custom_option_type.t t/003_inferred_option_type.t t/004_nogetop.t t/005_strict.t t/006_metaclass_traits.t t/007_nogetopt_trait.t t/008_configfromfile.t t/009_gld_and_explicit_options.t t/010_dashes.t t/100_gld_default_bug.t t/101_argv_bug.t t/102_basic_basic.t t/103_uc_bug.t t/104_override_usage.t t/105_uc_bug_more.t t/106_no_ignore_case.t t/107_no_auto_help.t t/108_usage_attr.t t/109_help_flag.t t/110_sort_usage_by_attr_order.t META.yml MANIFEST