@@ -1,32 +1,44 @@
+#
+# This file is part of MooX-Options
+#
+# This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
+#
+# This is free software; you can redistribute it and/or modify it under
+# the same terms as the Perl 5 programming language system itself.
+#
+# This file was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.024.
use strict;
use warnings;
-use Module::Build 0.3601;
+use Module::Build 0.28;
my %module_build_args = (
"build_requires" => {
- "Module::Build" => "0.3601"
+ "Module::Build" => "0.28"
},
"configure_requires" => {
- "Module::Build" => "0.3601"
+ "Module::Build" => "0.28",
+ "perl" => "v5.10.0"
},
"dist_abstract" => "Explicit Options eXtension for Object Class",
"dist_author" => [
"celogeek <me\@celogeek.com>"
],
"dist_name" => "MooX-Options",
- "dist_version" => "4.008",
+ "dist_version" => "4.016",
"license" => "perl",
"module_name" => "MooX::Options",
- "recommends" => {},
+ "recommends" => {
+ "Term::Size::Any" => 0
+ },
"recursive_test_files" => 1,
"requires" => {
"Carp" => 0,
"Data::Record" => 0,
"Getopt::Long" => "2.38",
- "Getopt::Long::Descriptive" => "0.091",
+ "Getopt::Long::Descriptive" => "0.099",
"JSON" => 0,
"MRO::Compat" => 0,
"Module::Metadata" => "1.000019",
@@ -36,8 +48,7 @@ my %module_build_args = (
"Pod::Usage" => 0,
"Regexp::Common" => 0,
"Scalar::Util" => 0,
- "Term::Size::Any" => 0,
- "Text::WrapI18N" => 0,
+ "Text::LineFold" => 0,
"feature" => 0,
"overload" => 0,
"parent" => 0,
@@ -73,7 +84,7 @@ my %fallback_build_requires = (
"FindBin" => 0,
"IO::Handle" => 0,
"IPC::Open3" => 0,
- "Module::Build" => "0.3601",
+ "Module::Build" => "0.28",
"Moo" => "1.003001",
"Role::Tiny::With" => 0,
"Test::More" => "0.94",
@@ -1,3 +1,32 @@
+4.016 2015-01-24 12:30:10 GMT
+ * Feature #470 : Add "hidden" attribute, and doc (Celogeek San)
+ * Feature #471 : Added a better error message for isa check failures (Celogeek San)
+
+4.015 2015-01-13 16:06:52 GMT
+ * Bug #466 : Term::Any::Size should be recommanded but optional (Celogeek San)
+ fix eval
+
+4.014 2015-01-13 15:51:32 GMT
+ * Bug #464 : warning generated when missing required params (Celogeek San)
+ * Bug #466 : Term::Any::Size should be recommanded but optional (Celogeek San)
+
+4.013 2014-11-22 07:43:13 GMT
+ * Feature #462 : Autorange (Celogeek San)
+
+4.012 2014-10-07 09:42:27 GMT
+ * Bug #455 : Option of options should not be change for trait (Celogeek San)
+ handle shorter name
+
+4.011 2014-10-07 08:51:50 GMT
+ * Bug #455 : Option of options should not be change for trait (Celogeek San)
+
+4.010 2014-09-05 16:49:56 GMT
+ * Feature #453 : Use Text::LineFold instead of Text::WrapI18N (Celogeek San)
+ * Feature #452 : Support UTF8 source for pod and man (Celogeek San)
+
+4.009 2014-07-08 10:15:09 GMT
+ * Bug #450 : options with format "s" do not accept "0" as value (Celogeek San)
+
4.008 2014-02-01 09:49:36 GMT
* Bug #405 : fix typo in pod (Celogeek San)
@@ -22,7 +22,7 @@ This is free software, licensed under:
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -1,3 +1,4 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.024.
Build.PL
Changes
LICENSE
@@ -17,16 +18,19 @@ lib/MooX/Options/Manual/Man.pod
lib/MooX/Options/Manual/MooXCmd.pod
lib/MooX/Options/Manual/NamespaceClean.pod
lib/MooX/Options/Role.pm
-perltidy.LOG
t/00-compile.t
t/000-report-versions.t
t/around_options_usage.t
t/author-critic.t
+t/autosplit_warning_on_required_param.t
t/base.st
t/check_target_methods.t
+t/doc-utf8.t
t/doc.t
t/failure.t
t/flavour.t
+t/hidden.t
+t/isa_check.t
t/lib/MooXCmdTest.pm
t/lib/MooXCmdTest/Cmd/test1.pm
t/lib/MooXCmdTest/Cmd/test1/Cmd/test2.pm
@@ -36,16 +40,17 @@ t/mo.t
t/moo.t
t/moose.t
t/moox-cmd.t
-t/mouse.t
t/multi_role.t
t/namespace_clean.t
t/no_option.t
+t/option-of-option.t
t/order.t
t/pod.t
t/release-kwalitee.t
t/release-pod-coverage.t
t/release-unused-vars.t
t/role.t
+t/string_with_zero_value.t
t/with_config.t
xt/perlcritic.rc
xt/perltidy.rc
@@ -4,7 +4,7 @@
"celogeek <me@celogeek.com>"
],
"dynamic_config" : 0,
- "generated_by" : "Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.132830",
+ "generated_by" : "Dist::Zilla version 5.024, CPAN::Meta::Converter version 2.142690",
"license" : [
"perl_5"
],
@@ -16,12 +16,13 @@
"prereqs" : {
"build" : {
"requires" : {
- "Module::Build" : "0.3601"
+ "Module::Build" : "0.28"
}
},
"configure" : {
"requires" : {
- "Module::Build" : "0.3601"
+ "Module::Build" : "0.28",
+ "perl" : "v5.10.0"
}
},
"develop" : {
@@ -31,11 +32,14 @@
}
},
"runtime" : {
+ "recommends" : {
+ "Term::Size::Any" : "0"
+ },
"requires" : {
"Carp" : "0",
"Data::Record" : "0",
"Getopt::Long" : "2.38",
- "Getopt::Long::Descriptive" : "0.091",
+ "Getopt::Long::Descriptive" : "0.099",
"JSON" : "0",
"MRO::Compat" : "0",
"Module::Metadata" : "1.000019",
@@ -45,8 +49,7 @@
"Pod::Usage" : "0",
"Regexp::Common" : "0",
"Scalar::Util" : "0",
- "Term::Size::Any" : "0",
- "Text::WrapI18N" : "0",
+ "Text::LineFold" : "0",
"feature" : "0",
"overload" : "0",
"parent" : "0",
@@ -87,76 +90,92 @@
"web" : "https://github.com/celogeek/MooX-Options"
}
},
- "version" : "4.008",
+ "version" : "4.016",
"x_Dist_Zilla" : {
"perl" : {
- "version" : "5.018002"
+ "version" : "5.020001"
},
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::GatherDir",
+ "config" : {
+ "Dist::Zilla::Plugin::GatherDir" : {
+ "exclude_filename" : [],
+ "exclude_match" : [],
+ "follow_symlinks" : "0",
+ "include_dotfiles" : "0",
+ "prefix" : "",
+ "prune_directory" : [],
+ "root" : "."
+ }
+ },
"name" : "@GRS/@Filter/GatherDir",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::PruneCruft",
"name" : "@GRS/@Filter/PruneCruft",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::ManifestSkip",
"name" : "@GRS/@Filter/ManifestSkip",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::MetaYAML",
"name" : "@GRS/@Filter/MetaYAML",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::License",
"name" : "@GRS/@Filter/License",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::Readme",
"name" : "@GRS/@Filter/Readme",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::ExtraTests",
"name" : "@GRS/@Filter/ExtraTests",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::ExecDir",
"name" : "@GRS/@Filter/ExecDir",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::ShareDir",
"name" : "@GRS/@Filter/ShareDir",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::Manifest",
"name" : "@GRS/@Filter/Manifest",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::TestRelease",
"name" : "@GRS/@Filter/TestRelease",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::ConfirmRelease",
"name" : "@GRS/@Filter/ConfirmRelease",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::ModuleBuild",
+ "config" : {
+ "Dist::Zilla::Role::TestRunner" : {
+ "default_jobs" : 1
+ }
+ },
"name" : "@GRS/ModuleBuild",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::ReportVersions",
@@ -166,7 +185,7 @@
{
"class" : "Dist::Zilla::Plugin::OurPkgVersion",
"name" : "@GRS/OurPkgVersion",
- "version" : "0.005000"
+ "version" : "0.005001"
},
{
"class" : "Dist::Zilla::Plugin::Prepender",
@@ -176,64 +195,67 @@
{
"class" : "Dist::Zilla::Plugin::MinimumPerl",
"name" : "@GRS/MinimumPerl",
- "version" : "1.003"
+ "version" : "1.006"
},
{
"class" : "Dist::Zilla::Plugin::Test::Compile",
"config" : {
"Dist::Zilla::Plugin::Test::Compile" : {
+ "bail_out_on_fail" : "0",
+ "fail_on_warning" : "author",
+ "fake_home" : "0",
"filename" : "t/00-compile.t",
"module_finder" : [
":InstallModules"
],
+ "needs_display" : "0",
+ "phase" : "test",
"script_finder" : [
":ExecFiles"
- ]
+ ],
+ "skips" : []
}
},
"name" : "@GRS/Test::Compile",
- "version" : "2.039"
+ "version" : "2.051"
},
{
"class" : "Dist::Zilla::Plugin::Test::UnusedVars",
"name" : "@GRS/Test::UnusedVars",
- "version" : "2.000005"
+ "version" : "2.000006"
},
{
"class" : "Dist::Zilla::Plugin::PodCoverageTests",
"name" : "@GRS/PodCoverageTests",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::PruneFiles",
"name" : "@GRS/PruneFiles",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::ReadmeMarkdownFromPod",
"name" : "@GRS/ReadmeMarkdownFromPod",
- "version" : "0.120120"
+ "version" : "0.141140"
},
{
"class" : "Dist::Zilla::Plugin::MetaJSON",
"name" : "@GRS/MetaJSON",
- "version" : "5.006"
- },
- {
- "class" : "Dist::Zilla::Plugin::MetaResourcesFromGit",
- "name" : "@GRS/MetaResourcesFromGit",
- "version" : "1.103620"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::MetaConfig",
"name" : "@GRS/MetaConfig",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::PodWeaver",
"config" : {
"Dist::Zilla::Plugin::PodWeaver" : {
- "config_plugin" : "@GRS",
+ "config_plugins" : [
+ "@GRS"
+ ],
"finder" : [
":InstallModules",
":ExecFiles"
@@ -242,93 +264,93 @@
{
"class" : "Pod::Weaver::Plugin::EnsurePod5",
"name" : "@CorePrep/EnsurePod5",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Plugin::H1Nester",
"name" : "@CorePrep/H1Nester",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Name",
"name" : "@Default/Name",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Version",
"name" : "@Default/Version",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Region",
"name" : "@Default/prelude",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "DESCRIPTION",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "SYNOPSIS",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Generic",
"name" : "OVERVIEW",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "ATTRIBUTES",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "METHODS",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Collect",
"name" : "FUNCTIONS",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Leftovers",
"name" : "@Default/Leftovers",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Region",
"name" : "@Default/postlude",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Bugs",
"name" : "@Default/Bugs",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Authors",
"name" : "@Default/Authors",
- "version" : "4.004"
+ "version" : "4.007"
},
{
"class" : "Pod::Weaver::Section::Legal",
"name" : "@Default/Legal",
- "version" : "4.004"
+ "version" : "4.007"
}
]
}
},
"name" : "@GRS/PodWeaver",
- "version" : "4.002"
+ "version" : "4.006"
},
{
"class" : "Dist::Zilla::Plugin::PerlTidy",
"name" : "@GRS/PerlTidy",
- "version" : "0.13"
+ "version" : "0.19"
},
{
"class" : "Dist::Zilla::Plugin::Test::Perl::Critic",
@@ -338,12 +360,12 @@
{
"class" : "Dist::Zilla::Plugin::Test::Kwalitee::Extra",
"name" : "@GRS/Test::Kwalitee::Extra",
- "version" : "v0.2.0"
+ "version" : "v0.2.1"
},
{
"class" : "Dist::Zilla::Plugin::AutoPrereqs",
"name" : "AutoPrereqs",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::Prereqs",
@@ -354,7 +376,18 @@
}
},
"name" : "Prereqs",
- "version" : "5.006"
+ "version" : "5.024"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::Prereqs",
+ "config" : {
+ "Dist::Zilla::Plugin::Prereqs" : {
+ "phase" : "runtime",
+ "type" : "recommends"
+ }
+ },
+ "name" : "RuntimeRecommends",
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::MetaResourcesFromGit",
@@ -364,32 +397,42 @@
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":InstallModules",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":IncModules",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":TestFiles",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ExecFiles",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":ShareFiles",
- "version" : "5.006"
+ "version" : "5.024"
},
{
"class" : "Dist::Zilla::Plugin::FinderCode",
"name" : ":MainModule",
- "version" : "5.006"
+ "version" : "5.024"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":AllFiles",
+ "version" : "5.024"
+ },
+ {
+ "class" : "Dist::Zilla::Plugin::FinderCode",
+ "name" : ":NoFiles",
+ "version" : "5.024"
}
],
"zilla" : {
@@ -397,7 +440,7 @@
"config" : {
"is_trial" : "0"
},
- "version" : "5.006"
+ "version" : "5.024"
}
}
}
@@ -3,174 +3,191 @@ abstract: 'Explicit Options eXtension for Object Class'
author:
- 'celogeek <me@celogeek.com>'
build_requires:
- Capture::Tiny: 0
- English: 0
- File::Spec: 0
- FindBin: 0
- IO::Handle: 0
- IPC::Open3: 0
- Module::Build: 0.3601
- Moo: 1.003001
- Role::Tiny::With: 0
- Test::More: 0.94
- Test::Requires: 0
- Test::Trap: 0
- Try::Tiny: 0
- lib: 0
- namespace::clean: 0
- perl: 5.010
+ Capture::Tiny: '0'
+ English: '0'
+ File::Spec: '0'
+ FindBin: '0'
+ IO::Handle: '0'
+ IPC::Open3: '0'
+ Module::Build: '0.28'
+ Moo: '1.003001'
+ Role::Tiny::With: '0'
+ Test::More: '0.94'
+ Test::Requires: '0'
+ Test::Trap: '0'
+ Try::Tiny: '0'
+ lib: '0'
+ namespace::clean: '0'
+ perl: '5.010'
configure_requires:
- Module::Build: 0.3601
+ Module::Build: '0.28'
+ perl: v5.10.0
dynamic_config: 0
-generated_by: 'Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.132830'
+generated_by: 'Dist::Zilla version 5.024, CPAN::Meta::Converter version 2.142690'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: MooX-Options
+recommends:
+ Term::Size::Any: '0'
requires:
- Carp: 0
- Data::Record: 0
- Getopt::Long: 2.38
- Getopt::Long::Descriptive: 0.091
- JSON: 0
- MRO::Compat: 0
- Module::Metadata: 1.000019
- Moo: 1.003001
- MooX::ConfigFromFile: 0
- Path::Class: 0.32
- Pod::Usage: 0
- Regexp::Common: 0
- Scalar::Util: 0
- Term::Size::Any: 0
- Text::WrapI18N: 0
- feature: 0
- overload: 0
- parent: 0
- perl: 5.010
- strict: 0
- warnings: 0
+ Carp: '0'
+ Data::Record: '0'
+ Getopt::Long: '2.38'
+ Getopt::Long::Descriptive: '0.099'
+ JSON: '0'
+ MRO::Compat: '0'
+ Module::Metadata: '1.000019'
+ Moo: '1.003001'
+ MooX::ConfigFromFile: '0'
+ Path::Class: '0.32'
+ Pod::Usage: '0'
+ Regexp::Common: '0'
+ Scalar::Util: '0'
+ Text::LineFold: '0'
+ feature: '0'
+ overload: '0'
+ parent: '0'
+ perl: '5.010'
+ strict: '0'
+ warnings: '0'
resources:
bugtracker: https://github.com/celogeek/MooX-Options/issues
homepage: https://tasks.celogeek.com/projects/perl-modules-moox-options
repository: https://github.com/celogeek/MooX-Options.git
-version: 4.008
+version: '4.016'
x_Dist_Zilla:
perl:
- version: 5.018002
+ version: '5.020001'
plugins:
-
class: Dist::Zilla::Plugin::GatherDir
+ config:
+ Dist::Zilla::Plugin::GatherDir:
+ exclude_filename: []
+ exclude_match: []
+ follow_symlinks: '0'
+ include_dotfiles: '0'
+ prefix: ''
+ prune_directory: []
+ root: .
name: '@GRS/@Filter/GatherDir'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::PruneCruft
name: '@GRS/@Filter/PruneCruft'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::ManifestSkip
name: '@GRS/@Filter/ManifestSkip'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::MetaYAML
name: '@GRS/@Filter/MetaYAML'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::License
name: '@GRS/@Filter/License'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::Readme
name: '@GRS/@Filter/Readme'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::ExtraTests
name: '@GRS/@Filter/ExtraTests'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::ExecDir
name: '@GRS/@Filter/ExecDir'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::ShareDir
name: '@GRS/@Filter/ShareDir'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::Manifest
name: '@GRS/@Filter/Manifest'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::TestRelease
name: '@GRS/@Filter/TestRelease'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::ConfirmRelease
name: '@GRS/@Filter/ConfirmRelease'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::ModuleBuild
+ config:
+ Dist::Zilla::Role::TestRunner:
+ default_jobs: 1
name: '@GRS/ModuleBuild'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::ReportVersions
name: '@GRS/ReportVersions'
- version: 1.110730
+ version: '1.110730'
-
class: Dist::Zilla::Plugin::OurPkgVersion
name: '@GRS/OurPkgVersion'
- version: 0.005000
+ version: '0.005001'
-
class: Dist::Zilla::Plugin::Prepender
name: '@GRS/Prepender'
- version: 1.112280
+ version: '1.112280'
-
class: Dist::Zilla::Plugin::MinimumPerl
name: '@GRS/MinimumPerl'
- version: 1.003
+ version: '1.006'
-
class: Dist::Zilla::Plugin::Test::Compile
config:
Dist::Zilla::Plugin::Test::Compile:
+ bail_out_on_fail: '0'
+ fail_on_warning: author
+ fake_home: '0'
filename: t/00-compile.t
module_finder:
- ':InstallModules'
+ needs_display: '0'
+ phase: test
script_finder:
- ':ExecFiles'
+ skips: []
name: '@GRS/Test::Compile'
- version: 2.039
+ version: '2.051'
-
class: Dist::Zilla::Plugin::Test::UnusedVars
name: '@GRS/Test::UnusedVars'
- version: 2.000005
+ version: '2.000006'
-
class: Dist::Zilla::Plugin::PodCoverageTests
name: '@GRS/PodCoverageTests'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::PruneFiles
name: '@GRS/PruneFiles'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::ReadmeMarkdownFromPod
name: '@GRS/ReadmeMarkdownFromPod'
- version: 0.120120
+ version: '0.141140'
-
class: Dist::Zilla::Plugin::MetaJSON
name: '@GRS/MetaJSON'
- version: 5.006
- -
- class: Dist::Zilla::Plugin::MetaResourcesFromGit
- name: '@GRS/MetaResourcesFromGit'
- version: 1.103620
+ version: '5.024'
-
class: Dist::Zilla::Plugin::MetaConfig
name: '@GRS/MetaConfig'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::PodWeaver
config:
Dist::Zilla::Plugin::PodWeaver:
- config_plugin: '@GRS'
+ config_plugins:
+ - '@GRS'
finder:
- ':InstallModules'
- ':ExecFiles'
@@ -178,85 +195,85 @@ x_Dist_Zilla:
-
class: Pod::Weaver::Plugin::EnsurePod5
name: '@CorePrep/EnsurePod5'
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Plugin::H1Nester
name: '@CorePrep/H1Nester'
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Name
name: '@Default/Name'
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Version
name: '@Default/Version'
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Region
name: '@Default/prelude'
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Generic
name: DESCRIPTION
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Generic
name: SYNOPSIS
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Generic
name: OVERVIEW
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Collect
name: ATTRIBUTES
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Collect
name: METHODS
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Collect
name: FUNCTIONS
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Leftovers
name: '@Default/Leftovers'
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Region
name: '@Default/postlude'
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Bugs
name: '@Default/Bugs'
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Authors
name: '@Default/Authors'
- version: 4.004
+ version: '4.007'
-
class: Pod::Weaver::Section::Legal
name: '@Default/Legal'
- version: 4.004
+ version: '4.007'
name: '@GRS/PodWeaver'
- version: 4.002
+ version: '4.006'
-
class: Dist::Zilla::Plugin::PerlTidy
name: '@GRS/PerlTidy'
- version: 0.13
+ version: '0.19'
-
class: Dist::Zilla::Plugin::Test::Perl::Critic
name: '@GRS/Test::Perl::Critic'
- version: 2.112410
+ version: '2.112410'
-
class: Dist::Zilla::Plugin::Test::Kwalitee::Extra
name: '@GRS/Test::Kwalitee::Extra'
- version: v0.2.0
+ version: v0.2.1
-
class: Dist::Zilla::Plugin::AutoPrereqs
name: AutoPrereqs
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::Prereqs
config:
@@ -264,37 +281,53 @@ x_Dist_Zilla:
phase: runtime
type: requires
name: Prereqs
- version: 5.006
+ version: '5.024'
+ -
+ class: Dist::Zilla::Plugin::Prereqs
+ config:
+ Dist::Zilla::Plugin::Prereqs:
+ phase: runtime
+ type: recommends
+ name: RuntimeRecommends
+ version: '5.024'
-
class: Dist::Zilla::Plugin::MetaResourcesFromGit
name: MetaResourcesFromGit
- version: 1.103620
+ version: '1.103620'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':InstallModules'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':IncModules'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':TestFiles'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ExecFiles'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':ShareFiles'
- version: 5.006
+ version: '5.024'
-
class: Dist::Zilla::Plugin::FinderCode
name: ':MainModule'
- version: 5.006
+ version: '5.024'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':AllFiles'
+ version: '5.024'
+ -
+ class: Dist::Zilla::Plugin::FinderCode
+ name: ':NoFiles'
+ version: '5.024'
zilla:
class: Dist::Zilla::Dist::Builder
config:
- is_trial: 0
- version: 5.006
+ is_trial: '0'
+ version: '5.024'
@@ -1,7 +1,7 @@
This archive contains the distribution MooX-Options,
-version 4.008:
+version 4.016:
Explicit Options eXtension for Object Class
@@ -11,3 +11,5 @@ This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
+This README file was generated by Dist::Zilla::Plugin::Readme v5.024.
+
@@ -4,7 +4,7 @@ MooX::Options - Explicit Options eXtension for Object Class
# VERSION
-version 4.008
+version 4.016
# DESCRIPTION
@@ -52,14 +52,14 @@ The help message :
perl myTool.pl --help
USAGE: myTool.pl [-h] [long options...]
- --show_this_file: String
- the file to display
-
- -h --help:
- show this help message
-
- --man:
- show the manual
+ --show_this_file: String
+ the file to display
+
+ -h --help:
+ show this help message
+
+ --man:
+ show the manual
The usage message :
@@ -205,7 +205,7 @@ By default, it's a boolean value.
Take a look of available formats with [Getopt::Long::Descriptive](https://metacpan.org/pod/Getopt::Long::Descriptive).
You need to understand that everything is explicit here.
-If you use [Moose](https://metacpan.org/pod/Moose) and your attribute has `isa => 'Array[Int]'`, that will __not__ imply the format `i@`.
+If you use [Moose](https://metacpan.org/pod/Moose) and your attribute has `isa => 'Array[Int]'`, that will **not** imply the format `i@`.
## format json : special format support
@@ -250,6 +250,30 @@ It will also handle quoted params with the autosplit.
myTool --testStr='a,b,"c,d",e,f' # testStr ("a", "b", "c,d", "e", "f")
+## autorange
+
+For another repeatable option you can add the autorange feature with your specific parameters. This
+allows you to pass number ranges instead of passing each individual number.
+
+ option test => (is => 'ro', format => 'i@', default => sub {[]}, autorange => 1);
+
+ myTool --test=1 --test=2 # test = (1, 2)
+ myTool --test=1,2,3 # test = (1, 2, 3)
+ myTool --test=1,2,3..6 # test = (1, 2, 3, 4, 5, 6)
+
+It will also handle quoted params like `autosplit`, and will not rangify them.
+
+ option testStr => (is => 'ro', format => 's@', default => sub {[]}, autorange => 1);
+
+ myTool --testStr='1,2,"3,a,4",5' # testStr (1, 2, "3,a,4", 5)
+
+`autosplit` will be set to ',' if undefined. You may set `autosplit` to a different delimiter than ','
+for your group separation, but the range operator '..' cannot be changed.
+
+ option testStr => (is => 'ro', format => 's@', default => sub {[]}, autorange => 1, autosplit => '-');
+
+ myTool --testStr='1-2-3-5..7' # testStr (1, 2, 3, 5, 6, 7)
+
## short
Long option can also have short version or aliased.
@@ -279,6 +303,16 @@ By default all options have an order set to `0`, and options are sorted by their
option 'at_the_end' => (is => 'ro', order => 999);
+## hidden
+
+Hide option from doc but still an option you can use on command line.
+
+ option 'debug' => (is => 'ro', doc => 'hidden');
+
+Or
+
+ option 'debug' => (is => 'ro', hidden => 1);
+
# ADDITIONAL MANUALS
- [Man parameters](https://metacpan.org/pod/MooX::Options::Manual::Man)
@@ -2,17 +2,20 @@ name = MooX-Options
license = Perl_5
copyright_holder = celogeek <me@celogeek.com>
copyright_year = 2013
-version = 4.008
+version = 4.016
[@GRS]
-remove = AutoPrereqs
-remove = Prereqs
+-remove=MetaResourcesFromGit
[AutoPrereqs]
skip = Role$|^Moose$|^Mo$|^MooX::Cmd$
[Prereqs]
Moo = 1.003001
Module::Metadata = 1.000019
MooX::ConfigFromFile = 0
+[Prereqs / RuntimeRecommends]
+Term::Size::Any=0
[MetaResourcesFromGit]
homepage = https://tasks.celogeek.com/projects/perl-modules-moox-options
bugtracker.web = https://github.com/celogeek/MooX-Options/issues
@@ -12,13 +12,21 @@ package MooX::Options::Descriptive::Usage;
use strict;
use warnings;
-our $VERSION = '4.008'; # VERSION
-use feature 'say';
-use Text::WrapI18N;
-use Term::Size::Any qw/chars/;
+our $VERSION = '4.016'; # VERSION
+use feature 'say', 'state';
+use Text::LineFold;
use Getopt::Long::Descriptive;
use Scalar::Util qw/blessed/;
+BEGIN {
+ ## no critic (ProhibitStringyEval)
+ if ( !eval "use Term::Size::Any qw/chars/; 1" ) {
+ no strict 'refs';
+ *{"MooX::Options::Descriptive::Usage::chars"}
+ = sub { return ( 80, 25 ) };
+ }
+}
+
my %format_doc = (
's' => 'String',
's@' => '[Strings]',
@@ -70,13 +78,12 @@ sub text {
}
# set the column size of your terminal into the wrapper
-sub _set_column_size {
+sub _get_line_fold {
my ($columns) = chars();
$columns //= 78;
$columns = $ENV{TEST_FORCE_COLUMN_SIZE}
if defined $ENV{TEST_FORCE_COLUMN_SIZE};
- $Text::WrapI18N::columns = $columns - 4;
- return;
+ return Text::LineFold->new( ColMax => $columns - 4 );
}
sub option_text {
@@ -85,7 +92,7 @@ sub option_text {
= defined $self->{target} ? $self->{target}->_options_data : ();
my $getopt_options = $self->{options};
my @message;
- _set_column_size;
+ my $lf = _get_line_fold();
for my $opt (@$getopt_options) {
my ( $short, $format ) = $opt->{spec} =~ /(?:\|(\w))?(?:=(.*?))?$/x;
my $format_doc_str;
@@ -97,7 +104,7 @@ sub option_text {
. ( length( $opt->{name} ) > 1 ? "-" : "" )
. $opt->{name} . ":"
. ( defined $format_doc_str ? " " . $format_doc_str : "" );
- push @message, wrap( " ", " ", $opt->{desc} );
+ push @message, $lf->fold( " ", " ", $opt->{desc} );
push @message, "";
}
@@ -120,7 +127,7 @@ sub option_pod {
? $self->{target}->_options_sub_commands() // []
: [];
- my @man = ( "=head1 NAME", $prog_name, );
+ my @man = ( "=encoding UTF-8", "=head1 NAME", $prog_name, );
if ( defined( my $description = $options_config{description} ) ) {
push @man, "=head1 DESCRIPTION", $description;
@@ -239,7 +246,7 @@ MooX::Options::Descriptive::Usage - Usage class
=head1 VERSION
-version 4.008
+version 4.016
=head1 DESCRIPTION
@@ -249,6 +256,10 @@ This class use the full size of your terminal
=head1 METHODS
+=head2 chars
+
+Return (Columns, Rows) of the current terminal
+
=head2 new
The object is create with L<MooX::Options::Descriptive>.
@@ -12,10 +12,10 @@ package MooX::Options::Descriptive;
use strict;
use warnings;
-our $VERSION = '4.008'; # VERSION
+our $VERSION = '4.016'; # VERSION
use Getopt::Long 2.38;
-use Getopt::Long::Descriptive 0.091;
+use Getopt::Long::Descriptive 0.099;
use MooX::Options::Descriptive::Usage;
use parent 'Getopt::Long::Descriptive';
@@ -33,7 +33,7 @@ MooX::Options::Descriptive - This method extend Getopt::Long::Descriptive to cha
=head1 VERSION
-version 4.008
+version 4.016
=head1 DESCRIPTION
@@ -11,7 +11,7 @@ MooX::Options::Manual::Man - More documentation for the man option
=head1 VERSION
-version 4.008
+version 4.016
=head1 DESCRIPTION
@@ -11,7 +11,7 @@ MooX::Options::Manual::MooXCmd - Manage your tools with MooX::Cmd
=head1 VERSION
-version 4.008
+version 4.016
=head1 DESCRIPTION
@@ -11,7 +11,7 @@ MooX::Options::Manual::NamespaceClean - Use namespace::clean with MooX::Options
=head1 VERSION
-version 4.008
+version 4.016
=head1 DESCRIPTION
@@ -12,7 +12,7 @@ package MooX::Options::Role;
use strict;
use warnings;
-our $VERSION = '4.008'; # VERSION
+our $VERSION = '4.016'; # VERSION
use MRO::Compat;
use MooX::Options::Descriptive;
@@ -39,6 +39,7 @@ sub _options_prepare_descriptive {
my ($options_data) = @_;
my @options;
+ my %all_options;
my %has_to_split;
for my $name (
@@ -52,8 +53,17 @@ sub _options_prepare_descriptive {
my %data = %{ $options_data->{$name} };
my $doc = $data{doc};
$doc = "no doc for $name" if !defined $doc;
+ my $option = {};
+ $option->{hidden} = 1 if $data{hidden};
- push @options, [ _option_name( $name, %data ), $doc ];
+ push @options, [ _option_name( $name, %data ), $doc, $option ];
+
+ push @{ $all_options{$name} }, $name;
+ for ( my $i = 1; $i <= length($name); $i++ ) {
+ my $long_short = substr( $name, 0, $i );
+ push @{ $all_options{$long_short} }, $name
+ if !exists $options_data->{$long_short};
+ }
if ( defined $data{autosplit} ) {
$has_to_split{$name} = Data::Record->new(
@@ -68,16 +78,17 @@ sub _options_prepare_descriptive {
}
}
- return \@options, \%has_to_split;
+ return \@options, \%has_to_split, \%all_options;
}
+## no critic (ProhibitExcessComplexity)
sub _options_fix_argv {
- my ( $option_data, $has_to_split ) = @_;
+ my ( $option_data, $has_to_split, $all_options ) = @_;
my @new_argv;
#parse all argv
- while ( my $arg = shift @ARGV ) {
+ while ( defined( my $arg = shift @ARGV ) ) {
if ( $arg eq '--' ) {
push @new_argv, $arg, @ARGV;
last;
@@ -102,11 +113,21 @@ sub _options_fix_argv {
= $arg_name_with_dash =~ /^(\-+)(no\-)?(.*)$/x;
$arg_name_without_dash =~ s/\-/_/gx;
+ my $original_long_option = $all_options->{$arg_name_without_dash};
+ if ( defined $original_long_option ) {
+ if ( @$original_long_option == 1 ) {
+ $original_long_option = $original_long_option->[0];
+ }
+ else {
+ $original_long_option = undef;
+ }
+ }
+
my $arg_name = $dash;
- if ( defined $negative ) {
- if ( exists $option_data->{$arg_name_without_dash}
- && $option_data->{$arg_name_without_dash}{negativable} )
+ if ( defined $negative && defined $original_long_option ) {
+ if ( exists $option_data->{$original_long_option}
+ && $option_data->{$original_long_option}{negativable} )
{
$arg_name .= 'no-';
}
@@ -118,21 +139,60 @@ sub _options_fix_argv {
$arg_name .= $arg_name_without_dash;
if ( my $rec = $has_to_split->{$arg_name_without_dash} ) {
- $arg_values = shift @ARGV;
- foreach my $record ( $rec->records($arg_values) ) {
-
- #remove the quoted if exist to chain
- $record =~ s/^['"]|['"]$//gx;
- push @new_argv, $arg_name, $record;
+ if ( $arg_values = shift @ARGV ) {
+ my $autorange
+ = defined $original_long_option
+ && exists $option_data->{$original_long_option}
+ && $option_data->{$original_long_option}{autorange};
+ foreach my $record ( $rec->records($arg_values) ) {
+
+ #remove the quoted if exist to chain
+ $record =~ s/^['"]|['"]$//gx;
+ if ($autorange) {
+ push @new_argv,
+ map { $arg_name => $_ }
+ _expand_autorange($record);
+ }
+ else {
+ push @new_argv, $arg_name, $record;
+ }
+ }
}
}
else {
push @new_argv, $arg_name;
}
+
+ # if option has an argument, we keep the argument untouched
+ if ( defined $original_long_option
+ && ( my $opt_data = $option_data->{$original_long_option} ) )
+ {
+ if ( $opt_data->{format} ) {
+ push @new_argv, shift @ARGV;
+ }
+ }
}
return @new_argv;
+}
+## use critic
+sub _expand_autorange {
+ my ($arg_value) = @_;
+
+ my @expanded_arg_value;
+ my ( $left_figure, $autorange_found, $right_figure )
+ = $arg_value =~ /^(\d*)(\.\.)(\d*)$/x;
+ if ($autorange_found) {
+ $left_figure = $right_figure
+ if !defined $left_figure || !length($left_figure);
+ $right_figure = $left_figure
+ if !defined $right_figure || !length($right_figure);
+ if ( defined $left_figure && defined $right_figure ) {
+ push @expanded_arg_value, $left_figure .. $right_figure;
+ }
+ }
+ return @expanded_arg_value ? @expanded_arg_value : $arg_value;
}
### PRIVATE
@@ -187,18 +247,22 @@ sub new_with_options {
return $self
if eval { $self = $class->new(%cmdline_params); 1 };
if ( $@ =~ /^Attribute\s\((.*?)\)\sis\srequired/x ) {
- print "$1 is missing\n";
+ print STDERR "$1 is missing\n";
}
elsif ( $@ =~ /^Missing\srequired\sarguments:\s(.*)\sat\s\(/x ) {
my @missing_required = split /,\s/x, $1;
- print join( "\n", ( map { $_ . " is missing" } @missing_required ),
+ print STDERR
+ join( "\n", ( map { $_ . " is missing" } @missing_required ),
'' );
}
elsif ( $@ =~ /^(.*?)\srequired/x ) {
- print "$1 is missing\n";
+ print STDERR "$1 is missing\n";
+ }
+ elsif ( $@ =~ /^isa check.*?failed: / ) {
+ print STDERR substr( $@, index( $@, ':' ) + 2 );
}
else {
- croak $@;
+ print STDERR $@;
}
%cmdline_params = $class->parse_options( help => 1 );
return $class->options_usage( 1, $cmdline_params{help} );
@@ -213,11 +277,11 @@ sub parse_options {
delete @options_data{ @{ $options_config{skip_options} } };
}
- my ( $options, $has_to_split )
+ my ( $options, $has_to_split, $all_options )
= _options_prepare_descriptive( \%options_data );
local @ARGV = @ARGV if $options_config{protect_argv};
- @ARGV = _options_fix_argv( \%options_data, $has_to_split );
+ @ARGV = _options_fix_argv( \%options_data, $has_to_split, $all_options );
my @flavour;
if ( defined $options_config{flavour} ) {
@@ -258,7 +322,7 @@ sub parse_options {
if (!eval { $cmdline_params{$name} = decode_json($val); 1 }
)
{
- carp $@;
+ print STDERR $@;
return $class->options_usage( 1, $usage );
}
}
@@ -342,7 +406,7 @@ sub options_man {
}
my $man_file = file( Path::Class::tempdir( CLEANUP => 1 ), 'help.pod' );
- $man_file->spew( $usage->option_pod );
+ $man_file->spew( iomode => '>:encoding(UTF-8)', $usage->option_pod );
pod2usage(
-verbose => 2,
@@ -378,7 +442,7 @@ MooX::Options::Role - role that is apply to your object
=head1 VERSION
-version 4.008
+version 4.016
=head1 METHODS
@@ -12,11 +12,11 @@ package MooX::Options;
use strict;
use warnings;
-our $VERSION = '4.008'; # VERSION
+our $VERSION = '4.016'; # VERSION
use Carp;
my @OPTIONS_ATTRIBUTES
- = qw/format short repeatable negativable autosplit doc long_doc order json/;
+ = qw/format short repeatable negativable autosplit autorange doc long_doc order json hidden/;
sub import {
my ( undef, @import ) = @_;
@@ -161,10 +161,13 @@ sub _validate_and_filter_options {
my (%options) = @_;
$options{doc} = $options{documentation} if !defined $options{doc};
$options{order} = 0 if !defined $options{order};
+ $options{autosplit} = ','
+ if !defined $options{autosplit} && $options{autorange};
if ( $options{json} ) {
delete $options{repeatable};
delete $options{autosplit};
+ delete $options{autorange};
delete $options{negativable};
$options{format} = 's';
}
@@ -197,7 +200,7 @@ MooX::Options - Explicit Options eXtension for Object Class
=head1 VERSION
-version 4.008
+version 4.016
=head1 DESCRIPTION
@@ -451,6 +454,30 @@ It will also handle quoted params with the autosplit.
myTool --testStr='a,b,"c,d",e,f' # testStr ("a", "b", "c,d", "e", "f")
+=head2 autorange
+
+For another repeatable option you can add the autorange feature with your specific parameters. This
+allows you to pass number ranges instead of passing each individual number.
+
+ option test => (is => 'ro', format => 'i@', default => sub {[]}, autorange => 1);
+
+ myTool --test=1 --test=2 # test = (1, 2)
+ myTool --test=1,2,3 # test = (1, 2, 3)
+ myTool --test=1,2,3..6 # test = (1, 2, 3, 4, 5, 6)
+
+It will also handle quoted params like C<autosplit>, and will not rangify them.
+
+ option testStr => (is => 'ro', format => 's@', default => sub {[]}, autorange => 1);
+
+ myTool --testStr='1,2,"3,a,4",5' # testStr (1, 2, "3,a,4", 5)
+
+C<autosplit> will be set to ',' if undefined. You may set C<autosplit> to a different delimiter than ','
+for your group separation, but the range operator '..' cannot be changed.
+
+ option testStr => (is => 'ro', format => 's@', default => sub {[]}, autorange => 1, autosplit => '-');
+
+ myTool --testStr='1-2-3-5..7' # testStr (1, 2, 3, 5, 6, 7)
+
=head2 short
Long option can also have short version or aliased.
@@ -480,6 +507,16 @@ By default all options have an order set to C<0>, and options are sorted by thei
option 'at_the_end' => (is => 'ro', order => 999);
+=head2 hidden
+
+Hide option from doc but still an option you can use on command line.
+
+ option 'debug' => (is => 'ro', doc => 'hidden');
+
+Or
+
+ option 'debug' => (is => 'ro', hidden => 1);
+
=head1 ADDITIONAL MANUALS
=over
@@ -1,7 +0,0 @@
-perltidy version 20130922 log file on a darwin system, OLD_PERL_VERSION=5.018001
-Configuration and command line parameters for this run:
--html -pre
-To find error messages search for 'WARNING' with your editor
-Line 1 implies starting-indentation-level = 0
-Suggest including 'use warnings;'
-Suggest including 'use strict;'
@@ -2,15 +2,21 @@ use 5.006;
use strict;
use warnings;
-# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.039
+# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051
-use Test::More tests => 4 + ( $ENV{AUTHOR_TESTING} ? 1 : 0 );
+use Test::More;
+
+plan tests => 4 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
my @module_files = (
- 'MooX/Options.pm', 'MooX/Options/Descriptive.pm',
- 'MooX/Options/Descriptive/Usage.pm', 'MooX/Options/Role.pm'
+ 'MooX/Options.pm',
+ 'MooX/Options/Descriptive.pm',
+ 'MooX/Options/Descriptive/Usage.pm',
+ 'MooX/Options/Role.pm'
);
+
+
# no fake home requested
my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
@@ -22,23 +28,27 @@ use IO::Handle;
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my @warnings;
-for my $lib (@module_files) {
-
+for my $lib (@module_files)
+{
# see L<perlfaq8/How can I capture STDERR from an external command?>
my $stderr = IO::Handle->new;
- my $pid = open3( $stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e',
- "require q[$lib]" );
+ my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
my @_warnings = <$stderr>;
- waitpid( $pid, 0 );
- is( $?, 0, "$lib loaded ok" );
+ waitpid($pid, 0);
+ is($?, 0, "$lib loaded ok");
- if (@_warnings) {
+ if (@_warnings)
+ {
warn @_warnings;
push @warnings, @_warnings;
}
}
-is( scalar(@warnings), 0, 'no warnings found' ) if $ENV{AUTHOR_TESTING};
+
+
+is(scalar(@warnings), 0, 'no warnings found')
+ or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};
+
@@ -0,0 +1,42 @@
+#!perl
+#
+# This file is part of MooX-Options
+#
+# This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
+#
+# This is free software; you can redistribute it and/or modify it under
+# the same terms as the Perl 5 programming language system itself.
+#
+use strict;
+use warnings;
+use Test::More;
+use Test::Trap;
+
+{
+
+ package t;
+ use strict;
+ use warnings;
+ use Moo;
+ use MooX::Options;
+
+ option 'treq' => (
+ is => 'ro',
+ documentation => 'this is mandatory',
+ format => 's@',
+ required => 1,
+ autosplit => ",",
+ );
+
+ 1;
+}
+
+{
+ local @ARGV = ('--treq');
+ trap { my $opt = t->new_with_options(); };
+ like $trap->stderr, qr/treq is missing/, 'stdout ok';
+ unlike $trap->stderr, qr/Use of uninitialized/, 'stderr ok';
+}
+
+done_testing;
+
@@ -80,7 +80,7 @@ subtest "test required" => sub {
local @ARGV = ();
my @r = trap { r->new_with_options };
is( $trap->exit, 1, "missing args, exit 1" );
- ok( $trap->stdout =~ /^str_req is missing/, "str_reg is missing" );
+ ok( $trap->stderr =~ /^str_req is missing/, "str_reg is missing" );
}
{
local @ARGV = ('--str_req=ok');
@@ -91,7 +91,7 @@ subtest "test required" => sub {
local @ARGV = ();
my @r = trap { multi_req->new_with_options };
is( $trap->exit, 1, "missing args exit 1" );
- my @missing = $trap->stdout =~ /(multi_\d is missing)\n/g;
+ my @missing = $trap->stderr =~ /(multi_\d is missing)\n/g;
my @target_isa;
{ no strict 'refs'; @target_isa = @{"multi_req::ISA"} };
if (multi_req->isa('Moose::Object') || multi_req->isa('Mo::Object')) {
@@ -193,7 +193,7 @@ subtest "split_complexe_str_short" => sub {
my $t = sp_str_short->new_with_options();
is_deeply( $t->split_str, [qw/a/], 'str req is ok' );
}
- {
+ {
local @ARGV = ("-z=a,b,c");
my $t = sp_str_short->new_with_options();
is_deeply( $t->split_str, [qw/a b c/], 'str req is ok' );
@@ -241,12 +241,8 @@ subtest "split_str_shorter_name" => sub {
subtest "should_die_ok" => sub {
note "Test chain method";
- try {
- d->new_with_options( should_die_ok => 1 );
- }
- catch {
- ok( /this\s\will\sdie\sok/, 'should die ok' );
- };
+ trap { d->new_with_options( should_die_ok => 1 ) };
+ ok($trap->stderr =~ qr/this\s\will\sdie\sok/, 'should die ok' );
};
subtest "test usage" => sub {
@@ -350,8 +346,145 @@ subtest "json" => sub {
};
ok( $trap->stdout =~ /\-t: JSON/, "json help message properly set" ) or diag $trap->stdout;
}
+};
+subtest "range_complexe_str" => sub {
+ note "range on complexe str";
+ {
+ local @ARGV = ('--range_str=1,2,4');
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4/], 'str1 req is ok' );
+ }
+ {
+ local @ARGV = ('--range-str=1,2,4..');
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4/], 'str2 req is ok' );
+ }
+
+ {
+ local @ARGV = ('--range_str=1,2,4..6');
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4 5 6/], 'str3 req is ok' );
+ }
+ {
+ local @ARGV = ('--range-str=1,2,4..6');
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4 5 6/], 'str4 req is ok' );
+ }
+ {
+ local @ARGV = ('--range_str=1,2,4..');
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4/], 'str req5 is ok' );
+ }
+ {
+ local @ARGV = ('--range-str=1,2,4..');
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4/], 'str req6 is ok' );
+ }
+ {
+ local @ARGV = ("--range_str=1,2,4..7,10");
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4 5 6 7 10/], 'str7 req is ok' );
+ }
+ {
+ local @ARGV = ("--range-str=1,2,4..7,10");
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4 5 6 7 10/], 'str8 req is ok' );
+ }
+ {
+ local @ARGV = ('--range_str=1..3,10..12,20..');
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 3 10 11 12 20/], 'str9 req is ok' );
+ }
+ {
+ local @ARGV = ('--range-str=1..3,10..12,20..');
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 3 10 11 12 20/], 'str10 req is ok' );
+ }
+ {
+ local @ARGV = ('--range_str=1,"2,3",4,"foo bar"');
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [ 1, "2,3", 4, "foo bar" ], 'str11 req is ok' );
+ }
+ {
+ local @ARGV = ('--range-str=1,"2,3",4,"a,2,c"');
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [ 1, "2,3", 4, "a,2,c" ], 'str12 req is ok' );
+ }
+ done_testing();
+};
+subtest "range_complexe_str_short" => sub {
+ note "range on complexe str short";
+ {
+ local @ARGV = ("-r=1");
+ my $t = rg_str_short->new_with_options();
+ is_deeply( $t->range_str, [qw/1/], 'str1 req is ok' );
+ }
+ {
+ local @ARGV = ("-r=1,2,4");
+ my $t = rg_str_short->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4/], 'str2 req is ok' );
+ }
+ {
+ local @ARGV = ("-r=1..4");
+ my $t = rg_str_short->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 3 4/], 'str3 req is ok' );
+ }
+ {
+ local @ARGV = ('-r', "1..4");
+ my $t = rg_str_short->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 3 4/], 'str4 req is ok' );
+ }
+ {
+ local @ARGV = ("-r=1,2,4..7,10");
+ my $t = rg_str_short->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4 5 6 7 10/], 'str5 req is ok' );
+ }
+ {
+ local @ARGV = ('-r', '1..3,10..12,20..');
+ my $t = rg_str_short->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 3 10 11 12 20/], 'str6 req is ok' );
+ }
+ {
+ local @ARGV = ('-r=1,"2,3",4');
+ my $t = rg_str_short->new_with_options();
+ is_deeply( $t->range_str, [ '1', "2,3", '4' ], 'str7 req is ok' );
+ }
+ {
+ local @ARGV = ('-r','1,"2,3",4..7');
+ my $t = rg_str_short->new_with_options();
+ is_deeply( $t->range_str, [ 1, "2,3", 4, 5, 6, 7 ], 'str8 req is ok' );
+ }
+ done_testing();
+};
+
+subtest "range_str_shorter_name" => sub {
+ note "shorter long range";
+ {
+ local @ARGV = ("--range_st=1,2,4..6");
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4 5 6/], 'str1 req is ok' );
+ }
+ {
+ local @ARGV = ("--range-st=1,2,4..6,7");
+ my $t = rg_str->new_with_options();
+ is_deeply( $t->range_str, [qw/1 2 4 5 6 7/], 'str2 req is ok' );
+ }
+ note "shorter long range with conflict";
+ {
+ local @ARGV = ("--range_co=1,2,3");
+ trap {
+ rg_str->new_with_options();
+ };
+ ok $trap->stderr =~ qr/Option\srange_co\sis\sambiguous/, 'conflict detected';
+ local @ARGV = ("--range-co=1,2,3");
+ trap {
+ rg_str->new_with_options();
+ };
+ ok $trap->stderr =~ qr/Option\srange_co\sis\sambiguous/, 'conflict detected';
+ }
+ done_testing();
};
1;
@@ -0,0 +1,42 @@
+#!perl
+#
+# This file is part of MooX-Options
+#
+# This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
+#
+# This is free software; you can redistribute it and/or modify it under
+# the same terms as the Perl 5 programming language system itself.
+#
+use strict;
+use warnings;
+use Test::More;
+use Test::Trap;
+use Carp;
+use FindBin qw/$RealBin/;
+use Try::Tiny;
+
+local $ENV{TEST_FORCE_COLUMN_SIZE} = 78;
+
+{
+
+ package t;
+ use Moo;
+ use MooX::Options;
+
+ option 't' => (
+ is => 'ro',
+ documentation => 'this is a test with utf8 : ça marche héhé !',
+ );
+
+ 1;
+}
+
+{
+ my $opt = t->new_with_options;
+ trap { $opt->options_usage };
+ ok $trap->stdout
+ =~ /\s+\-t:\n\s+this\sis\sa\stest\swith\sutf8\s:\sça\smarche\shéhé\s\!/x,
+ 'documentation work';
+}
+
+done_testing;
@@ -0,0 +1,43 @@
+#!perl
+#
+# This file is part of MooX-Options
+#
+# This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
+#
+# This is free software; you can redistribute it and/or modify it under
+# the same terms as the Perl 5 programming language system itself.
+#
+use strict;
+use warnings;
+use Test::More;
+use Test::Trap;
+
+{
+
+ package t;
+ use Moo;
+ use MooX::Options;
+
+ option 'visible_option' => ( is => 'ro', doc => 'visible' );
+ option 'hidden_option_by_doc' =>
+ ( is => 'ro', format => 's', doc => 'hidden' );
+ option 'hidden_option' =>
+ ( is => 'ro', format => 's', hidden => 1, doc => 'not visible' );
+ 1;
+}
+
+trap { local @ARGV = qw(--help); t->new_with_options };
+
+unlike $trap->stdout, qr/hidden_option_by_doc:/, 'hidden by doc';
+unlike $trap->stdout, qr/hidden_option:/, 'hidden by option';
+like $trap->stdout, qr/visible_option:/, 'visible option';
+
+{
+ local @ARGV = qw(--hidden_option_by_doc=test1 --hidden_option=test2);
+ my $o = t->new_with_options;
+
+ is $o->hidden_option_by_doc, 'test1', 'hidden by doc exists';
+ is $o->hidden_option, 'test2', 'hidden by option exists';
+}
+
+done_testing;
@@ -0,0 +1,41 @@
+#!perl
+#
+# This file is part of MooX-Options
+#
+# This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
+#
+# This is free software; you can redistribute it and/or modify it under
+# the same terms as the Perl 5 programming language system itself.
+#
+use strict;
+use warnings;
+use Test::More;
+use Test::Trap;
+
+{
+
+ package t;
+ use strict;
+ use warnings;
+ use Moo;
+ use MooX::Options;
+
+ option 'hero' => (
+ is => 'ro',
+ doc => 'this is mandatory',
+ format => 's@',
+ isa => sub { die "boop\n" },
+ );
+
+ 1;
+}
+
+{
+ local @ARGV = (qw/--hero batman/);
+ trap { my $opt = t->new_with_options(); };
+ like $trap->stderr, qr/^boop/, 'stdout ok';
+ like $trap->stderr, qr/USAGE/, 'stderr ok';
+}
+
+done_testing;
+
@@ -36,6 +36,7 @@ BEGIN {
option 'empty' => ( is => 'ro', negativable => 1 );
option 'split' => ( is => 'ro', format => 'i@', autosplit => ',' );
option 'has_default' => ( is => 'ro', default => sub {'foo'} );
+ option 'range' => ( is => 'ro', format => 'i@', autorange => 1 );
1;
}
@@ -271,6 +272,54 @@ BEGIN {
1;
}
+{
+
+ package rg_strRole;
+ use Moo::Role;
+ use Mo;
+ use MooX::Options;
+
+ option 'range_str' => ( is => 'ro', format => 's', autorange => 1 );
+ option 'range_conflict_str1' =>
+ ( is => 'ro', format => 's', autorange => 1 );
+ option 'range_conflict_str2' =>
+ ( is => 'ro', format => 's', autorange => 1 );
+
+ 1;
+}
+
+{
+
+ package rg_str;
+ use Mo;
+ use Role::Tiny::With;
+ with 'rg_strRole';
+
+ 1;
+}
+
+{
+
+ package rg_str_shortRole;
+ use Moo::Role;
+ use Mo;
+ use MooX::Options;
+
+ option 'range_str' =>
+ ( is => 'ro', format => 's', autorange => 1, short => 'r' );
+
+ 1;
+}
+{
+
+ package rg_str_short;
+ use Mo;
+ use Role::Tiny::With;
+ with 'rg_str_shortRole';
+
+ 1;
+}
+
subtest "Mo" => sub {
note "Test Mo";
require $RealBin . '/base.st';
@@ -27,6 +27,7 @@ use Try::Tiny;
option 'empty' => ( is => 'ro', negativable => 1 );
option 'split' => ( is => 'ro', format => 'i@', autosplit => ',' );
option 'has_default' => ( is => 'ro', default => sub {'foo'} );
+ option 'range' => ( is => 'ro', format => 'i@', autorange => 1 );
1;
}
@@ -148,6 +149,33 @@ use Try::Tiny;
1;
}
+{
+
+ package rg_str;
+ use Moo;
+ use MooX::Options;
+
+ option 'range_str' => ( is => 'ro', format => 's', autorange => 1 );
+ option 'range_conflict_str1' =>
+ ( is => 'ro', format => 's', autorange => 1 );
+ option 'range_conflict_str2' =>
+ ( is => 'ro', format => 's', autorange => 1 );
+
+ 1;
+}
+
+{
+
+ package rg_str_short;
+ use Moo;
+ use MooX::Options;
+
+ option 'range_str' =>
+ ( is => 'ro', format => 's', autorange => 1, short => 'r' );
+
+ 1;
+}
+
subtest "Moo" => sub {
note "Test Moo";
require $RealBin . '/base.st';
@@ -35,6 +35,7 @@ BEGIN {
option 'empty' => ( is => 'ro', negativable => 1 );
option 'split' => ( is => 'ro', format => 'i@', autosplit => ',' );
option 'has_default' => ( is => 'ro', default => sub {'foo'} );
+ option 'range' => ( is => 'ro', format => 'i@', autorange => 1 );
1;
}
@@ -157,6 +158,33 @@ BEGIN {
1;
}
+{
+
+ package rg_str;
+ use Moose;
+ use MooX::Options;
+
+ option 'range_str' => ( is => 'ro', format => 's', autorange => 1 );
+ option 'range_conflict_str1' =>
+ ( is => 'ro', format => 's', autorange => 1 );
+ option 'range_conflict_str2' =>
+ ( is => 'ro', format => 's', autorange => 1 );
+
+ 1;
+}
+
+{
+
+ package rg_str_short;
+ use Moose;
+ use MooX::Options;
+
+ option 'range_str' =>
+ ( is => 'ro', format => 's', autorange => 1, short => 'r' );
+
+ 1;
+}
+
subtest "Moose" => sub {
note "Test Moose";
require $RealBin . '/base.st';
@@ -1,18 +0,0 @@
-#!/usr/bin/env perl
-#
-# This file is part of MooX-Options
-#
-# This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
-#
-# This is free software; you can redistribute it and/or modify it under
-# the same terms as the Perl 5 programming language system itself.
-#
-
-use strict;
-use warnings;
-use Test::More;
-
-plan skip_all =>
- "Sorry, but I don't support Mouse anymore, the module doesn't work like any others and is fully incompatible with the new way I have wrote MooX::Options. If you really need it, help me to solve this.";
-
-done_testing;
@@ -0,0 +1,40 @@
+#!perl
+#
+# This file is part of MooX-Options
+#
+# This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
+#
+# This is free software; you can redistribute it and/or modify it under
+# the same terms as the Perl 5 programming language system itself.
+#
+use Test::More;
+
+{
+
+ package TestOptOfOpt;
+ use Moo;
+ use MooX::Options;
+
+ option 'opt' => ( is => 'ro', format => 's' );
+ 1;
+}
+
+local @ARGV = ( '--opt', '--opt -y -my-options' );
+my $opt = TestOptOfOpt->new_with_options;
+
+is $opt->opt, '--opt -y -my-options',
+ 'option of option is not changed for separated args';
+
+local @ARGV = ('--opt=--opt -y -my-options');
+my $opt2 = TestOptOfOpt->new_with_options;
+
+is $opt2->opt, '--opt -y -my-options',
+ 'option of option is not changed for glued args';
+
+local @ARGV = ('--op=--opt -y -my-options');
+my $opt3 = TestOptOfOpt->new_with_options;
+
+is $opt3->opt, '--opt -y -my-options',
+ 'option of option is not changed for shortened args';
+
+done_testing;
@@ -16,14 +16,9 @@ BEGIN {
}
}
-use Test::More;
+# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
-eval "use Test::Pod::Coverage 1.08";
-plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage"
- if $@;
-
-eval "use Pod::Coverage::TrustPod";
-plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage"
- if $@;
+use Test::Pod::Coverage 1.08;
+use Pod::Coverage::TrustPod;
all_pod_coverage_ok( { coverage_class => 'Pod::Coverage::TrustPod' } );
@@ -16,9 +16,15 @@ BEGIN {
}
}
-use Test::More;
+use Test::More 0.96 tests => 1;
+eval { require Test::Vars };
-eval "use Test::Vars";
-plan skip_all => "Test::Vars required for testing unused vars"
- if $@;
-all_vars_ok();
+SKIP: {
+ skip 1 => 'Test::Vars required for testing for unused vars'
+ if $@;
+ Test::Vars->import;
+
+ subtest 'unused vars' => sub {
+ all_vars_ok();
+ };
+}
@@ -0,0 +1,27 @@
+#!perl
+#
+# This file is part of MooX-Options
+#
+# This software is copyright (c) 2013 by celogeek <me@celogeek.com>.
+#
+# This is free software; you can redistribute it and/or modify it under
+# the same terms as the Perl 5 programming language system itself.
+#
+use strict;
+use warnings;
+use Test::More;
+
+package Foo;
+use Moo;
+use MooX::Options;
+option start_from => ( is => "ro", format => "s" );
+
+package main;
+local @ARGV = qw/--start_from 0/;
+my $f = Foo->new_with_options;
+my $n = $f->start_from;
+is $n, 0, 'option with value 0 works';
+$n++;
+is $n, 1, 'and can be increment';
+
+done_testing;