From 88abb04852de47aca611e31b837977a5f2c12480 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Sat, 21 Apr 2018 15:21:05 +0200 Subject: [PATCH 01/20] the release-testing branch no longer exists --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bd1b07157..a4a6a3318 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ perl: - "5.16" - "5.14" before_install: - - git clone git://github.com/rjbs/travis-perl-helpers -b release-testing ~/travis-perl-helpers + - git clone git://github.com/travis-perl/helpers ~/travis-perl-helpers - source ~/travis-perl-helpers/init - build-perl - perl -V From 1ef6b8fca27244dacca23c1708cc1ca10a3a7614 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 21 Apr 2018 18:59:18 +0200 Subject: [PATCH 02/20] use v5.20.0 and Dist::Zilla::Dialect Dist::Zilla::Dialect is a multi-import pragma to set up v5.20 and the features used by Dist::Zilla code code: the good stuff from v5.20 and thereabouts. --- dist.ini | 2 +- lib/Dist/Zilla.pm | 2 ++ lib/Dist/Zilla/App.pm | 2 ++ lib/Dist/Zilla/App/Command.pm | 2 ++ lib/Dist/Zilla/App/Command/add.pm | 3 +++ lib/Dist/Zilla/App/Command/authordeps.pm | 2 ++ lib/Dist/Zilla/App/Command/build.pm | 2 ++ lib/Dist/Zilla/App/Command/clean.pm | 2 ++ lib/Dist/Zilla/App/Command/install.pm | 2 ++ lib/Dist/Zilla/App/Command/listdeps.pm | 2 ++ lib/Dist/Zilla/App/Command/new.pm | 2 ++ lib/Dist/Zilla/App/Command/nop.pm | 2 ++ lib/Dist/Zilla/App/Command/release.pm | 2 ++ lib/Dist/Zilla/App/Command/run.pm | 2 ++ lib/Dist/Zilla/App/Command/setup.pm | 2 ++ lib/Dist/Zilla/App/Command/smoke.pm | 2 ++ lib/Dist/Zilla/App/Command/test.pm | 2 ++ lib/Dist/Zilla/App/Command/version.pm | 2 ++ lib/Dist/Zilla/App/Tester.pm | 2 ++ lib/Dist/Zilla/Chrome/Term.pm | 2 ++ lib/Dist/Zilla/Chrome/Test.pm | 2 ++ lib/Dist/Zilla/Dialect.pm | 12 ++++++++++++ lib/Dist/Zilla/Dist/Builder.pm | 2 ++ lib/Dist/Zilla/Dist/Minter.pm | 2 ++ lib/Dist/Zilla/File/FromCode.pm | 2 ++ lib/Dist/Zilla/File/InMemory.pm | 2 ++ lib/Dist/Zilla/File/OnDisk.pm | 2 ++ lib/Dist/Zilla/MVP/Assembler.pm | 2 ++ lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm | 2 ++ lib/Dist/Zilla/MVP/Assembler/Zilla.pm | 2 ++ lib/Dist/Zilla/MVP/Reader/Finder.pm | 2 ++ lib/Dist/Zilla/MVP/Reader/Perl.pm | 2 ++ lib/Dist/Zilla/MVP/RootSection.pm | 2 ++ lib/Dist/Zilla/MVP/Section.pm | 2 ++ lib/Dist/Zilla/MintingProfile/Default.pm | 2 ++ lib/Dist/Zilla/Path.pm | 2 ++ lib/Dist/Zilla/Plugin/AutoPrereqs.pm | 2 ++ lib/Dist/Zilla/Plugin/AutoVersion.pm | 2 ++ lib/Dist/Zilla/Plugin/CPANFile.pm | 2 ++ lib/Dist/Zilla/Plugin/ConfirmRelease.pm | 2 ++ lib/Dist/Zilla/Plugin/DistINI.pm | 2 ++ lib/Dist/Zilla/Plugin/Encoding.pm | 2 ++ lib/Dist/Zilla/Plugin/ExecDir.pm | 2 ++ lib/Dist/Zilla/Plugin/ExtraTests.pm | 2 ++ lib/Dist/Zilla/Plugin/FakeRelease.pm | 2 ++ lib/Dist/Zilla/Plugin/FileFinder/ByName.pm | 2 ++ lib/Dist/Zilla/Plugin/FileFinder/Filter.pm | 2 ++ lib/Dist/Zilla/Plugin/FinderCode.pm | 2 ++ lib/Dist/Zilla/Plugin/GatherDir.pm | 2 ++ lib/Dist/Zilla/Plugin/GatherDir/Template.pm | 2 ++ lib/Dist/Zilla/Plugin/GatherFile.pm | 2 ++ lib/Dist/Zilla/Plugin/GenerateFile.pm | 2 ++ lib/Dist/Zilla/Plugin/InlineFiles.pm | 2 ++ lib/Dist/Zilla/Plugin/License.pm | 2 ++ lib/Dist/Zilla/Plugin/MakeMaker.pm | 2 ++ lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm | 2 ++ lib/Dist/Zilla/Plugin/Manifest.pm | 2 ++ lib/Dist/Zilla/Plugin/ManifestSkip.pm | 2 ++ lib/Dist/Zilla/Plugin/MetaConfig.pm | 2 ++ lib/Dist/Zilla/Plugin/MetaJSON.pm | 5 ++++- lib/Dist/Zilla/Plugin/MetaNoIndex.pm | 2 ++ lib/Dist/Zilla/Plugin/MetaResources.pm | 2 ++ lib/Dist/Zilla/Plugin/MetaTests.pm | 2 ++ lib/Dist/Zilla/Plugin/MetaYAML.pm | 2 ++ lib/Dist/Zilla/Plugin/ModuleBuild.pm | 2 ++ lib/Dist/Zilla/Plugin/ModuleShareDirs.pm | 2 ++ lib/Dist/Zilla/Plugin/NextRelease.pm | 6 ++++-- lib/Dist/Zilla/Plugin/PkgDist.pm | 2 ++ lib/Dist/Zilla/Plugin/PkgVersion.pm | 2 ++ lib/Dist/Zilla/Plugin/PodCoverageTests.pm | 2 ++ lib/Dist/Zilla/Plugin/PodSyntaxTests.pm | 2 ++ lib/Dist/Zilla/Plugin/PodVersion.pm | 2 ++ lib/Dist/Zilla/Plugin/Prereqs.pm | 2 ++ lib/Dist/Zilla/Plugin/PruneCruft.pm | 2 ++ lib/Dist/Zilla/Plugin/PruneFiles.pm | 2 ++ lib/Dist/Zilla/Plugin/Readme.pm | 2 ++ lib/Dist/Zilla/Plugin/RemovePrereqs.pm | 2 ++ lib/Dist/Zilla/Plugin/ShareDir.pm | 2 ++ lib/Dist/Zilla/Plugin/TemplateModule.pm | 2 ++ lib/Dist/Zilla/Plugin/TestRelease.pm | 2 ++ lib/Dist/Zilla/Plugin/UploadToCPAN.pm | 2 ++ lib/Dist/Zilla/PluginBundle/Basic.pm | 2 ++ lib/Dist/Zilla/PluginBundle/Classic.pm | 2 ++ lib/Dist/Zilla/PluginBundle/FakeClassic.pm | 2 ++ lib/Dist/Zilla/PluginBundle/Filter.pm | 2 ++ lib/Dist/Zilla/Prereqs.pm | 3 +++ lib/Dist/Zilla/Role/AfterBuild.pm | 2 ++ lib/Dist/Zilla/Role/AfterMint.pm | 2 ++ lib/Dist/Zilla/Role/BeforeArchive.pm | 2 ++ lib/Dist/Zilla/Role/BeforeBuild.pm | 2 ++ lib/Dist/Zilla/Role/BeforeMint.pm | 2 ++ lib/Dist/Zilla/Role/BeforeRelease.pm | 2 ++ lib/Dist/Zilla/Role/BuildPL.pm | 3 ++- lib/Dist/Zilla/Role/ExecFiles.pm | 2 ++ lib/Dist/Zilla/Role/File.pm | 2 ++ lib/Dist/Zilla/Role/FileFinder.pm | 2 ++ lib/Dist/Zilla/Role/FileFinderUser.pm | 2 ++ lib/Dist/Zilla/Role/FileGatherer.pm | 2 ++ lib/Dist/Zilla/Role/FileInjector.pm | 2 ++ lib/Dist/Zilla/Role/FileMunger.pm | 2 ++ lib/Dist/Zilla/Role/FilePruner.pm | 2 ++ lib/Dist/Zilla/Role/InstallTool.pm | 2 ++ lib/Dist/Zilla/Role/LicenseProvider.pm | 2 ++ lib/Dist/Zilla/Role/MetaProvider.pm | 2 ++ lib/Dist/Zilla/Role/MintingProfile.pm | 2 ++ lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm | 2 ++ lib/Dist/Zilla/Role/ModuleMaker.pm | 2 ++ lib/Dist/Zilla/Role/MutableFile.pm | 5 ++++- lib/Dist/Zilla/Role/PPI.pm | 5 ++++- lib/Dist/Zilla/Role/Plugin.pm | 6 ++++-- lib/Dist/Zilla/Role/PluginBundle.pm | 2 ++ lib/Dist/Zilla/Role/PluginBundle/Easy.pm | 2 ++ lib/Dist/Zilla/Role/PrereqScanner.pm | 2 ++ lib/Dist/Zilla/Role/PrereqSource.pm | 2 ++ lib/Dist/Zilla/Role/ReleaseStatusProvider.pm | 2 ++ lib/Dist/Zilla/Role/Releaser.pm | 2 ++ lib/Dist/Zilla/Role/ShareDir.pm | 2 ++ lib/Dist/Zilla/Role/Stash.pm | 2 ++ lib/Dist/Zilla/Role/TestRunner.pm | 2 ++ lib/Dist/Zilla/Role/TextTemplate.pm | 2 ++ lib/Dist/Zilla/Stash/Mint.pm | 2 ++ lib/Dist/Zilla/Stash/PAUSE.pm | 2 ++ lib/Dist/Zilla/Stash/Rights.pm | 2 ++ lib/Dist/Zilla/Stash/User.pm | 2 ++ lib/Dist/Zilla/Tester.pm | 2 ++ lib/Dist/Zilla/Types.pm | 2 ++ lib/Dist/Zilla/Util.pm | 2 ++ lib/Dist/Zilla/Util/AuthorDeps.pm | 3 ++- lib/Test/DZil.pm | 2 ++ 129 files changed, 279 insertions(+), 10 deletions(-) create mode 100644 lib/Dist/Zilla/Dialect.pm diff --git a/dist.ini b/dist.ini index ff3fe04b0..b6377e956 100644 --- a/dist.ini +++ b/dist.ini @@ -32,7 +32,7 @@ Data::OptList = 0.110 PPI::XS = 0 [Prereqs] -perl = v5.14.0 ; how tempted am I to set this to v5.20? very! +perl = v5.20.0 ; how tempted am I to set this to v5.24? somewhat! parent = 0 ; used by the AutoPrereq test corpus diff --git a/lib/Dist/Zilla.pm b/lib/Dist/Zilla.pm index e07cc8767..c0d82b0db 100644 --- a/lib/Dist/Zilla.pm +++ b/lib/Dist/Zilla.pm @@ -4,6 +4,8 @@ package Dist::Zilla; use Moose 0.92; # role composition fixes with 'Dist::Zilla::Role::ConfigDumper'; +use Dist::Zilla::Dialect; + # This comment has fün̈n̈ÿ characters. use MooseX::Types::Moose qw(ArrayRef Bool HashRef Object Str); diff --git a/lib/Dist/Zilla/App.pm b/lib/Dist/Zilla/App.pm index 0ebe969f6..5c79c8204 100644 --- a/lib/Dist/Zilla/App.pm +++ b/lib/Dist/Zilla/App.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App; use App::Cmd::Setup 0.330 -app; # better compilation error detection +use Dist::Zilla::Dialect; + use Carp (); use Try::Tiny; diff --git a/lib/Dist/Zilla/App/Command.pm b/lib/Dist/Zilla/App/Command.pm index 7523ce0d8..d0c98d2d9 100644 --- a/lib/Dist/Zilla/App/Command.pm +++ b/lib/Dist/Zilla/App/Command.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command; use App::Cmd::Setup -command; +use Dist::Zilla::Dialect; + =method zilla This returns the Dist::Zilla object in use by the command. If none has yet diff --git a/lib/Dist/Zilla/App/Command/add.pm b/lib/Dist/Zilla/App/Command/add.pm index 3607385ec..961dab798 100644 --- a/lib/Dist/Zilla/App/Command/add.pm +++ b/lib/Dist/Zilla/App/Command/add.pm @@ -4,6 +4,9 @@ package Dist::Zilla::App::Command::add; # ABSTRACT: add a module to a dist use Dist::Zilla::App -command; + +use Dist::Zilla::Dialect; + use Dist::Zilla::Path; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/App/Command/authordeps.pm b/lib/Dist/Zilla/App/Command/authordeps.pm index e730b0682..2c156b6c0 100644 --- a/lib/Dist/Zilla/App/Command/authordeps.pm +++ b/lib/Dist/Zilla/App/Command/authordeps.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::authordeps; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS $ dzil authordeps diff --git a/lib/Dist/Zilla/App/Command/build.pm b/lib/Dist/Zilla/App/Command/build.pm index 5feaa4c5d..a6a03eff4 100644 --- a/lib/Dist/Zilla/App/Command/build.pm +++ b/lib/Dist/Zilla/App/Command/build.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::build; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS dzil build [ --trial ] [ --tgz | --no-tgz ] [ --in /path/to/build/dir ] diff --git a/lib/Dist/Zilla/App/Command/clean.pm b/lib/Dist/Zilla/App/Command/clean.pm index dc48278e6..2e8ccabc1 100644 --- a/lib/Dist/Zilla/App/Command/clean.pm +++ b/lib/Dist/Zilla/App/Command/clean.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::clean; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS dzil clean [ --dry-run|-n ] diff --git a/lib/Dist/Zilla/App/Command/install.pm b/lib/Dist/Zilla/App/Command/install.pm index c746b05f5..55214ab93 100644 --- a/lib/Dist/Zilla/App/Command/install.pm +++ b/lib/Dist/Zilla/App/Command/install.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::install; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS Installs your distribution using a specified command. diff --git a/lib/Dist/Zilla/App/Command/listdeps.pm b/lib/Dist/Zilla/App/Command/listdeps.pm index 336f30d50..b3bf549e8 100644 --- a/lib/Dist/Zilla/App/Command/listdeps.pm +++ b/lib/Dist/Zilla/App/Command/listdeps.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::listdeps; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS $ dzil listdeps | cpan diff --git a/lib/Dist/Zilla/App/Command/new.pm b/lib/Dist/Zilla/App/Command/new.pm index c841607fb..4fad5eede 100644 --- a/lib/Dist/Zilla/App/Command/new.pm +++ b/lib/Dist/Zilla/App/Command/new.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::new; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS Creates a new Dist-Zilla based distribution under the current directory. diff --git a/lib/Dist/Zilla/App/Command/nop.pm b/lib/Dist/Zilla/App/Command/nop.pm index 06d5c16b7..388951719 100644 --- a/lib/Dist/Zilla/App/Command/nop.pm +++ b/lib/Dist/Zilla/App/Command/nop.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::nop; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS This command does nothing. It initializes Dist::Zilla, then exits. This is diff --git a/lib/Dist/Zilla/App/Command/release.pm b/lib/Dist/Zilla/App/Command/release.pm index 07a480bdb..41d2d1898 100644 --- a/lib/Dist/Zilla/App/Command/release.pm +++ b/lib/Dist/Zilla/App/Command/release.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::release; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS dzil release diff --git a/lib/Dist/Zilla/App/Command/run.pm b/lib/Dist/Zilla/App/Command/run.pm index e5044b9e6..9f1e2b697 100644 --- a/lib/Dist/Zilla/App/Command/run.pm +++ b/lib/Dist/Zilla/App/Command/run.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::run; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS $ dzil run ./bin/myscript diff --git a/lib/Dist/Zilla/App/Command/setup.pm b/lib/Dist/Zilla/App/Command/setup.pm index 2e0277ccb..a38b5cea0 100644 --- a/lib/Dist/Zilla/App/Command/setup.pm +++ b/lib/Dist/Zilla/App/Command/setup.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::setup; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS $ dzil setup diff --git a/lib/Dist/Zilla/App/Command/smoke.pm b/lib/Dist/Zilla/App/Command/smoke.pm index 2695e2396..aef308614 100644 --- a/lib/Dist/Zilla/App/Command/smoke.pm +++ b/lib/Dist/Zilla/App/Command/smoke.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::smoke; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS dzil smoke [ --release ] [ --author ] [ --no-automated ] diff --git a/lib/Dist/Zilla/App/Command/test.pm b/lib/Dist/Zilla/App/Command/test.pm index eb1e44c08..69a937c4d 100644 --- a/lib/Dist/Zilla/App/Command/test.pm +++ b/lib/Dist/Zilla/App/Command/test.pm @@ -5,6 +5,8 @@ package Dist::Zilla::App::Command::test; use Dist::Zilla::App -command; +use Dist::Zilla::Dialect; + =head1 SYNOPSIS dzil test [ --release ] [ --no-author ] [ --automated ] [ --extended ] [ --all ] diff --git a/lib/Dist/Zilla/App/Command/version.pm b/lib/Dist/Zilla/App/Command/version.pm index 7e8d75918..522ac78a7 100644 --- a/lib/Dist/Zilla/App/Command/version.pm +++ b/lib/Dist/Zilla/App/Command/version.pm @@ -11,6 +11,8 @@ BEGIN { unshift @ISA, 'App::Cmd::Command::version'; } +use Dist::Zilla::Dialect; + =head1 SYNOPSIS Print dzil version diff --git a/lib/Dist/Zilla/App/Tester.pm b/lib/Dist/Zilla/App/Tester.pm index b1138ff81..64b852fb5 100644 --- a/lib/Dist/Zilla/App/Tester.pm +++ b/lib/Dist/Zilla/App/Tester.pm @@ -6,6 +6,8 @@ package Dist::Zilla::App::Tester; use parent 'App::Cmd::Tester::CaptureExternal'; use App::Cmd::Tester 0.306 (); # result_class, ->app +use Dist::Zilla::Dialect; + use Dist::Zilla::App; use File::Copy::Recursive qw(dircopy); use File::pushd (); diff --git a/lib/Dist/Zilla/Chrome/Term.pm b/lib/Dist/Zilla/Chrome/Term.pm index b18200ae9..ba484b34c 100644 --- a/lib/Dist/Zilla/Chrome/Term.pm +++ b/lib/Dist/Zilla/Chrome/Term.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Chrome::Term; use Moose; +use Dist::Zilla::Dialect; + =head1 OVERVIEW This class provides a L implementation for use in a diff --git a/lib/Dist/Zilla/Chrome/Test.pm b/lib/Dist/Zilla/Chrome/Test.pm index c47011f84..9e4bf439e 100644 --- a/lib/Dist/Zilla/Chrome/Test.pm +++ b/lib/Dist/Zilla/Chrome/Test.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Chrome::Test; use Moose; +use Dist::Zilla::Dialect; + use MooseX::Types::Moose qw(ArrayRef HashRef Str); use Dist::Zilla::Types qw(OneZero); use Log::Dispatchouli 1.102220; diff --git a/lib/Dist/Zilla/Dialect.pm b/lib/Dist/Zilla/Dialect.pm new file mode 100644 index 000000000..61d7e42fa --- /dev/null +++ b/lib/Dist/Zilla/Dialect.pm @@ -0,0 +1,12 @@ +package Dist::Zilla::Dialect; + +use v5.20.0; +use warnings; +use experimental (); + +sub import { + feature->import(':5.20'); + experimental->import(qw(lexical_subs postderef signatures)); +} + +1; diff --git a/lib/Dist/Zilla/Dist/Builder.pm b/lib/Dist/Zilla/Dist/Builder.pm index d8340c99b..b59590587 100644 --- a/lib/Dist/Zilla/Dist/Builder.pm +++ b/lib/Dist/Zilla/Dist/Builder.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Dist::Builder; use Moose 0.92; # role composition fixes extends 'Dist::Zilla'; +use Dist::Zilla::Dialect; + use MooseX::Types::Moose qw(HashRef); use Dist::Zilla::Types qw(Path); diff --git a/lib/Dist/Zilla/Dist/Minter.pm b/lib/Dist/Zilla/Dist/Minter.pm index 346f93ad3..0d1536f19 100644 --- a/lib/Dist/Zilla/Dist/Minter.pm +++ b/lib/Dist/Zilla/Dist/Minter.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Dist::Minter; use Moose 0.92; # role composition fixes extends 'Dist::Zilla'; +use Dist::Zilla::Dialect; + use File::pushd (); use Dist::Zilla::Path; use Module::Runtime 'require_module'; diff --git a/lib/Dist/Zilla/File/FromCode.pm b/lib/Dist/Zilla/File/FromCode.pm index 4ba83f069..57a3385ed 100644 --- a/lib/Dist/Zilla/File/FromCode.pm +++ b/lib/Dist/Zilla/File/FromCode.pm @@ -1,6 +1,8 @@ package Dist::Zilla::File::FromCode; # ABSTRACT: a file whose content is (re-)built on demand +use Dist::Zilla::Dialect; + use Moose; use Moose::Util::TypeConstraints; diff --git a/lib/Dist/Zilla/File/InMemory.pm b/lib/Dist/Zilla/File/InMemory.pm index 6d98f4d18..ed500e618 100644 --- a/lib/Dist/Zilla/File/InMemory.pm +++ b/lib/Dist/Zilla/File/InMemory.pm @@ -1,6 +1,8 @@ package Dist::Zilla::File::InMemory; # ABSTRACT: a file that you build entirely in memory +use Dist::Zilla::Dialect; + use Moose; use namespace::autoclean; diff --git a/lib/Dist/Zilla/File/OnDisk.pm b/lib/Dist/Zilla/File/OnDisk.pm index ecd6fc0da..7feeffe96 100644 --- a/lib/Dist/Zilla/File/OnDisk.pm +++ b/lib/Dist/Zilla/File/OnDisk.pm @@ -1,6 +1,8 @@ package Dist::Zilla::File::OnDisk; # ABSTRACT: a file that comes from your filesystem +use Dist::Zilla::Dialect; + use Moose; use Dist::Zilla::Path; diff --git a/lib/Dist/Zilla/MVP/Assembler.pm b/lib/Dist/Zilla/MVP/Assembler.pm index b6f6594e1..279618972 100644 --- a/lib/Dist/Zilla/MVP/Assembler.pm +++ b/lib/Dist/Zilla/MVP/Assembler.pm @@ -5,6 +5,8 @@ use Moose; extends 'Config::MVP::Assembler'; with 'Config::MVP::Assembler::WithBundles' => { -version => '2.200010' }; +use Dist::Zilla::Dialect; + use namespace::autoclean; use Dist::Zilla::Util; diff --git a/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm b/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm index f0b88740d..a639c7587 100644 --- a/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm +++ b/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm @@ -4,6 +4,8 @@ package Dist::Zilla::MVP::Assembler::GlobalConfig; use Moose; extends 'Dist::Zilla::MVP::Assembler'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 OVERVIEW diff --git a/lib/Dist/Zilla/MVP/Assembler/Zilla.pm b/lib/Dist/Zilla/MVP/Assembler/Zilla.pm index 11bf12b9b..75c46d5c7 100644 --- a/lib/Dist/Zilla/MVP/Assembler/Zilla.pm +++ b/lib/Dist/Zilla/MVP/Assembler/Zilla.pm @@ -4,6 +4,8 @@ package Dist::Zilla::MVP::Assembler::Zilla; use Moose; extends 'Dist::Zilla::MVP::Assembler'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 OVERVIEW diff --git a/lib/Dist/Zilla/MVP/Reader/Finder.pm b/lib/Dist/Zilla/MVP/Reader/Finder.pm index 348c6c92d..c20c34cad 100644 --- a/lib/Dist/Zilla/MVP/Reader/Finder.pm +++ b/lib/Dist/Zilla/MVP/Reader/Finder.pm @@ -5,6 +5,8 @@ use Moose; use Config::MVP::Reader 2.101540; # if_none extends 'Config::MVP::Reader::Finder'; +use Dist::Zilla::Dialect; + use namespace::autoclean; use Dist::Zilla::MVP::Assembler; diff --git a/lib/Dist/Zilla/MVP/Reader/Perl.pm b/lib/Dist/Zilla/MVP/Reader/Perl.pm index a0fe3c5ae..c1374b046 100644 --- a/lib/Dist/Zilla/MVP/Reader/Perl.pm +++ b/lib/Dist/Zilla/MVP/Reader/Perl.pm @@ -5,6 +5,8 @@ use Moose; extends 'Config::MVP::Reader'; with qw(Config::MVP::Reader::Findable::ByExtension); +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/MVP/RootSection.pm b/lib/Dist/Zilla/MVP/RootSection.pm index be7b404ed..5ea7c109a 100644 --- a/lib/Dist/Zilla/MVP/RootSection.pm +++ b/lib/Dist/Zilla/MVP/RootSection.pm @@ -4,6 +4,8 @@ package Dist::Zilla::MVP::RootSection; use Moose; extends 'Config::MVP::Section'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/MVP/Section.pm b/lib/Dist/Zilla/MVP/Section.pm index 0ad988eff..b9806964a 100644 --- a/lib/Dist/Zilla/MVP/Section.pm +++ b/lib/Dist/Zilla/MVP/Section.pm @@ -4,6 +4,8 @@ package Dist::Zilla::MVP::Section; use Moose; extends 'Config::MVP::Section'; +use Dist::Zilla::Dialect; + use namespace::autoclean; use Config::MVP::Section 2.200009; # not-installed error with section_name diff --git a/lib/Dist/Zilla/MintingProfile/Default.pm b/lib/Dist/Zilla/MintingProfile/Default.pm index d9c68fa7d..6ba31bfd1 100644 --- a/lib/Dist/Zilla/MintingProfile/Default.pm +++ b/lib/Dist/Zilla/MintingProfile/Default.pm @@ -4,6 +4,8 @@ package Dist::Zilla::MintingProfile::Default; use Moose; with 'Dist::Zilla::Role::MintingProfile::ShareDir'; +use Dist::Zilla::Dialect; + use namespace::autoclean; use Dist::Zilla::Util; diff --git a/lib/Dist/Zilla/Path.pm b/lib/Dist/Zilla/Path.pm index fd976975a..872125fe4 100644 --- a/lib/Dist/Zilla/Path.pm +++ b/lib/Dist/Zilla/Path.pm @@ -7,6 +7,8 @@ package Dist::Zilla::Path; use parent 'Path::Tiny'; +use Dist::Zilla::Dialect; + use Path::Tiny 0.052 qw(); # issue 427 use Scalar::Util qw( blessed ); use Sub::Exporter -setup => { diff --git a/lib/Dist/Zilla/Plugin/AutoPrereqs.pm b/lib/Dist/Zilla/Plugin/AutoPrereqs.pm index 3f9570c1b..4a15fbadc 100644 --- a/lib/Dist/Zilla/Plugin/AutoPrereqs.pm +++ b/lib/Dist/Zilla/Plugin/AutoPrereqs.pm @@ -8,6 +8,8 @@ with( 'Dist::Zilla::Role::PPI', ); +use Dist::Zilla::Dialect; + use Moose::Util::TypeConstraints 'enum'; use namespace::autoclean; diff --git a/lib/Dist/Zilla/Plugin/AutoVersion.pm b/lib/Dist/Zilla/Plugin/AutoVersion.pm index d1a75936a..9ef7f12ea 100644 --- a/lib/Dist/Zilla/Plugin/AutoVersion.pm +++ b/lib/Dist/Zilla/Plugin/AutoVersion.pm @@ -7,6 +7,8 @@ with( 'Dist::Zilla::Role::TextTemplate', ); +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/CPANFile.pm b/lib/Dist/Zilla/Plugin/CPANFile.pm index 011fb28be..4b3aa559f 100644 --- a/lib/Dist/Zilla/Plugin/CPANFile.pm +++ b/lib/Dist/Zilla/Plugin/CPANFile.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::CPANFile; use Moose; with 'Dist::Zilla::Role::FileGatherer'; +use Dist::Zilla::Dialect; + use namespace::autoclean; use Dist::Zilla::File::FromCode; diff --git a/lib/Dist/Zilla/Plugin/ConfirmRelease.pm b/lib/Dist/Zilla/Plugin/ConfirmRelease.pm index 02d6929ad..90288855c 100644 --- a/lib/Dist/Zilla/Plugin/ConfirmRelease.pm +++ b/lib/Dist/Zilla/Plugin/ConfirmRelease.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::ConfirmRelease; use Moose; with 'Dist::Zilla::Role::BeforeRelease'; +use Dist::Zilla::Dialect; + use namespace::autoclean; sub before_release { diff --git a/lib/Dist/Zilla/Plugin/DistINI.pm b/lib/Dist/Zilla/Plugin/DistINI.pm index a369983ba..2f265d464 100644 --- a/lib/Dist/Zilla/Plugin/DistINI.pm +++ b/lib/Dist/Zilla/Plugin/DistINI.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::DistINI; use Moose; with qw(Dist::Zilla::Role::FileGatherer); +use Dist::Zilla::Dialect; + use Dist::Zilla::File::FromCode; use MooseX::Types::Moose qw(ArrayRef Str); diff --git a/lib/Dist/Zilla/Plugin/Encoding.pm b/lib/Dist/Zilla/Plugin/Encoding.pm index f2ec4db9f..c7642710a 100644 --- a/lib/Dist/Zilla/Plugin/Encoding.pm +++ b/lib/Dist/Zilla/Plugin/Encoding.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::Encoding; use Moose; with 'Dist::Zilla::Role::EncodingProvider'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/ExecDir.pm b/lib/Dist/Zilla/Plugin/ExecDir.pm index afd2c7039..b796281ba 100644 --- a/lib/Dist/Zilla/Plugin/ExecDir.pm +++ b/lib/Dist/Zilla/Plugin/ExecDir.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Plugin::ExecDir; use Moose; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/ExtraTests.pm b/lib/Dist/Zilla/Plugin/ExtraTests.pm index 329d6e5e5..d234b7648 100644 --- a/lib/Dist/Zilla/Plugin/ExtraTests.pm +++ b/lib/Dist/Zilla/Plugin/ExtraTests.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::ExtraTests; use Moose; with 'Dist::Zilla::Role::FileMunger'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/FakeRelease.pm b/lib/Dist/Zilla/Plugin/FakeRelease.pm index ada74e692..28904be01 100644 --- a/lib/Dist/Zilla/Plugin/FakeRelease.pm +++ b/lib/Dist/Zilla/Plugin/FakeRelease.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::FakeRelease; use Moose; with 'Dist::Zilla::Role::Releaser'; +use Dist::Zilla::Dialect; + use namespace::autoclean; has user => ( diff --git a/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm b/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm index 20ee6d060..72d8e9c64 100644 --- a/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm +++ b/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::FileFinder::ByName; use Moose; with 'Dist::Zilla::Role::FileFinder'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm b/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm index 89f01667f..5b69357ca 100644 --- a/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm +++ b/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm @@ -9,6 +9,8 @@ with( }, ); +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/FinderCode.pm b/lib/Dist/Zilla/Plugin/FinderCode.pm index fb14f0869..a2828b13e 100644 --- a/lib/Dist/Zilla/Plugin/FinderCode.pm +++ b/lib/Dist/Zilla/Plugin/FinderCode.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::FinderCode; use Moose; with 'Dist::Zilla::Role::FileFinder'; +use Dist::Zilla::Dialect; + use namespace::autoclean; use Moose::Util::TypeConstraints; diff --git a/lib/Dist/Zilla/Plugin/GatherDir.pm b/lib/Dist/Zilla/Plugin/GatherDir.pm index df70ea740..d98dac633 100644 --- a/lib/Dist/Zilla/Plugin/GatherDir.pm +++ b/lib/Dist/Zilla/Plugin/GatherDir.pm @@ -5,6 +5,8 @@ use Moose; use Dist::Zilla::Types qw(Path); with 'Dist::Zilla::Role::FileGatherer'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/GatherDir/Template.pm b/lib/Dist/Zilla/Plugin/GatherDir/Template.pm index db82a5e7d..9a4556eae 100644 --- a/lib/Dist/Zilla/Plugin/GatherDir/Template.pm +++ b/lib/Dist/Zilla/Plugin/GatherDir/Template.pm @@ -5,6 +5,8 @@ use Moose; extends 'Dist::Zilla::Plugin::GatherDir'; with 'Dist::Zilla::Role::TextTemplate'; +use Dist::Zilla::Dialect; + use namespace::autoclean; use autodie; diff --git a/lib/Dist/Zilla/Plugin/GatherFile.pm b/lib/Dist/Zilla/Plugin/GatherFile.pm index 6d0d7f80f..16f0e6731 100644 --- a/lib/Dist/Zilla/Plugin/GatherFile.pm +++ b/lib/Dist/Zilla/Plugin/GatherFile.pm @@ -5,6 +5,8 @@ use Moose; use Dist::Zilla::Types qw(Path ArrayRefOfPaths); with 'Dist::Zilla::Role::FileGatherer'; +use Dist::Zilla::Dialect; + use MooseX::Types::Moose 'ArrayRef'; use Path::Tiny; use Dist::Zilla::File::OnDisk; diff --git a/lib/Dist/Zilla/Plugin/GenerateFile.pm b/lib/Dist/Zilla/Plugin/GenerateFile.pm index 20b02ff78..15c1bee6b 100644 --- a/lib/Dist/Zilla/Plugin/GenerateFile.pm +++ b/lib/Dist/Zilla/Plugin/GenerateFile.pm @@ -7,6 +7,8 @@ with ( 'Dist::Zilla::Role::TextTemplate', ); +use Dist::Zilla::Dialect; + use namespace::autoclean; use Dist::Zilla::File::InMemory; diff --git a/lib/Dist/Zilla/Plugin/InlineFiles.pm b/lib/Dist/Zilla/Plugin/InlineFiles.pm index fb30818be..75bfb10ac 100644 --- a/lib/Dist/Zilla/Plugin/InlineFiles.pm +++ b/lib/Dist/Zilla/Plugin/InlineFiles.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::InlineFiles; use Moose; with 'Dist::Zilla::Role::FileGatherer'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/License.pm b/lib/Dist/Zilla/Plugin/License.pm index ac2f8cd73..f15233cd3 100644 --- a/lib/Dist/Zilla/Plugin/License.pm +++ b/lib/Dist/Zilla/Plugin/License.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::License; use Moose; with 'Dist::Zilla::Role::FileGatherer'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/MakeMaker.pm b/lib/Dist/Zilla/Plugin/MakeMaker.pm index 29e7b0f2b..51d380ec8 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Plugin::MakeMaker; use Moose; +use Dist::Zilla::Dialect; + use namespace::autoclean; use Config; diff --git a/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm b/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm index 6a23e57d9..e9e4272a4 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm @@ -7,6 +7,8 @@ with( 'Dist::Zilla::Role::TestRunner', ); +use Dist::Zilla::Dialect; + use namespace::autoclean; use Config; diff --git a/lib/Dist/Zilla/Plugin/Manifest.pm b/lib/Dist/Zilla/Plugin/Manifest.pm index 823d7884c..529930301 100644 --- a/lib/Dist/Zilla/Plugin/Manifest.pm +++ b/lib/Dist/Zilla/Plugin/Manifest.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::Manifest; use Moose; with 'Dist::Zilla::Role::FileGatherer'; +use Dist::Zilla::Dialect; + use namespace::autoclean; use Dist::Zilla::File::FromCode; diff --git a/lib/Dist/Zilla/Plugin/ManifestSkip.pm b/lib/Dist/Zilla/Plugin/ManifestSkip.pm index c295a7409..d2743c091 100644 --- a/lib/Dist/Zilla/Plugin/ManifestSkip.pm +++ b/lib/Dist/Zilla/Plugin/ManifestSkip.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::ManifestSkip; use Moose; with 'Dist::Zilla::Role::FilePruner'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/MetaConfig.pm b/lib/Dist/Zilla/Plugin/MetaConfig.pm index 1424209f3..1f56f0cf3 100644 --- a/lib/Dist/Zilla/Plugin/MetaConfig.pm +++ b/lib/Dist/Zilla/Plugin/MetaConfig.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::MetaConfig; use Moose; with 'Dist::Zilla::Role::MetaProvider'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/MetaJSON.pm b/lib/Dist/Zilla/Plugin/MetaJSON.pm index 6b2223dfe..426871418 100644 --- a/lib/Dist/Zilla/Plugin/MetaJSON.pm +++ b/lib/Dist/Zilla/Plugin/MetaJSON.pm @@ -3,10 +3,13 @@ package Dist::Zilla::Plugin::MetaJSON; use Moose; with 'Dist::Zilla::Role::FileGatherer'; -use Moose::Util::TypeConstraints; + +use Dist::Zilla::Dialect; use namespace::autoclean; +use Moose::Util::TypeConstraints; + =head1 DESCRIPTION This plugin will add a F file to the distribution. diff --git a/lib/Dist/Zilla/Plugin/MetaNoIndex.pm b/lib/Dist/Zilla/Plugin/MetaNoIndex.pm index 49bf721b1..9483fe713 100644 --- a/lib/Dist/Zilla/Plugin/MetaNoIndex.pm +++ b/lib/Dist/Zilla/Plugin/MetaNoIndex.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::MetaNoIndex; use Moose; with 'Dist::Zilla::Role::MetaProvider'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =encoding utf8 diff --git a/lib/Dist/Zilla/Plugin/MetaResources.pm b/lib/Dist/Zilla/Plugin/MetaResources.pm index 16f5c9f5d..101d0f5d1 100644 --- a/lib/Dist/Zilla/Plugin/MetaResources.pm +++ b/lib/Dist/Zilla/Plugin/MetaResources.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::MetaResources; use Moose; with 'Dist::Zilla::Role::MetaProvider'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/MetaTests.pm b/lib/Dist/Zilla/Plugin/MetaTests.pm index dc611c659..c23b80d96 100644 --- a/lib/Dist/Zilla/Plugin/MetaTests.pm +++ b/lib/Dist/Zilla/Plugin/MetaTests.pm @@ -5,6 +5,8 @@ use Moose; extends 'Dist::Zilla::Plugin::InlineFiles'; with 'Dist::Zilla::Role::PrereqSource'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/MetaYAML.pm b/lib/Dist/Zilla/Plugin/MetaYAML.pm index 4fdbc5a92..d4c05c6d8 100644 --- a/lib/Dist/Zilla/Plugin/MetaYAML.pm +++ b/lib/Dist/Zilla/Plugin/MetaYAML.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::MetaYAML; use Moose; with 'Dist::Zilla::Role::FileGatherer'; +use Dist::Zilla::Dialect; + use Try::Tiny; use namespace::autoclean; diff --git a/lib/Dist/Zilla/Plugin/ModuleBuild.pm b/lib/Dist/Zilla/Plugin/ModuleBuild.pm index 50347bc62..60496a12d 100644 --- a/lib/Dist/Zilla/Plugin/ModuleBuild.pm +++ b/lib/Dist/Zilla/Plugin/ModuleBuild.pm @@ -9,6 +9,8 @@ with ( 'Dist::Zilla::Role::TextTemplate', ); +use Dist::Zilla::Dialect; + use namespace::autoclean; use CPAN::Meta::Requirements 2.121; # requirements_for_module diff --git a/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm b/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm index 29684f07c..516e2ec4b 100644 --- a/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm +++ b/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Plugin::ModuleShareDirs; use Moose; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/NextRelease.pm b/lib/Dist/Zilla/Plugin/NextRelease.pm index 07c8b62b3..f7dd2bd4f 100644 --- a/lib/Dist/Zilla/Plugin/NextRelease.pm +++ b/lib/Dist/Zilla/Plugin/NextRelease.pm @@ -1,8 +1,6 @@ package Dist::Zilla::Plugin::NextRelease; # ABSTRACT: update the next release number in your changelog -use namespace::autoclean; - use Moose; with ( 'Dist::Zilla::Role::FileMunger', @@ -10,6 +8,10 @@ with ( 'Dist::Zilla::Role::AfterRelease', ); +use Dist::Zilla::Dialect; + +use namespace::autoclean; + use Dist::Zilla::Path; use Moose::Util::TypeConstraints; use List::Util 'first'; diff --git a/lib/Dist/Zilla/Plugin/PkgDist.pm b/lib/Dist/Zilla/Plugin/PkgDist.pm index bf397752f..9fe25062e 100644 --- a/lib/Dist/Zilla/Plugin/PkgDist.pm +++ b/lib/Dist/Zilla/Plugin/PkgDist.pm @@ -10,6 +10,8 @@ with( 'Dist::Zilla::Role::PPI', ); +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/PkgVersion.pm b/lib/Dist/Zilla/Plugin/PkgVersion.pm index 41c2a8afb..69b527755 100644 --- a/lib/Dist/Zilla/Plugin/PkgVersion.pm +++ b/lib/Dist/Zilla/Plugin/PkgVersion.pm @@ -10,6 +10,8 @@ with( 'Dist::Zilla::Role::PPI', ); +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/PodCoverageTests.pm b/lib/Dist/Zilla/Plugin/PodCoverageTests.pm index ca82ce60c..791eb9a63 100644 --- a/lib/Dist/Zilla/Plugin/PodCoverageTests.pm +++ b/lib/Dist/Zilla/Plugin/PodCoverageTests.pm @@ -5,6 +5,8 @@ use Moose; extends 'Dist::Zilla::Plugin::InlineFiles'; with 'Dist::Zilla::Role::PrereqSource'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm b/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm index 0b7c91d73..7be5c4ff6 100644 --- a/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm +++ b/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm @@ -5,6 +5,8 @@ use Moose; extends 'Dist::Zilla::Plugin::InlineFiles'; with 'Dist::Zilla::Role::PrereqSource'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/PodVersion.pm b/lib/Dist/Zilla/Plugin/PodVersion.pm index e87009c62..a138e62a1 100644 --- a/lib/Dist/Zilla/Plugin/PodVersion.pm +++ b/lib/Dist/Zilla/Plugin/PodVersion.pm @@ -9,6 +9,8 @@ with( }, ); +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/Prereqs.pm b/lib/Dist/Zilla/Plugin/Prereqs.pm index 7263d985a..e82d062cd 100644 --- a/lib/Dist/Zilla/Plugin/Prereqs.pm +++ b/lib/Dist/Zilla/Plugin/Prereqs.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::Prereqs; use Moose; with 'Dist::Zilla::Role::PrereqSource'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/PruneCruft.pm b/lib/Dist/Zilla/Plugin/PruneCruft.pm index 13aee3bbf..a2a05e364 100644 --- a/lib/Dist/Zilla/Plugin/PruneCruft.pm +++ b/lib/Dist/Zilla/Plugin/PruneCruft.pm @@ -5,6 +5,8 @@ use Moose; use Moose::Util::TypeConstraints; with 'Dist::Zilla::Role::FilePruner'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/PruneFiles.pm b/lib/Dist/Zilla/Plugin/PruneFiles.pm index 7d15752a9..334ef87d7 100644 --- a/lib/Dist/Zilla/Plugin/PruneFiles.pm +++ b/lib/Dist/Zilla/Plugin/PruneFiles.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::PruneFiles; use Moose; with 'Dist::Zilla::Role::FilePruner'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/Readme.pm b/lib/Dist/Zilla/Plugin/Readme.pm index 3d39ffeff..704e7dd82 100644 --- a/lib/Dist/Zilla/Plugin/Readme.pm +++ b/lib/Dist/Zilla/Plugin/Readme.pm @@ -6,6 +6,8 @@ with qw/Dist::Zilla::Role::FileGatherer Dist::Zilla::Role::TextTemplate Dist::Zilla::Role::FileMunger/; +use Dist::Zilla::Dialect; + use Moose::Util::TypeConstraints; use namespace::autoclean; diff --git a/lib/Dist/Zilla/Plugin/RemovePrereqs.pm b/lib/Dist/Zilla/Plugin/RemovePrereqs.pm index 8b05f2ad4..8761317d5 100644 --- a/lib/Dist/Zilla/Plugin/RemovePrereqs.pm +++ b/lib/Dist/Zilla/Plugin/RemovePrereqs.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::RemovePrereqs; use Moose; with 'Dist::Zilla::Role::PrereqSource'; +use Dist::Zilla::Dialect; + use namespace::autoclean; use MooseX::Types::Moose qw(ArrayRef); diff --git a/lib/Dist/Zilla/Plugin/ShareDir.pm b/lib/Dist/Zilla/Plugin/ShareDir.pm index c12d5abcd..ae42355b2 100644 --- a/lib/Dist/Zilla/Plugin/ShareDir.pm +++ b/lib/Dist/Zilla/Plugin/ShareDir.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Plugin::ShareDir; use Moose; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 SYNOPSIS diff --git a/lib/Dist/Zilla/Plugin/TemplateModule.pm b/lib/Dist/Zilla/Plugin/TemplateModule.pm index 6d0cf80fe..9d5eb4d32 100644 --- a/lib/Dist/Zilla/Plugin/TemplateModule.pm +++ b/lib/Dist/Zilla/Plugin/TemplateModule.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::TemplateModule; use Moose; with qw(Dist::Zilla::Role::ModuleMaker Dist::Zilla::Role::TextTemplate); +use Dist::Zilla::Dialect; + use Dist::Zilla::Path; use namespace::autoclean; diff --git a/lib/Dist/Zilla/Plugin/TestRelease.pm b/lib/Dist/Zilla/Plugin/TestRelease.pm index 5ca6ff656..954dc9bac 100644 --- a/lib/Dist/Zilla/Plugin/TestRelease.pm +++ b/lib/Dist/Zilla/Plugin/TestRelease.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::TestRelease; use Moose; with 'Dist::Zilla::Role::BeforeRelease'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Plugin/UploadToCPAN.pm b/lib/Dist/Zilla/Plugin/UploadToCPAN.pm index b07718724..5c81ea7d7 100644 --- a/lib/Dist/Zilla/Plugin/UploadToCPAN.pm +++ b/lib/Dist/Zilla/Plugin/UploadToCPAN.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::UploadToCPAN; use Moose; with qw(Dist::Zilla::Role::BeforeRelease Dist::Zilla::Role::Releaser); +use Dist::Zilla::Dialect; + use File::Spec; use Moose::Util::TypeConstraints; use Scalar::Util qw(weaken); diff --git a/lib/Dist/Zilla/PluginBundle/Basic.pm b/lib/Dist/Zilla/PluginBundle/Basic.pm index 096d4d8eb..079a7c6a9 100644 --- a/lib/Dist/Zilla/PluginBundle/Basic.pm +++ b/lib/Dist/Zilla/PluginBundle/Basic.pm @@ -4,6 +4,8 @@ package Dist::Zilla::PluginBundle::Basic; use Moose; with 'Dist::Zilla::Role::PluginBundle::Easy'; +use Dist::Zilla::Dialect; + use namespace::autoclean; sub configure { diff --git a/lib/Dist/Zilla/PluginBundle/Classic.pm b/lib/Dist/Zilla/PluginBundle/Classic.pm index 97e9e7543..3c81b82b2 100644 --- a/lib/Dist/Zilla/PluginBundle/Classic.pm +++ b/lib/Dist/Zilla/PluginBundle/Classic.pm @@ -4,6 +4,8 @@ package Dist::Zilla::PluginBundle::Classic; use Moose; with 'Dist::Zilla::Role::PluginBundle::Easy'; +use Dist::Zilla::Dialect; + use namespace::autoclean; sub configure { diff --git a/lib/Dist/Zilla/PluginBundle/FakeClassic.pm b/lib/Dist/Zilla/PluginBundle/FakeClassic.pm index 8d8ab1c61..205225f45 100644 --- a/lib/Dist/Zilla/PluginBundle/FakeClassic.pm +++ b/lib/Dist/Zilla/PluginBundle/FakeClassic.pm @@ -4,6 +4,8 @@ package Dist::Zilla::PluginBundle::FakeClassic; use Moose; extends 'Dist::Zilla::PluginBundle::Classic'; +use Dist::Zilla::Dialect; + use namespace::autoclean; around bundle_config => sub { diff --git a/lib/Dist/Zilla/PluginBundle/Filter.pm b/lib/Dist/Zilla/PluginBundle/Filter.pm index 6c6e8d59b..ca6d87a24 100644 --- a/lib/Dist/Zilla/PluginBundle/Filter.pm +++ b/lib/Dist/Zilla/PluginBundle/Filter.pm @@ -4,6 +4,8 @@ package Dist::Zilla::PluginBundle::Filter; use Moose; with 'Dist::Zilla::Role::PluginBundle'; +use Dist::Zilla::Dialect; + use namespace::autoclean; use List::Util 1.33 qw(any); diff --git a/lib/Dist/Zilla/Prereqs.pm b/lib/Dist/Zilla/Prereqs.pm index 80efd75e4..0523e1ddb 100644 --- a/lib/Dist/Zilla/Prereqs.pm +++ b/lib/Dist/Zilla/Prereqs.pm @@ -2,6 +2,9 @@ package Dist::Zilla::Prereqs; # ABSTRACT: the prerequisites of a Dist::Zilla distribution use Moose; + +use Dist::Zilla::Dialect; + use MooseX::Types::Moose qw(Bool HashRef); use CPAN::Meta::Prereqs 2.120630; # add_string_requirement diff --git a/lib/Dist/Zilla/Role/AfterBuild.pm b/lib/Dist/Zilla/Role/AfterBuild.pm index 9be779a51..3c19d0f9f 100644 --- a/lib/Dist/Zilla/Role/AfterBuild.pm +++ b/lib/Dist/Zilla/Role/AfterBuild.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::AfterBuild; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/AfterMint.pm b/lib/Dist/Zilla/Role/AfterMint.pm index 7cca7eb62..111e37ebf 100644 --- a/lib/Dist/Zilla/Role/AfterMint.pm +++ b/lib/Dist/Zilla/Role/AfterMint.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::AfterMint; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/BeforeArchive.pm b/lib/Dist/Zilla/Role/BeforeArchive.pm index 80856efd4..8005d4858 100644 --- a/lib/Dist/Zilla/Role/BeforeArchive.pm +++ b/lib/Dist/Zilla/Role/BeforeArchive.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::BeforeArchive; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/BeforeBuild.pm b/lib/Dist/Zilla/Role/BeforeBuild.pm index f86dc8903..89066b243 100644 --- a/lib/Dist/Zilla/Role/BeforeBuild.pm +++ b/lib/Dist/Zilla/Role/BeforeBuild.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::BeforeBuild; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/BeforeMint.pm b/lib/Dist/Zilla/Role/BeforeMint.pm index 87c9b1ca7..580299739 100644 --- a/lib/Dist/Zilla/Role/BeforeMint.pm +++ b/lib/Dist/Zilla/Role/BeforeMint.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::BeforeMint; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/BeforeRelease.pm b/lib/Dist/Zilla/Role/BeforeRelease.pm index 0098cd808..78f69c243 100644 --- a/lib/Dist/Zilla/Role/BeforeRelease.pm +++ b/lib/Dist/Zilla/Role/BeforeRelease.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::BeforeRelease; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/BuildPL.pm b/lib/Dist/Zilla/Role/BuildPL.pm index c7ea2cac5..64056fbcc 100644 --- a/lib/Dist/Zilla/Role/BuildPL.pm +++ b/lib/Dist/Zilla/Role/BuildPL.pm @@ -2,13 +2,14 @@ package Dist::Zilla::Role::BuildPL; # ABSTRACT: Common ground for Build.PL based builders use Moose::Role; - with qw( Dist::Zilla::Role::InstallTool Dist::Zilla::Role::BuildRunner Dist::Zilla::Role::TestRunner ); +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/ExecFiles.pm b/lib/Dist/Zilla/Role/ExecFiles.pm index 957c5bca6..f37451d65 100644 --- a/lib/Dist/Zilla/Role/ExecFiles.pm +++ b/lib/Dist/Zilla/Role/ExecFiles.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::ExecFiles; use Moose::Role; with 'Dist::Zilla::Role::FileFinder'; +use Dist::Zilla::Dialect; + use namespace::autoclean; requires 'dir'; diff --git a/lib/Dist/Zilla/Role/File.pm b/lib/Dist/Zilla/Role/File.pm index 6ea9d7175..6e0eaebfc 100644 --- a/lib/Dist/Zilla/Role/File.pm +++ b/lib/Dist/Zilla/Role/File.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Role::File; use Moose::Role; +use Dist::Zilla::Dialect; + use Dist::Zilla::Types qw(_Filename); use Moose::Util::TypeConstraints; use Try::Tiny; diff --git a/lib/Dist/Zilla/Role/FileFinder.pm b/lib/Dist/Zilla/Role/FileFinder.pm index c21857169..4263652f4 100644 --- a/lib/Dist/Zilla/Role/FileFinder.pm +++ b/lib/Dist/Zilla/Role/FileFinder.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::FileFinder; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/FileFinderUser.pm b/lib/Dist/Zilla/Role/FileFinderUser.pm index 214b97f99..3aca01b2c 100644 --- a/lib/Dist/Zilla/Role/FileFinderUser.pm +++ b/lib/Dist/Zilla/Role/FileFinderUser.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Role::FileFinderUser; use MooseX::Role::Parameterized 1.01; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/FileGatherer.pm b/lib/Dist/Zilla/Role/FileGatherer.pm index 79187fd03..8a9ec3fbe 100644 --- a/lib/Dist/Zilla/Role/FileGatherer.pm +++ b/lib/Dist/Zilla/Role/FileGatherer.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::FileGatherer; use Moose::Role; with qw/Dist::Zilla::Role::Plugin Dist::Zilla::Role::FileInjector/; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/FileInjector.pm b/lib/Dist/Zilla/Role/FileInjector.pm index 276008204..73077bc81 100644 --- a/lib/Dist/Zilla/Role/FileInjector.pm +++ b/lib/Dist/Zilla/Role/FileInjector.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Role::FileInjector; use Moose::Role; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/FileMunger.pm b/lib/Dist/Zilla/Role/FileMunger.pm index 17c0a0c10..f99c32ede 100644 --- a/lib/Dist/Zilla/Role/FileMunger.pm +++ b/lib/Dist/Zilla/Role/FileMunger.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::FileMunger; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/FilePruner.pm b/lib/Dist/Zilla/Role/FilePruner.pm index 48823eefe..cde97c8f7 100644 --- a/lib/Dist/Zilla/Role/FilePruner.pm +++ b/lib/Dist/Zilla/Role/FilePruner.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::FilePruner; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/InstallTool.pm b/lib/Dist/Zilla/Role/InstallTool.pm index cfe41e34f..d4bfe5244 100644 --- a/lib/Dist/Zilla/Role/InstallTool.pm +++ b/lib/Dist/Zilla/Role/InstallTool.pm @@ -7,6 +7,8 @@ with qw( Dist::Zilla::Role::FileInjector ); +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/LicenseProvider.pm b/lib/Dist/Zilla/Role/LicenseProvider.pm index 854c7212e..99ab456ed 100644 --- a/lib/Dist/Zilla/Role/LicenseProvider.pm +++ b/lib/Dist/Zilla/Role/LicenseProvider.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::LicenseProvider; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + =head1 DESCRIPTION Plugins implementing this role must provide a C method that diff --git a/lib/Dist/Zilla/Role/MetaProvider.pm b/lib/Dist/Zilla/Role/MetaProvider.pm index 08dd78f85..2c05e007d 100644 --- a/lib/Dist/Zilla/Role/MetaProvider.pm +++ b/lib/Dist/Zilla/Role/MetaProvider.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::MetaProvider; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/MintingProfile.pm b/lib/Dist/Zilla/Role/MintingProfile.pm index 1e827e534..e964c1e93 100644 --- a/lib/Dist/Zilla/Role/MintingProfile.pm +++ b/lib/Dist/Zilla/Role/MintingProfile.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Role::MintingProfile; use Moose::Role; +use Dist::Zilla::Dialect; + use namespace::autoclean; use Dist::Zilla::Path; diff --git a/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm b/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm index a2f33e4d9..ba217702e 100644 --- a/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm +++ b/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::MintingProfile::ShareDir; use Moose::Role; with 'Dist::Zilla::Role::MintingProfile'; +use Dist::Zilla::Dialect; + use namespace::autoclean; use File::ShareDir; diff --git a/lib/Dist/Zilla/Role/ModuleMaker.pm b/lib/Dist/Zilla/Role/ModuleMaker.pm index 343c297fb..60884e3a2 100644 --- a/lib/Dist/Zilla/Role/ModuleMaker.pm +++ b/lib/Dist/Zilla/Role/ModuleMaker.pm @@ -7,6 +7,8 @@ with qw( Dist::Zilla::Role::FileInjector ); +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/MutableFile.pm b/lib/Dist/Zilla/Role/MutableFile.pm index 97389e596..7ddad2efc 100644 --- a/lib/Dist/Zilla/Role/MutableFile.pm +++ b/lib/Dist/Zilla/Role/MutableFile.pm @@ -3,9 +3,12 @@ package Dist::Zilla::Role::MutableFile; use Moose::Role; +use Dist::Zilla::Dialect; + +use namespace::autoclean; + use Moose::Util::TypeConstraints; use MooseX::SetOnce; -use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/PPI.pm b/lib/Dist/Zilla/Role/PPI.pm index 369b3b630..1baed1c61 100644 --- a/lib/Dist/Zilla/Role/PPI.pm +++ b/lib/Dist/Zilla/Role/PPI.pm @@ -1,9 +1,12 @@ package Dist::Zilla::Role::PPI; # ABSTRACT: a role for plugins which use PPI +use Dist::Zilla::Dialect; + +use namespace::autoclean; + use Moose::Role; use Digest::MD5 qw(md5); -use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/Plugin.pm b/lib/Dist/Zilla/Role/Plugin.pm index 44888d523..91c69591d 100644 --- a/lib/Dist/Zilla/Role/Plugin.pm +++ b/lib/Dist/Zilla/Role/Plugin.pm @@ -4,11 +4,13 @@ package Dist::Zilla::Role::Plugin; use Moose::Role; with 'Dist::Zilla::Role::ConfigDumper'; -use Params::Util qw(_HASHLIKE); -use Moose::Util::TypeConstraints 'class_type'; +use Dist::Zilla::Dialect; use namespace::autoclean; +use Params::Util qw(_HASHLIKE); +use Moose::Util::TypeConstraints 'class_type'; + =head1 DESCRIPTION The Plugin role should be applied to all plugin classes. It provides a few key diff --git a/lib/Dist/Zilla/Role/PluginBundle.pm b/lib/Dist/Zilla/Role/PluginBundle.pm index e8b4bd1b8..225abffeb 100644 --- a/lib/Dist/Zilla/Role/PluginBundle.pm +++ b/lib/Dist/Zilla/Role/PluginBundle.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Role::PluginBundle; use Moose::Role; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/PluginBundle/Easy.pm b/lib/Dist/Zilla/Role/PluginBundle/Easy.pm index a593bb8c4..14c936243 100644 --- a/lib/Dist/Zilla/Role/PluginBundle/Easy.pm +++ b/lib/Dist/Zilla/Role/PluginBundle/Easy.pm @@ -5,6 +5,8 @@ package Dist::Zilla::Role::PluginBundle::Easy; use Moose::Role; with 'Dist::Zilla::Role::PluginBundle'; +use Dist::Zilla::Dialect; + use Module::Runtime 'use_module'; use namespace::autoclean; diff --git a/lib/Dist/Zilla/Role/PrereqScanner.pm b/lib/Dist/Zilla/Role/PrereqScanner.pm index 382f10c31..cc38d6984 100644 --- a/lib/Dist/Zilla/Role/PrereqScanner.pm +++ b/lib/Dist/Zilla/Role/PrereqScanner.pm @@ -23,6 +23,8 @@ with( }, ); +use Dist::Zilla::Dialect; + use MooseX::Types; =attr finder diff --git a/lib/Dist/Zilla/Role/PrereqSource.pm b/lib/Dist/Zilla/Role/PrereqSource.pm index b41f4def7..cc4bbc861 100644 --- a/lib/Dist/Zilla/Role/PrereqSource.pm +++ b/lib/Dist/Zilla/Role/PrereqSource.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::PrereqSource; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/ReleaseStatusProvider.pm b/lib/Dist/Zilla/Role/ReleaseStatusProvider.pm index ffbca6e8a..a18cb0887 100644 --- a/lib/Dist/Zilla/Role/ReleaseStatusProvider.pm +++ b/lib/Dist/Zilla/Role/ReleaseStatusProvider.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::ReleaseStatusProvider; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/Releaser.pm b/lib/Dist/Zilla/Role/Releaser.pm index c7246b29d..629e83003 100644 --- a/lib/Dist/Zilla/Role/Releaser.pm +++ b/lib/Dist/Zilla/Role/Releaser.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::Releaser; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/ShareDir.pm b/lib/Dist/Zilla/Role/ShareDir.pm index 995203c1f..c8b9118a5 100644 --- a/lib/Dist/Zilla/Role/ShareDir.pm +++ b/lib/Dist/Zilla/Role/ShareDir.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::ShareDir; use Moose::Role; with 'Dist::Zilla::Role::FileFinder'; +use Dist::Zilla::Dialect; + use namespace::autoclean; # Must return a hashref with any of the keys 'dist' and 'module'. The 'dist' diff --git a/lib/Dist/Zilla/Role/Stash.pm b/lib/Dist/Zilla/Role/Stash.pm index 444984950..fd221cb63 100644 --- a/lib/Dist/Zilla/Role/Stash.pm +++ b/lib/Dist/Zilla/Role/Stash.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Role::Stash; use Moose::Role; +use Dist::Zilla::Dialect; + use namespace::autoclean; sub register_component { diff --git a/lib/Dist/Zilla/Role/TestRunner.pm b/lib/Dist/Zilla/Role/TestRunner.pm index 64c9061a8..9715e754e 100644 --- a/lib/Dist/Zilla/Role/TestRunner.pm +++ b/lib/Dist/Zilla/Role/TestRunner.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Role::TestRunner; use Moose::Role; with 'Dist::Zilla::Role::Plugin'; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Role/TextTemplate.pm b/lib/Dist/Zilla/Role/TextTemplate.pm index 2e535eaa6..13c99ff54 100644 --- a/lib/Dist/Zilla/Role/TextTemplate.pm +++ b/lib/Dist/Zilla/Role/TextTemplate.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Role::TextTemplate; use Moose::Role; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION diff --git a/lib/Dist/Zilla/Stash/Mint.pm b/lib/Dist/Zilla/Stash/Mint.pm index 466c2eea9..992ed98c0 100644 --- a/lib/Dist/Zilla/Stash/Mint.pm +++ b/lib/Dist/Zilla/Stash/Mint.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Stash::Mint; use Moose; with 'Dist::Zilla::Role::Stash'; +use Dist::Zilla::Dialect; + use namespace::autoclean; has provider => ( diff --git a/lib/Dist/Zilla/Stash/PAUSE.pm b/lib/Dist/Zilla/Stash/PAUSE.pm index 5849fe290..b10227cf7 100644 --- a/lib/Dist/Zilla/Stash/PAUSE.pm +++ b/lib/Dist/Zilla/Stash/PAUSE.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Stash::PAUSE; use Moose; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 OVERVIEW diff --git a/lib/Dist/Zilla/Stash/Rights.pm b/lib/Dist/Zilla/Stash/Rights.pm index 15d2f60b0..5ce8a0ef3 100644 --- a/lib/Dist/Zilla/Stash/Rights.pm +++ b/lib/Dist/Zilla/Stash/Rights.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Stash::Rights; use Moose; with 'Dist::Zilla::Role::Stash'; +use Dist::Zilla::Dialect; + use namespace::autoclean; has license_class => ( diff --git a/lib/Dist/Zilla/Stash/User.pm b/lib/Dist/Zilla/Stash/User.pm index 168331113..c0f227be0 100644 --- a/lib/Dist/Zilla/Stash/User.pm +++ b/lib/Dist/Zilla/Stash/User.pm @@ -3,6 +3,8 @@ package Dist::Zilla::Stash::User; use Moose; +use Dist::Zilla::Dialect; + use namespace::autoclean; has name => ( diff --git a/lib/Dist/Zilla/Tester.pm b/lib/Dist/Zilla/Tester.pm index d3f4c2b00..ee4a63cc0 100644 --- a/lib/Dist/Zilla/Tester.pm +++ b/lib/Dist/Zilla/Tester.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Tester; use Moose; extends 'Dist::Zilla::Dist::Builder'; +use Dist::Zilla::Dialect; + # XXX: Adding this autoclean causes problem. "Builder" and "Minter" do not # show in tests. I'm really not sure why. -- rjbs, 2011-08-19 # use namespace::autoclean; diff --git a/lib/Dist/Zilla/Types.pm b/lib/Dist/Zilla/Types.pm index 3b2d6bfcc..8dae57ee8 100644 --- a/lib/Dist/Zilla/Types.pm +++ b/lib/Dist/Zilla/Types.pm @@ -1,6 +1,8 @@ package Dist::Zilla::Types; # ABSTRACT: dzil-specific type library +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 OVERVIEW diff --git a/lib/Dist/Zilla/Util.pm b/lib/Dist/Zilla/Util.pm index c1bb08574..7f29f6e48 100644 --- a/lib/Dist/Zilla/Util.pm +++ b/lib/Dist/Zilla/Util.pm @@ -3,6 +3,8 @@ use warnings; package Dist::Zilla::Util; # ABSTRACT: random snippets of code that Dist::Zilla wants +use Dist::Zilla::Dialect; + use Carp (); use Encode (); diff --git a/lib/Dist/Zilla/Util/AuthorDeps.pm b/lib/Dist/Zilla/Util/AuthorDeps.pm index 359d6ed43..f6f0b0cde 100644 --- a/lib/Dist/Zilla/Util/AuthorDeps.pm +++ b/lib/Dist/Zilla/Util/AuthorDeps.pm @@ -3,11 +3,12 @@ use warnings; package Dist::Zilla::Util::AuthorDeps; # ABSTRACT: Utils for listing your distribution's author dependencies +use Dist::Zilla::Dialect; + use Dist::Zilla::Util; use Path::Tiny; use List::Util 1.45 (); - sub format_author_deps { my ($reqs, $versions) = @_; diff --git a/lib/Test/DZil.pm b/lib/Test/DZil.pm index 5d9a8e91f..16abf5ac5 100644 --- a/lib/Test/DZil.pm +++ b/lib/Test/DZil.pm @@ -3,6 +3,8 @@ use warnings; package Test::DZil; # ABSTRACT: tools for testing Dist::Zilla plugins +use Dist::Zilla::Dialect; + use Params::Util qw(_HASH0); use JSON::MaybeXS; use Scalar::Util qw(blessed); From e1e0fac2a06b1e8441af3a16ca3f2e05f01ddd3b Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 21 Apr 2018 18:59:34 +0200 Subject: [PATCH 03/20] in v7, we stop handling the v6 Path::Class compat stuff --- lib/Dist/Zilla/Path.pm | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/lib/Dist/Zilla/Path.pm b/lib/Dist/Zilla/Path.pm index 872125fe4..194a01e39 100644 --- a/lib/Dist/Zilla/Path.pm +++ b/lib/Dist/Zilla/Path.pm @@ -5,49 +5,12 @@ use utf8; package Dist::Zilla::Path; # ABSTRACT: a helper to get Path::Tiny objects -use parent 'Path::Tiny'; - use Dist::Zilla::Dialect; -use Path::Tiny 0.052 qw(); # issue 427 -use Scalar::Util qw( blessed ); +use Path::Tiny 0.052 qw( path ); # issue 427 use Sub::Exporter -setup => { exports => [ qw( path ) ], groups => { default => [ qw( path ) ] }, }; -sub path { - my ($thing, @rest) = @_; - - if (@rest == 0 && blessed $thing) { - return $thing if $thing->isa(__PACKAGE__); - - return bless(Path::Tiny::path("$thing"), __PACKAGE__) - if $thing->isa('Path::Class::Entity') || $thing->isa('Path::Tiny'); - } - - return bless(Path::Tiny::path($thing, @rest), __PACKAGE__); -} - -my %warned; - -sub file { - my ($self, @file) = @_; - - my ($package, $pmfile, $line) = caller; - unless ($warned{ $pmfile, $line }++) { - Carp::carp("->file called on a Dist::Zilla::Path object; this will cease to work in Dist::Zilla v7; downstream code should be updated to use Path::Tiny API, not Path::Class"); - } - - require Path::Class; - Path::Class::dir($self)->file(@file); -} - -sub subdir { - my ($self, @subdir) = @_; - Carp::carp("->subdir called on a Dist::Zilla::Path object; this will cease to work in Dist::Zilla v7; downstream code should be updated to use Path::Tiny API, not Path::Class"); - require Path::Class; - Path::Class::dir($self)->subdir(@subdir); -} - 1; From 741b4828991b1276be146382611a34b5e018631d Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 21 Apr 2018 19:26:09 +0200 Subject: [PATCH 04/20] methods that should not return refs: plugins_with, plugins --- lib/Dist/Zilla.pm | 67 +++++++++++++++++------- lib/Dist/Zilla/App.pm | 2 +- lib/Dist/Zilla/App/Command/listdeps.pm | 12 ++--- lib/Dist/Zilla/Dist/Builder.pm | 63 +++++++++++----------- lib/Dist/Zilla/Dist/Minter.pm | 15 +++--- lib/Dist/Zilla/Plugin/ConfirmRelease.pm | 2 +- lib/Dist/Zilla/Plugin/MetaConfig.pm | 2 +- lib/Dist/Zilla/Plugin/NextRelease.pm | 4 +- lib/Dist/Zilla/Role/Plugin.pm | 2 +- lib/Dist/Zilla/Role/PluginBundle/Easy.pm | 12 +++-- t/file.t | 3 +- 11 files changed, 109 insertions(+), 75 deletions(-) diff --git a/lib/Dist/Zilla.pm b/lib/Dist/Zilla.pm index c0d82b0db..9139c04b4 100644 --- a/lib/Dist/Zilla.pm +++ b/lib/Dist/Zilla.pm @@ -4,14 +4,14 @@ package Dist::Zilla; use Moose 0.92; # role composition fixes with 'Dist::Zilla::Role::ConfigDumper'; -use Dist::Zilla::Dialect; - # This comment has fün̈n̈ÿ characters. use MooseX::Types::Moose qw(ArrayRef Bool HashRef Object Str); use MooseX::Types::Perl qw(DistName LaxVersionStr); use Moose::Util::TypeConstraints; +use Dist::Zilla::Dialect; + use Dist::Zilla::Types qw(Path License ReleaseStatus); use Log::Dispatchouli 1.100712; # proxy_loggers, quiet_fatal @@ -91,7 +91,7 @@ sub _build_name { my ($self) = @_; my $name; - for my $plugin (@{ $self->plugins_with(-NameProvider) }) { + for my $plugin ($self->plugins_with(-NameProvider)) { next unless defined(my $this_name = $plugin->provide_name); $self->log_fatal('attempted to set name twice') if defined $name; @@ -109,7 +109,7 @@ sub _build_version { my $version = $self->_version_override; - for my $plugin (@{ $self->plugins_with(-VersionProvider) }) { + for my $plugin ($self->plugins_with(-VersionProvider)) { next unless defined(my $this_version = $plugin->provide_version); $self->log_fatal('attempted to set version twice') if defined $version; @@ -171,7 +171,7 @@ sub _build_release_status { # the version $status = 'testing' if $self->_override_is_trial; - for my $plugin (@{ $self->plugins_with(-ReleaseStatusProvider) }) { + for my $plugin ($self->plugins_with(-ReleaseStatusProvider)) { next unless defined(my $this_status = $plugin->provide_release_status); $self->log_fatal('attempted to set release status twice') @@ -337,7 +337,7 @@ sub _build_license { my $provided_license; - for my $plugin (@{ $self->plugins_with(-LicenseProvider) }) { + for my $plugin ($self->plugins_with(-LicenseProvider)) { my $this_license = $plugin->provide_license({ copyright_holder => $copyright_holder, copyright_year => $copyright_year, @@ -555,21 +555,39 @@ sub _build_is_trial { =attr plugins -This is an arrayref of plugins that have been plugged into this Dist::Zilla -object. - -Non-core code B alter this arrayref. Public access to this attribute -B in the future. +This is a list of plugins that have been plugged into this Dist::Zilla object. =cut has plugins => ( - is => 'ro', isa => 'ArrayRef[Dist::Zilla::Role::Plugin]', init_arg => undef, + traits => [ 'Array' ], + reader => '_plugins', default => sub { [ ] }, ); +sub _add_plugin ($self, $plugin) { + push $self->_plugins->@*, $plugin; + return; +} + +sub plugins ($self) { + state %warned; + + my $plugins = $self->_plugins; + + if (! wantarray) { + my ($package, $pmfile, $line) = caller; + Carp::carp('in v7, $zilla->plugins should only be called in list context; scalar context behavior will change in Dist::Zilla v8') + unless $warned{ $pmfile, $line }++; + + return $plugins; + } + + return @$plugins; +} + =attr distmeta This is a hashref containing the metadata about this distribution that will be @@ -593,7 +611,7 @@ sub _build_distmeta { my $meta_merge = CPAN::Meta::Merge->new(default_version => 2); my $meta = {}; - for (@{ $self->plugins_with(-MetaProvider) }) { + for ($self->plugins_with(-MetaProvider)) { $meta = $meta_merge->merge($meta, $_->metadata); } @@ -651,7 +669,7 @@ has prereqs => ( sub plugin_named { my ($self, $name) = @_; - my $plugin = first { $_->plugin_name eq $name } @{ $self->plugins }; + my $plugin = first { $_->plugin_name eq $name } $self->plugins; return $plugin if $plugin; return; @@ -659,11 +677,11 @@ sub plugin_named { =method plugins_with - my $roles = $zilla->plugins_with( -SomeRole ); + my @roles = $zilla->plugins_with( -SomeRole ); -This method returns an arrayref containing all the Dist::Zilla object's plugins -that perform the named role. If the given role name begins with a dash, the -dash is replaced with "Dist::Zilla::Role::" +This method returns a list of all the Dist::Zilla object's plugins that perform +the named role. If the given role name begins with a dash, the dash is +replaced with "Dist::Zilla::Role::" =cut @@ -671,9 +689,18 @@ sub plugins_with { my ($self, $role) = @_; $role =~ s/^-/Dist::Zilla::Role::/; - my $plugins = [ grep { $_->does($role) } @{ $self->plugins } ]; + my @plugins = grep { $_->does($role) } $self->plugins; + + state %warned; + if (! wantarray) { + my ($package, $pmfile, $line) = caller; + Carp::carp('in v7, $zilla->plugins_with should only be called in list context; scalar context behavior will change in Dist::Zilla v8') + unless $warned{ $pmfile, $line }++; + + return \@plugins; + } - return $plugins; + return @plugins; } =method find_files diff --git a/lib/Dist/Zilla/App.pm b/lib/Dist/Zilla/App.pm index 5c79c8204..1ee7ee8c6 100644 --- a/lib/Dist/Zilla/App.pm +++ b/lib/Dist/Zilla/App.pm @@ -151,7 +151,7 @@ sub zilla { VERBOSE_PLUGIN: for my $plugin_name (grep { ! m{\A[-_]\z} } @v_plugins) { my @plugins = grep { $_->plugin_name =~ /\b\Q$plugin_name\E\b/ } - @{ $zilla->plugins }; + $zilla->plugins; $zilla->log_fatal("can't find plugins matching $plugin_name to set debug") unless @plugins; diff --git a/lib/Dist/Zilla/App/Command/listdeps.pm b/lib/Dist/Zilla/App/Command/listdeps.pm index b3bf549e8..76fe44c23 100644 --- a/lib/Dist/Zilla/App/Command/listdeps.pm +++ b/lib/Dist/Zilla/App/Command/listdeps.pm @@ -85,12 +85,12 @@ sub opt_spec { sub prereqs { my ($self, $zilla) = @_; - $_->before_build for @{ $zilla->plugins_with(-BeforeBuild) }; - $_->gather_files for @{ $zilla->plugins_with(-FileGatherer) }; - $_->set_file_encodings for @{ $zilla->plugins_with(-EncodingProvider) }; - $_->prune_files for @{ $zilla->plugins_with(-FilePruner) }; - $_->munge_files for @{ $zilla->plugins_with(-FileMunger) }; - $_->register_prereqs for @{ $zilla->plugins_with(-PrereqSource) }; + $_->before_build for $zilla->plugins_with(-BeforeBuild); + $_->gather_files for $zilla->plugins_with(-FileGatherer); + $_->set_file_encodings for $zilla->plugins_with(-EncodingProvider); + $_->prune_files for $zilla->plugins_with(-FilePruner); + $_->munge_files for $zilla->plugins_with(-FileMunger); + $_->register_prereqs for $zilla->plugins_with(-PrereqSource); my $prereqs = $zilla->prereqs; } diff --git a/lib/Dist/Zilla/Dist/Builder.pm b/lib/Dist/Zilla/Dist/Builder.pm index b59590587..7536def0f 100644 --- a/lib/Dist/Zilla/Dist/Builder.pm +++ b/lib/Dist/Zilla/Dist/Builder.pm @@ -70,7 +70,7 @@ sub _setup_default_plugins { }, }); - push @{ $self->plugins }, $plugin; + $self->_add_plugin($plugin); } unless ($self->plugin_named(':IncModules')) { @@ -87,7 +87,7 @@ sub _setup_default_plugins { }, }); - push @{ $self->plugins }, $plugin; + $self->_add_plugin($plugin); } unless ($self->plugin_named(':TestFiles')) { @@ -99,7 +99,7 @@ sub _setup_default_plugins { code => sub { local $_ = $_->name; m{\At/} }, }); - push @{ $self->plugins }, $plugin; + $self->_add_plugin($plugin); } unless ($self->plugin_named(':ExtraTestFiles')) { @@ -111,7 +111,7 @@ sub _setup_default_plugins { code => sub { local $_ = $_->name; m{\Axt/} }, }); - push @{ $self->plugins }, $plugin; + $self->_add_plugin($plugin); } unless ($self->plugin_named(':ExecFiles')) { @@ -121,14 +121,14 @@ sub _setup_default_plugins { zilla => $self, style => 'list', code => sub { - my $plugins = $_[0]->zilla->plugins_with(-ExecFiles); - my @files = uniq map {; @{ $_->find_files } } @$plugins; + my @files = uniq map {; @{ $_->find_files } } + $_[0]->zilla->plugins_with(-ExecFiles); return \@files; }, }); - push @{ $self->plugins }, $plugin; + $self->_add_plugin($plugin); } unless ($self->plugin_named(':PerlExecFiles')) { @@ -147,7 +147,7 @@ sub _setup_default_plugins { }, }); - push @{ $self->plugins }, $plugin; + $self->_add_plugin($plugin); } unless ($self->plugin_named(':ShareFiles')) { @@ -174,7 +174,7 @@ sub _setup_default_plugins { }, }); - push @{ $self->plugins }, $plugin; + $self->_add_plugin($plugin); } unless ($self->plugin_named(':MainModule')) { @@ -191,7 +191,7 @@ sub _setup_default_plugins { }, }); - push @{ $self->plugins }, $plugin; + $self->_add_plugin($plugin); } unless ($self->plugin_named(':AllFiles')) { @@ -203,7 +203,7 @@ sub _setup_default_plugins { code => sub { return 1 }, }); - push @{ $self->plugins }, $plugin; + $self->_add_plugin($plugin); } unless ($self->plugin_named(':NoFiles')) { @@ -215,7 +215,7 @@ sub _setup_default_plugins { code => sub { [] }, }); - push @{ $self->plugins }, $plugin; + $self->_add_plugin($plugin); } } @@ -232,7 +232,7 @@ sub _build_share_dir_map { my $share_dir_map = {}; - for my $plugin (@{ $self->plugins_with(-ShareDir) }) { + for my $plugin ($self->plugins_with(-ShareDir)) { next unless my $sub_map = $plugin->share_dir_map; if ( $sub_map->{dist} ) { @@ -344,26 +344,26 @@ sub build_in { $self->log_fatal("attempted to build " . $self->name . " a second time") if $self->built_in; - $_->before_build for @{ $self->plugins_with(-BeforeBuild) }; + $_->before_build for $self->plugins_with(-BeforeBuild); $self->log("beginning to build " . $self->name); - $_->gather_files for @{ $self->plugins_with(-FileGatherer) }; - $_->set_file_encodings for @{ $self->plugins_with(-EncodingProvider) }; - $_->prune_files for @{ $self->plugins_with(-FilePruner) }; + $_->gather_files for $self->plugins_with(-FileGatherer); + $_->set_file_encodings for $self->plugins_with(-EncodingProvider); + $_->prune_files for $self->plugins_with(-FilePruner); $self->version; # instantiate this lazy attribute now that files are gathered - $_->munge_files for @{ $self->plugins_with(-FileMunger) }; + $_->munge_files for $self->plugins_with(-FileMunger); - $_->register_prereqs for @{ $self->plugins_with(-PrereqSource) }; + $_->register_prereqs for $self->plugins_with(-PrereqSource); $self->prereqs->finalize; # Barf if someone has already set up a prereqs entry? -- rjbs, 2010-04-13 $self->distmeta->{prereqs} = $self->prereqs->as_string_hash; - $_->setup_installer for @{ $self->plugins_with(-InstallTool) }; + $_->setup_installer for $self->plugins_with(-InstallTool); $self->_check_dupe_files; @@ -376,7 +376,7 @@ sub build_in { } $_->after_build({ build_root => $build_root }) - for @{ $self->plugins_with(-AfterBuild) }; + for $self->plugins_with(-AfterBuild); $self->built_in($build_root); } @@ -480,7 +480,7 @@ sub build_archive { my $basename = $self->dist_basename; my $basedir = path($basename); - $_->before_archive for @{ $self->plugins_with(-BeforeArchive) }; + $_->before_archive for $self->plugins_with(-BeforeArchive); my $method = eval { +require Archive::Tar::Wrapper; Archive::Tar::Wrapper->VERSION('0.15'); 1 } @@ -594,20 +594,20 @@ sub release { my $self = shift; Carp::croak("you can't release without any Releaser plugins") - unless my @releasers = @{ $self->plugins_with(-Releaser) }; + unless my @releasers = $self->plugins_with(-Releaser); $ENV{DZIL_RELEASING} = 1; my $tgz = $self->build_archive; # call all plugins implementing BeforeRelease role - $_->before_release($tgz) for @{ $self->plugins_with(-BeforeRelease) }; + $_->before_release($tgz) for $self->plugins_with(-BeforeRelease); # do the actual release - $_->release($tgz) for @releasers; + $_->release($tgz) for @releasers; # call all plugins implementing AfterRelease role - $_->after_release($tgz) for @{ $self->plugins_with(-AfterRelease) }; + $_->after_release($tgz) for $self->plugins_with(-AfterRelease); } =method clean @@ -749,7 +749,7 @@ sub test { my ($self, $arg) = @_; Carp::croak("you can't test without any TestRunner plugins") - unless my @testers = @{ $self->plugins_with(-TestRunner) }; + unless my @testers = $self->plugins_with(-TestRunner); my ($target, $latest) = $self->ensure_built_in_tmpdir; my $error = $self->run_tests_in($target, $arg); @@ -781,7 +781,7 @@ sub run_tests_in { my ($self, $target, $arg) = @_; Carp::croak("you can't test without any TestRunner plugins") - unless my @testers = @{ $self->plugins_with(-TestRunner) }; + unless my @testers = $self->plugins_with(-TestRunner); for my $tester (@testers) { my $wd = File::pushd::pushd($target); @@ -804,9 +804,10 @@ non-zero, the directory will be left in place. sub run_in_build { my ($self, $cmd, $arg) = @_; + my @runners = $self->plugins_with(-BuildRunner); + $self->log_fatal("you can't build without any BuildRunner plugins") - unless ($arg and exists $arg->{build} and ! $arg->{build}) - or @{ $self->plugins_with(-BuildRunner) }; + unless ($arg and exists $arg->{build} and ! $arg->{build}) or @runners; require "Config.pm"; # skip autoprereq @@ -855,7 +856,7 @@ sub _ensure_blib { my ($self) = @_; unless ( -d 'blib' ) { - my @builders = @{ $self->plugins_with( -BuildRunner ) }; + my @builders = $self->plugins_with( -BuildRunner ); $self->log_fatal("no BuildRunner plugins specified") unless @builders; $_->build for @builders; $self->log_fatal("no blib; failed to build properly?") unless -d 'blib'; diff --git a/lib/Dist/Zilla/Dist/Minter.pm b/lib/Dist/Zilla/Dist/Minter.pm index 0d1536f19..39b23e1a1 100644 --- a/lib/Dist/Zilla/Dist/Minter.pm +++ b/lib/Dist/Zilla/Dist/Minter.pm @@ -22,7 +22,7 @@ sub _setup_default_plugins { zilla => $self, }); - push @{ $self->plugins }, $plugin; + push @{ $self->_plugins }, $plugin; } } @@ -110,7 +110,7 @@ sub mint_dist { my $wd = File::pushd::pushd($self->root); - $_->before_mint for @{ $self->plugins_with(-BeforeMint) }; + $_->before_mint for $self->plugins_with(-BeforeMint); for my $module (@modules) { my $minter = $self->plugin_named( @@ -120,10 +120,10 @@ sub mint_dist { $minter->make_module({ name => $module->{name} }) } - $_->gather_files for @{ $self->plugins_with(-FileGatherer) }; - $_->set_file_encodings for @{ $self->plugins_with(-EncodingProvider) }; - $_->prune_files for @{ $self->plugins_with(-FilePruner) }; - $_->munge_files for @{ $self->plugins_with(-FileMunger) }; + $_->gather_files for $self->plugins_with(-FileGatherer); + $_->set_file_encodings for $self->plugins_with(-EncodingProvider); + $_->prune_files for $self->plugins_with(-FilePruner); + $_->munge_files for $self->plugins_with(-FileMunger); $self->_check_dupe_files; @@ -133,8 +133,7 @@ sub mint_dist { $self->_write_out_file($file, $dir); } - $_->after_mint({ mint_root => $dir }) - for @{ $self->plugins_with(-AfterMint) }; + $_->after_mint({ mint_root => $dir }) for $self->plugins_with(-AfterMint); $self->log("dist minted in ./$name"); } diff --git a/lib/Dist/Zilla/Plugin/ConfirmRelease.pm b/lib/Dist/Zilla/Plugin/ConfirmRelease.pm index 90288855c..9d66d06cf 100644 --- a/lib/Dist/Zilla/Plugin/ConfirmRelease.pm +++ b/lib/Dist/Zilla/Plugin/ConfirmRelease.pm @@ -13,7 +13,7 @@ sub before_release { my $releasers = join q{, }, map {; $_->plugin_name } - @{ $self->zilla->plugins_with(-Releaser) }; + $self->zilla->plugins_with(-Releaser); $self->log("*** Preparing to release $tgz with $releasers ***"); my $prompt = "Do you want to continue the release process?"; diff --git a/lib/Dist/Zilla/Plugin/MetaConfig.pm b/lib/Dist/Zilla/Plugin/MetaConfig.pm index 1f56f0cf3..d51cfd182 100644 --- a/lib/Dist/Zilla/Plugin/MetaConfig.pm +++ b/lib/Dist/Zilla/Plugin/MetaConfig.pm @@ -41,7 +41,7 @@ sub metadata { version => "$]", }; - for my $plugin (@{ $self->zilla->plugins }) { + for my $plugin ($self->zilla->plugins) { my $config = $plugin->dump_config; push @plugins, { diff --git a/lib/Dist/Zilla/Plugin/NextRelease.pm b/lib/Dist/Zilla/Plugin/NextRelease.pm index f7dd2bd4f..41e3f5df0 100644 --- a/lib/Dist/Zilla/Plugin/NextRelease.pm +++ b/lib/Dist/Zilla/Plugin/NextRelease.pm @@ -39,7 +39,9 @@ use String::Formatter 0.100680 stringf => { . ($_[0]->zilla->is_trial ? ($_[1] // '-TRIAL') : '') }, P => sub { - my $releaser = first { $_->can('cpanid') } @{ $_[0]->zilla->plugins_with('-Releaser') }; + my $releaser = first { $_->can('cpanid') } + $_[0]->zilla->plugins_with('-Releaser'); + $_[0]->log_fatal('releaser doesn\'t provide cpanid, but %P used') unless $releaser; $releaser->cpanid; }, diff --git a/lib/Dist/Zilla/Role/Plugin.pm b/lib/Dist/Zilla/Role/Plugin.pm index 91c69591d..4ac28b7fb 100644 --- a/lib/Dist/Zilla/Role/Plugin.pm +++ b/lib/Dist/Zilla/Role/Plugin.pm @@ -84,7 +84,7 @@ sub register_component { $self->log_debug([ 'online, %s v%s', $self->meta->name, $version ]); - push @{ $self->zilla->plugins }, $self; + push @{ $self->zilla->_plugins }, $self; return; } diff --git a/lib/Dist/Zilla/Role/PluginBundle/Easy.pm b/lib/Dist/Zilla/Role/PluginBundle/Easy.pm index 14c936243..1fdc11f0b 100644 --- a/lib/Dist/Zilla/Role/PluginBundle/Easy.pm +++ b/lib/Dist/Zilla/Role/PluginBundle/Easy.pm @@ -90,9 +90,13 @@ C and C methods. =cut has plugins => ( - is => 'ro', isa => ArrayRef, default => sub { [] }, + reader => '_plugins', + traits => [ 'Array' ], + handles => { + plugins => 'elements', + }, ); sub bundle_config { @@ -102,7 +106,7 @@ sub bundle_config { $self->configure; - return @{ $self->plugins }; + return $self->plugins; } =method add_plugins @@ -128,7 +132,7 @@ sub add_plugins { my ($self, @plugin_specs) = @_; my $prefix = $self->name . '/'; - my $plugins = $self->plugins; + my $plugins = $self->_plugins; foreach my $this_spec (@plugin_specs) { my $moniker; @@ -173,7 +177,7 @@ sub add_bundle { $bundle = "\@$bundle" unless $bundle =~ /^@/; - push @{ $self->plugins }, + push @{ $self->_plugins }, $package->bundle_config({ name => $self->name . '/' . $bundle, package => $package, diff --git a/t/file.t b/t/file.t index 5947903ef..d39376d75 100644 --- a/t/file.t +++ b/t/file.t @@ -40,7 +40,8 @@ my $tzil = Builder->from_config( { # this trickery is so the caller appears to be whatever called new_file() - my $gatherdir = first { $_->isa('Dist::Zilla::Plugin::GatherDir') } @{ $tzil->plugins }; + my $gatherdir = first { $_->isa('Dist::Zilla::Plugin::GatherDir') } + $tzil->plugins; my $add_file = $gatherdir->can('add_file'); my $i = 0; From dece0f524993e4f68e4406efca32a5daf589324d Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 21 Apr 2018 19:49:28 +0200 Subject: [PATCH 05/20] methods that should not return refs: authors --- lib/Dist/Zilla.pm | 29 +++++++++++++++++++++++----- lib/Dist/Zilla/Plugin/DistINI.pm | 2 +- lib/Dist/Zilla/Plugin/MakeMaker.pm | 2 +- lib/Dist/Zilla/Plugin/ModuleBuild.pm | 2 +- lib/Dist/Zilla/Stash/User.pm | 14 +++++++++++--- 5 files changed, 38 insertions(+), 11 deletions(-) diff --git a/lib/Dist/Zilla.pm b/lib/Dist/Zilla.pm index 9139c04b4..557691df7 100644 --- a/lib/Dist/Zilla.pm +++ b/lib/Dist/Zilla.pm @@ -446,6 +446,8 @@ has _copyright_year => ( =attr authors + my @authors = $zilla->authors; + This is an arrayref of author strings, like this: [ @@ -453,19 +455,20 @@ This is an arrayref of author strings, like this: 'X. Ample, Jr ', ] -This is likely to change at some point in the near future. +The method C returns a list of the authors. =cut has authors => ( - is => 'ro', isa => ArrayRef[Str], lazy => 1, - default => sub { + traits => [ 'Array' ], + reader => '_authors', + default => sub { my ($self) = @_; if (my $stash = $self->stash_named('%User')) { - return $stash->authors; + return [ $stash->authors ]; } my $author = try { $self->copyright_holder }; @@ -478,6 +481,22 @@ has authors => ( }, ); +sub authors ($self) { + state %warned; + + my $authors = $self->_authors; + + if (! wantarray) { + my ($package, $pmfile, $line) = caller; + Carp::carp('in v7, $zilla->authors should only be called in list context; scalar context behavior will change in Dist::Zilla v8') + unless $warned{ $pmfile, $line }++; + + return $authors; + } + + return @$authors; +} + =attr files This is an arrayref of objects implementing L that @@ -623,7 +642,7 @@ sub _build_distmeta { name => $self->name, version => $self->version, abstract => $self->abstract, - author => $self->authors, + author => [ $self->authors ], license => [ $self->license->meta2_name ], release_status => $self->release_status, diff --git a/lib/Dist/Zilla/Plugin/DistINI.pm b/lib/Dist/Zilla/Plugin/DistINI.pm index 2f265d464..cbe171154 100644 --- a/lib/Dist/Zilla/Plugin/DistINI.pm +++ b/lib/Dist/Zilla/Plugin/DistINI.pm @@ -86,7 +86,7 @@ sub gather_files { my $content = ''; $content .= sprintf "name = %s\n", $zilla->name; - $content .= sprintf "author = %s\n", $_ for @{ $zilla->authors }; + $content .= sprintf "author = %s\n", $_ for $zilla->authors; $content .= sprintf "license = %s\n", $license; $content .= sprintf "copyright_holder = %s\n", $zilla->copyright_holder; $content .= sprintf "copyright_year = %s\n", (localtime)[5] + 1900; diff --git a/lib/Dist/Zilla/Plugin/MakeMaker.pm b/lib/Dist/Zilla/Plugin/MakeMaker.pm index 51d380ec8..eadf6095e 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker.pm @@ -238,7 +238,7 @@ sub write_makefile_args { my %write_makefile_args = ( DISTNAME => $self->zilla->name, NAME => $name, - AUTHOR => join(q{, }, @{ $self->zilla->authors }), + AUTHOR => join(q{, }, $self->zilla->authors), ABSTRACT => $self->zilla->abstract, VERSION => $self->zilla->version, LICENSE => $self->zilla->license->meta_yml_name, diff --git a/lib/Dist/Zilla/Plugin/ModuleBuild.pm b/lib/Dist/Zilla/Plugin/ModuleBuild.pm index 60496a12d..99e8e91f7 100644 --- a/lib/Dist/Zilla/Plugin/ModuleBuild.pm +++ b/lib/Dist/Zilla/Plugin/ModuleBuild.pm @@ -169,7 +169,7 @@ sub module_build_args { dist_abstract => $self->zilla->abstract, dist_name => $self->zilla->name, dist_version => $self->zilla->version, - dist_author => [ @{ $self->zilla->authors } ], + dist_author => [ $self->zilla->authors ], @exe_files ? ( script_files => [ sort @exe_files ] ) : (), ( keys %{$self->zilla->_share_dir_map} ? (share_dir => $self->zilla->_share_dir_map) : ()), diff --git a/lib/Dist/Zilla/Stash/User.pm b/lib/Dist/Zilla/Stash/User.pm index c0f227be0..6d5f760ff 100644 --- a/lib/Dist/Zilla/Stash/User.pm +++ b/lib/Dist/Zilla/Stash/User.pm @@ -19,9 +19,17 @@ has email => ( required => 1, ); -sub authors { - my ($self) = @_; - return [ sprintf "%s <%s>", $self->name, $self->email ]; +sub authors ($self) { + my $string = sprintf "%s <%s>", $self->name, $self->email; + return $string if wantarray; + + state %warned; + + my ($package, $pmfile, $line) = caller; + Carp::carp('in v7, $zilla->authors should only be called in list context; scalar context behavior will change in Dist::Zilla v8') + unless $warned{ $pmfile, $line }++; + + return [ $string ]; } with 'Dist::Zilla::Role::Stash::Authors'; From 7e273a2e040da26c54c34076d07950167b266026 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 21 Apr 2018 20:39:55 +0200 Subject: [PATCH 06/20] better standardize dereference style --- lib/Dist/Zilla.pm | 22 ++++++++--------- lib/Dist/Zilla/App.pm | 6 ++--- lib/Dist/Zilla/App/Command/add.pm | 4 ++-- lib/Dist/Zilla/App/Tester.pm | 2 +- lib/Dist/Zilla/Dist/Builder.pm | 16 ++++++------- lib/Dist/Zilla/Dist/Minter.pm | 4 ++-- lib/Dist/Zilla/MVP/RootSection.pm | 2 +- lib/Dist/Zilla/MVP/Section.pm | 2 +- lib/Dist/Zilla/Plugin/DistINI.pm | 2 +- lib/Dist/Zilla/Plugin/Encoding.pm | 8 +++---- lib/Dist/Zilla/Plugin/FileFinder/ByName.pm | 4 ++-- lib/Dist/Zilla/Plugin/FileFinder/Filter.pm | 2 +- lib/Dist/Zilla/Plugin/FinderCode.pm | 2 +- lib/Dist/Zilla/Plugin/GatherDir.pm | 9 ++++--- lib/Dist/Zilla/Plugin/GatherDir/Template.pm | 2 +- lib/Dist/Zilla/Plugin/GatherFile.pm | 8 +++---- lib/Dist/Zilla/Plugin/GenerateFile.pm | 2 +- lib/Dist/Zilla/Plugin/MakeMaker.pm | 26 ++++++++++++++------- lib/Dist/Zilla/Plugin/Manifest.pm | 5 +++- lib/Dist/Zilla/Plugin/ManifestSkip.pm | 2 +- lib/Dist/Zilla/Plugin/MetaNoIndex.pm | 4 ++-- lib/Dist/Zilla/Plugin/MetaResources.pm | 2 +- lib/Dist/Zilla/Plugin/ModuleBuild.pm | 12 ++++++---- lib/Dist/Zilla/Plugin/ModuleShareDirs.pm | 4 ++-- lib/Dist/Zilla/Plugin/NextRelease.pm | 4 ++-- lib/Dist/Zilla/Plugin/PkgDist.pm | 2 +- lib/Dist/Zilla/Plugin/PkgVersion.pm | 2 +- lib/Dist/Zilla/Plugin/PodVersion.pm | 2 +- lib/Dist/Zilla/Plugin/Prereqs.pm | 4 ++-- lib/Dist/Zilla/Plugin/PruneCruft.pm | 6 ++--- lib/Dist/Zilla/Plugin/PruneFiles.pm | 4 ++-- lib/Dist/Zilla/Plugin/RemovePrereqs.pm | 4 ++-- lib/Dist/Zilla/Plugin/ShareDir.pm | 5 +--- lib/Dist/Zilla/Plugin/TemplateModule.pm | 2 +- lib/Dist/Zilla/PluginBundle/Filter.pm | 4 ++-- lib/Dist/Zilla/Role/ExecFiles.pm | 5 +--- lib/Dist/Zilla/Role/FileFinderUser.pm | 8 +++---- lib/Dist/Zilla/Role/FileInjector.pm | 2 +- lib/Dist/Zilla/Role/FileMunger.pm | 2 +- lib/Dist/Zilla/Role/LicenseProvider.pm | 7 +++++- lib/Dist/Zilla/Role/PPI.pm | 2 +- lib/Dist/Zilla/Role/Plugin.pm | 2 +- lib/Dist/Zilla/Role/PluginBundle/Easy.pm | 2 +- lib/Dist/Zilla/Role/PrereqScanner.pm | 8 ++++--- lib/Dist/Zilla/Tester.pm | 8 +++---- lib/Dist/Zilla/Util/AuthorDeps.pm | 6 ++--- lib/Test/DZil.pm | 4 ++-- 47 files changed, 130 insertions(+), 117 deletions(-) diff --git a/lib/Dist/Zilla.pm b/lib/Dist/Zilla.pm index 557691df7..a5f18b816 100644 --- a/lib/Dist/Zilla.pm +++ b/lib/Dist/Zilla.pm @@ -264,17 +264,17 @@ has main_module => ( if ( $self->_has_main_module_override ) { $file = first { $_->name eq $self->_main_module_override } - @{ $self->files }; + $self->files->@*; } else { # We're having to guess $guess = $self->name =~ s{-}{/}gr; $guess = "lib/$guess.pm"; - $file = (first { $_->name eq $guess } @{ $self->files }) + $file = (first { $_->name eq $guess } $self->files->@*) || (sort { length $a->name <=> length $b->name } grep { $_->name =~ m{\.pm\z} and $_->name =~ m{\Alib/} } - @{ $self->files })[0]; + $self->files->@*)[0]; $self->log("guessing dist's main_module is " . ($file ? $file->name : $guess)); } @@ -287,9 +287,9 @@ has main_module => ( } else { push @errorlines,"We tried to guess '$guess' but no file like that existed"; } - if (not @{ $self->files }) { + if (not $self->files->@*) { push @errorlines, "Upon further inspection we didn't find any files in your dist, did you add any?"; - } elsif ( none { $_->name =~ m{^lib/.+\.pm\z} } @{ $self->files } ){ + } elsif ( none { $_->name =~ m{^lib/.+\.pm\z} } $self->files->@* ){ push @errorlines, "We didn't find any .pm files in your dist, this is probably a problem."; } push @errorlines,"Cannot continue without a main_module"; @@ -518,11 +518,11 @@ has files => ( sub prune_file { my ($self, $file) = @_; - my @files = @{ $self->files }; + my @files = $self->files->@*; for my $i (0 .. $#files) { next unless $file == $files[ $i ]; - splice @{ $self->files }, $i, 1; + splice $self->files->@*, $i, 1; return; } @@ -750,11 +750,11 @@ sub _check_dupe_files { my %files_named; my @dupes; - for my $file (@{ $self->files }) { + for my $file ($self->files->@*) { my $filename = $file->name; if (my $seen = $files_named{ $filename }) { - push @{ $seen }, $file; - push @dupes, $filename if @{ $seen } == 2; + push @$seen, $file; + push @dupes, $filename if @$seen == 2; } else { $files_named{ $filename } = [ $file ]; } @@ -764,7 +764,7 @@ sub _check_dupe_files { for my $name (@dupes) { $self->log("attempt to add $name multiple times; added by: " - . join('; ', map { $_->added_by } @{ $files_named{ $name } }) + . join('; ', map { $_->added_by } $files_named{ $name }->@*) ); } diff --git a/lib/Dist/Zilla/App.pm b/lib/Dist/Zilla/App.pm index 1ee7ee8c6..2b24d198f 100644 --- a/lib/Dist/Zilla/App.pm +++ b/lib/Dist/Zilla/App.pm @@ -19,7 +19,7 @@ sub global_opt_spec { [ "verbose|v", "log additional output" ], [ "verbose-plugin|V=s@", "log additional output from some plugins only" ], [ "lib-inc|I=s@", "additional \@INC dirs", { - callbacks => { 'always fine' => sub { unshift @INC, @{$_[0]}; } } + callbacks => { 'always fine' => sub { unshift @INC, $_[0]->@* } } } ], $self->SUPER::global_opt_spec, ); @@ -109,7 +109,7 @@ sub chrome { $self->{__chrome__} = Dist::Zilla::Chrome::Term->new; my @v_plugins = $self->global_options->verbose_plugin - ? grep { length } @{ $self->global_options->verbose_plugin } + ? grep { length } $self->global_options->verbose_plugin->@* : (); my $verbose = $self->global_options->verbose; @@ -126,7 +126,7 @@ sub zilla { return $self->{'' . __PACKAGE__}{zilla} ||= do { my @v_plugins = $self->global_options->verbose_plugin - ? grep { length } @{ $self->global_options->verbose_plugin } + ? grep { length } $self->global_options->verbose_plugin->@* : (); my $verbose = $self->global_options->verbose; diff --git a/lib/Dist/Zilla/App/Command/add.pm b/lib/Dist/Zilla/App/Command/add.pm index 961dab798..655be28b4 100644 --- a/lib/Dist/Zilla/App/Command/add.pm +++ b/lib/Dist/Zilla/App/Command/add.pm @@ -52,7 +52,7 @@ sub execute { my $zilla = $self->zilla; my $dist = $zilla->name; - + require File::pushd; require Dist::Zilla::Dist::Minter; @@ -74,7 +74,7 @@ sub execute { $factory->make_module({ name => $name }); } - for my $file ( @{ $factory->zilla->files} ) { + for my $file ($factory->zilla->files->@*) { $zilla->_write_out_file($file, $root); } } diff --git a/lib/Dist/Zilla/App/Tester.pm b/lib/Dist/Zilla/App/Tester.pm index 64b852fb5..753ed6d10 100644 --- a/lib/Dist/Zilla/App/Tester.pm +++ b/lib/Dist/Zilla/App/Tester.pm @@ -76,7 +76,7 @@ sub test_dzil { sub log_messages { my ($self) = @_; - [ map {; $_->{message} } @{ $self->app->zilla->logger->logger->events } ]; + [ map {; $_->{message} } $self->app->zilla->logger->logger->events->@* ]; } } diff --git a/lib/Dist/Zilla/Dist/Builder.pm b/lib/Dist/Zilla/Dist/Builder.pm index 7536def0f..9645f1094 100644 --- a/lib/Dist/Zilla/Dist/Builder.pm +++ b/lib/Dist/Zilla/Dist/Builder.pm @@ -121,7 +121,7 @@ sub _setup_default_plugins { zilla => $self, style => 'list', code => sub { - my @files = uniq map {; @{ $_->find_files } } + my @files = uniq map {; $_->find_files->@* } $_[0]->zilla->plugins_with(-ExecFiles); return \@files; @@ -142,7 +142,7 @@ sub _setup_default_plugins { my @files = grep { $_->name =~ m{\.pl$} or $_->content =~ m{^\s*\#\!.*perl\b}; - } @{ $parent_plugin->find_files }; + } $parent_plugin->find_files->@*; return \@files; }, }); @@ -162,12 +162,12 @@ sub _setup_default_plugins { my @files; if ( $map->{dist} ) { push @files, grep {; $_->name =~ m{\A\Q$map->{dist}\E/} } - @{ $self->zilla->files }; + $self->zilla->files->@*; } if ( my $mod_map = $map->{module} ) { for my $mod ( keys %$mod_map ) { push @files, grep { $_->name =~ m{\A\Q$mod_map->{$mod}\E/} } - @{ $self->zilla->files }; + $self->zilla->files->@*; } } return \@files; @@ -371,7 +371,7 @@ sub build_in { $self->log("writing " . $self->name . " in $build_root"); - for my $file (@{ $self->files }) { + for my $file ($self->files->@*) { $self->_write_out_file($file, $build_root); } @@ -506,7 +506,7 @@ sub _build_archive { my $archive = Archive::Tar->new; my %seen_dir; for my $distfile ( - sort { length($a->name) <=> length($b->name) } @{ $self->files } + sort { length($a->name) <=> length($b->name) } $self->files->@* ) { my $in = path($distfile->name)->parent; @@ -537,7 +537,7 @@ sub _build_archive_with_wrapper { my $archive = Archive::Tar::Wrapper->new; for my $distfile ( - sort { length($a->name) <=> length($b->name) } @{ $self->files } + sort { length($a->name) <=> length($b->name) } $self->files->@* ) { my $in = path($distfile->name)->parent; @@ -706,7 +706,7 @@ sub install { ## no critic Punctuation my $wd = File::pushd::pushd($target); my @cmd = $arg->{install_command} - ? @{ $arg->{install_command} } + ? $arg->{install_command}->@* : (cpanm => "."); $self->log_debug([ 'installing via %s', \@cmd ]); diff --git a/lib/Dist/Zilla/Dist/Minter.pm b/lib/Dist/Zilla/Dist/Minter.pm index 39b23e1a1..3d5d2e21d 100644 --- a/lib/Dist/Zilla/Dist/Minter.pm +++ b/lib/Dist/Zilla/Dist/Minter.pm @@ -22,7 +22,7 @@ sub _setup_default_plugins { zilla => $self, }); - push @{ $self->_plugins }, $plugin; + push $self->_plugins->@*, $plugin; } } @@ -129,7 +129,7 @@ sub mint_dist { $self->log("writing files to $dir"); - for my $file (@{ $self->files }) { + for my $file ($self->files->@*) { $self->_write_out_file($file, $dir); } diff --git a/lib/Dist/Zilla/MVP/RootSection.pm b/lib/Dist/Zilla/MVP/RootSection.pm index 5ea7c109a..6dc6308e7 100644 --- a/lib/Dist/Zilla/MVP/RootSection.pm +++ b/lib/Dist/Zilla/MVP/RootSection.pm @@ -47,7 +47,7 @@ after finalize => sub { my $assembler = $self->sequence->assembler; - my %payload = %{ $self->payload }; + my %payload = $self->payload->%*; my %dzil; $dzil{$_} = delete $payload{":$_"} for grep { s/\A:// } keys %payload; diff --git a/lib/Dist/Zilla/MVP/Section.pm b/lib/Dist/Zilla/MVP/Section.pm index b9806964a..01265396c 100644 --- a/lib/Dist/Zilla/MVP/Section.pm +++ b/lib/Dist/Zilla/MVP/Section.pm @@ -36,7 +36,7 @@ after finalize => sub { $self->payload, ); - my %payload = %{ $self->payload }; + my %payload = $self->payload->%*; $plugin_class->register_component($name, \%payload, $self); diff --git a/lib/Dist/Zilla/Plugin/DistINI.pm b/lib/Dist/Zilla/Plugin/DistINI.pm index cbe171154..c31dd1e2e 100644 --- a/lib/Dist/Zilla/Plugin/DistINI.pm +++ b/lib/Dist/Zilla/Plugin/DistINI.pm @@ -68,7 +68,7 @@ sub gather_files { my $postlude = ''; - for (@{ $self->append_file }) { + for ($self->append_file->@*) { my $fn = $self->zilla->root->child($_); $postlude .= path($fn)->slurp_utf8; diff --git a/lib/Dist/Zilla/Plugin/Encoding.pm b/lib/Dist/Zilla/Plugin/Encoding.pm index c7642710a..c4f3b557c 100644 --- a/lib/Dist/Zilla/Plugin/Encoding.pm +++ b/lib/Dist/Zilla/Plugin/Encoding.pm @@ -86,14 +86,14 @@ sub set_file_encodings { # never match (at least the filename characters) my $matches_regex = qr/\000/; - $matches_regex = qr/$matches_regex|$_/ for @{$self->matches}; + $matches_regex = qr/$matches_regex|$_/ for $self->matches->@*; # \A\Q$_\E should also handle the `eq` check - $matches_regex = qr/$matches_regex|\A\Q$_\E/ for @{$self->filenames}; + $matches_regex = qr/$matches_regex|\A\Q$_\E/ for $self->filenames->@*; - my( $ignore_regex ) = map { $_ && qr/$_/ } join '|', @{ $self->ignore }; + my( $ignore_regex ) = map { $_ && qr/$_/ } join '|', $self->ignore->@*; - for my $file (@{$self->zilla->files}) { + for my $file ($self->zilla->files->@*) { next unless $file->name =~ $matches_regex; next if $ignore_regex and $file->name =~ $ignore_regex; diff --git a/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm b/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm index 72d8e9c64..ecc2f721c 100644 --- a/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm +++ b/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm @@ -109,10 +109,10 @@ sub find_files { my $self = shift; my $skip = _join_re($self->skips); - my $dir = _join_re([ map { qr!^\Q$_/! } @{ $self->dirs } ]); + my $dir = _join_re([ map { qr!^\Q$_/! } $self->dirs->@* ]); my $match = _join_re([ (map { my $re = glob_to_regex_string($_); qr!(?:\A|/)$re\z! } - @{ $self->files }), + $self->files->@*), @{ $self->matches } ]); diff --git a/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm b/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm index 5b69357ca..3f7dec7d0 100644 --- a/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm +++ b/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm @@ -66,7 +66,7 @@ sub find_files { my $files = $self->found_files; - foreach my $re (@{ $self->skips }) { + foreach my $re ($self->skips->@*) { @$files = grep { $_->name !~ $re } @$files; } diff --git a/lib/Dist/Zilla/Plugin/FinderCode.pm b/lib/Dist/Zilla/Plugin/FinderCode.pm index a2828b13e..5bb164f52 100644 --- a/lib/Dist/Zilla/Plugin/FinderCode.pm +++ b/lib/Dist/Zilla/Plugin/FinderCode.pm @@ -33,7 +33,7 @@ sub find_files { sub _find_via_grep { my ($self) = @_; - my @files = grep { $self->code->($_, $self) } @{ $self->zilla->files }; + my @files = grep { $self->code->($_, $self) } $self->zilla->files->@*; return \@files; } diff --git a/lib/Dist/Zilla/Plugin/GatherDir.pm b/lib/Dist/Zilla/Plugin/GatherDir.pm index d98dac633..0e1ebf807 100644 --- a/lib/Dist/Zilla/Plugin/GatherDir.pm +++ b/lib/Dist/Zilla/Plugin/GatherDir.pm @@ -162,7 +162,7 @@ around dump_config => sub { # only report relative to dist root to avoid leaking private info root => path($self->root)->relative($self->zilla->root), (map { $_ => $self->$_ ? 1 : 0 } qw(include_dotfiles follow_symlinks)), - (map { $_ => [ sort @{ $self->$_ } ] } qw(exclude_filename exclude_match prune_directory)), + (map { $_ => [ sort $self->$_->@* ] } qw(exclude_filename exclude_match prune_directory)), }; return $config; @@ -172,8 +172,7 @@ sub gather_files { my ($self) = @_; my $exclude_regex = qr/\000/; - $exclude_regex = qr/(?:$exclude_regex)|$_/ - for @{ $self->exclude_match }; + $exclude_regex = qr/(?:$exclude_regex)|$_/ for $self->exclude_match->@*; my $repo_root = $self->zilla->root; my $root = "" . $self->root; @@ -182,7 +181,7 @@ sub gather_files { my $prune_regex = qr/\000/; $prune_regex = qr/$prune_regex|$_/ - for ( @{ $self->prune_directory }, + for ( $self->prune_directory->@*, $self->include_dotfiles ? () : ( qr/^\.[^.]/ ) ); # build up the rules @@ -210,7 +209,7 @@ sub gather_files { $rule->exec(sub { my $relative = path($_[-1])->relative($root); $relative !~ $exclude_regex && - all { $relative ne $_ } @{ $self->exclude_filename } + all { $relative ne $_ } $self->exclude_filename->@* }); FILE: for my $filename ($rule->in($root)) { diff --git a/lib/Dist/Zilla/Plugin/GatherDir/Template.pm b/lib/Dist/Zilla/Plugin/GatherDir/Template.pm index 9a4556eae..a7afacf40 100644 --- a/lib/Dist/Zilla/Plugin/GatherDir/Template.pm +++ b/lib/Dist/Zilla/Plugin/GatherDir/Template.pm @@ -75,7 +75,7 @@ sub _file_from_filename { my $new_filename = $filename; - for my $token (keys %{$self->_rename}) { + for my $token (keys $self->_rename->%*) { my $expr = $self->_rename->{$token}; my $temp_temp = "{{ $expr }}"; my $replacement = $self->fill_in_string( diff --git a/lib/Dist/Zilla/Plugin/GatherFile.pm b/lib/Dist/Zilla/Plugin/GatherFile.pm index 16f0e6731..90eb39d1c 100644 --- a/lib/Dist/Zilla/Plugin/GatherFile.pm +++ b/lib/Dist/Zilla/Plugin/GatherFile.pm @@ -88,7 +88,7 @@ around dump_config => sub { prefix => $self->prefix, # only report relative to dist root to avoid leaking private info root => path($self->root)->relative($self->zilla->root), - filenames => [ sort @{ $self->filenames } ], + filenames => [ sort $self->filenames->@* ], }; return $config; @@ -103,10 +103,10 @@ sub gather_files { $root = path($root); $root = $root->absolute($repo_root) if path($root)->is_relative; - for my $filename (@{ $self->filenames }) - { + for my $filename ($self->filenames->@*) { $filename = $root->child($filename); - $self->log_fatal("$filename is a directory! Use [GatherDir] instead?") if -d $filename; + $self->log_fatal("$filename is a directory! Use [GatherDir] instead?") + if -d $filename; my $fileobj = $self->_file_from_filename($filename->stringify); diff --git a/lib/Dist/Zilla/Plugin/GenerateFile.pm b/lib/Dist/Zilla/Plugin/GenerateFile.pm index 15c1bee6b..d321aaf4c 100644 --- a/lib/Dist/Zilla/Plugin/GenerateFile.pm +++ b/lib/Dist/Zilla/Plugin/GenerateFile.pm @@ -120,7 +120,7 @@ sub gather_files { sub _content { my $self = shift; - my $content = join "\n", @{ $self->content }; + my $content = join "\n", $self->content->@*; $content .= qq{\n}; if ($self->content_is_template) { diff --git a/lib/Dist/Zilla/Plugin/MakeMaker.pm b/lib/Dist/Zilla/Plugin/MakeMaker.pm index eadf6095e..271e28425 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker.pm @@ -125,7 +125,7 @@ sub register_prereqs { 'ExtUtils::MakeMaker' => $self->eumm_version || 0, ); - return unless keys %{ $self->zilla->_share_dir_map }; + return unless keys $self->zilla->_share_dir_map->%*; $self->zilla->register_prereqs( { phase => 'configure' }, @@ -185,14 +185,13 @@ sub write_makefile_args { my $name = $self->zilla->name =~ s/-/::/gr; - my @exe_files = map { $_->name } - @{ $self->zilla->find_files(':ExecFiles') }; + my @exe_files = map { $_->name } $self->zilla->find_files(':ExecFiles')->@*; $self->log_fatal("can't install files with whitespace in their names") if grep { /\s/ } @exe_files; my %test_dirs; - for my $file (@{ $self->zilla->files }) { + for my $file ($self->zilla->files->@*) { next unless $file->name =~ m{\At/.+\.t\z}; my $dir = $file->name =~ s{/[^/]+\.t\z}{/*.t}gr; @@ -226,8 +225,10 @@ sub write_makefile_args { # higher configure-requires version, we should at least warn the user # https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/issues/215 foreach my $phase (qw(configure build test runtime)) { - if (my @version_ranges = pairgrep { defined($b) && !version::is_lax($b) } %{ $require_prereqs{$phase} } - and ($self->eumm_version || 0) < '7.1101') { + if (my @version_ranges = pairgrep { defined($b) && !version::is_lax($b) } + $require_prereqs{$phase}->%* + and ($self->eumm_version || 0) < '7.1101' + ) { $self->log_fatal([ 'found version range in %s prerequisites, which ExtUtils::MakeMaker cannot parse (must specify eumm_version of at least 7.1101): %s %s', $phase, $_->[0], $_->[1] @@ -245,8 +246,15 @@ sub write_makefile_args { @exe_files ? ( EXE_FILES => [ sort @exe_files ] ) : (), CONFIGURE_REQUIRES => $require_prereqs{configure}, - keys %{ $require_prereqs{build} } ? ( BUILD_REQUIRES => $require_prereqs{build} ) : (), - keys %{ $require_prereqs{test} } ? ( TEST_REQUIRES => $require_prereqs{test} ) : (), + + keys $require_prereqs{build}->%* + ? ( BUILD_REQUIRES => $require_prereqs{build} ) + : (), + + keys $require_prereqs{test}->%* + ? ( TEST_REQUIRES => $require_prereqs{test} ) + : (), + PREREQ_PM => $require_prereqs{runtime}, test => { TESTS => join q{ }, sort keys %test_dirs }, @@ -308,7 +316,7 @@ sub setup_installer { my $dumped_args = $self->_dump_as($write_makefile_args, '*WriteMakefileArgs'); - my $file = first { $_->name eq 'Makefile.PL' } @{$self->zilla->files}; + my $file = first { $_->name eq 'Makefile.PL' } $self->zilla->files->@*; $self->log_debug([ 'updating contents of Makefile.PL in memory' ]); diff --git a/lib/Dist/Zilla/Plugin/Manifest.pm b/lib/Dist/Zilla/Plugin/Manifest.pm index 529930301..9aadf0da7 100644 --- a/lib/Dist/Zilla/Plugin/Manifest.pm +++ b/lib/Dist/Zilla/Plugin/Manifest.pm @@ -49,7 +49,10 @@ sub gather_files { my $generated_by = sprintf "%s v%s", ref($self), $self->VERSION || '(dev)'; return "# This file was automatically generated by $generated_by.\n" - . join("\n", map { __fix_filename($_) } sort map { $_->name } @{ $zilla->files }) + . join("\n", map {; __fix_filename($_) } + sort + map {; $_->name } + $zilla->files->@*) . "\n", }, }); diff --git a/lib/Dist/Zilla/Plugin/ManifestSkip.pm b/lib/Dist/Zilla/Plugin/ManifestSkip.pm index d2743c091..494fad2d6 100644 --- a/lib/Dist/Zilla/Plugin/ManifestSkip.pm +++ b/lib/Dist/Zilla/Plugin/ManifestSkip.pm @@ -66,7 +66,7 @@ sub prune_files { my $skip = ExtUtils::Manifest::maniskip($skipfile_name); # Copy list (break reference) so we can mutate. - for my $file ((), @{ $files }) { + for my $file ((), @$files) { next unless $skip->($file->name); $self->log_debug([ 'pruning %s', $file->name ]); diff --git a/lib/Dist/Zilla/Plugin/MetaNoIndex.pm b/lib/Dist/Zilla/Plugin/MetaNoIndex.pm index 9483fe713..6712df430 100644 --- a/lib/Dist/Zilla/Plugin/MetaNoIndex.pm +++ b/lib/Dist/Zilla/Plugin/MetaNoIndex.pm @@ -48,7 +48,7 @@ sub mvp_aliases { my %alias_for; for my $key (keys %ATTR_ALIAS) { - $alias_for{ $_ } = $key for @{ $ATTR_ALIAS{$key} }; + $alias_for{ $_ } = $key for $ATTR_ALIAS{$key}->@*; } return \%alias_for; @@ -104,7 +104,7 @@ sub metadata { my $self = shift; return { no_index => { - map {; my $reader = $_->[0]; ($_->[1] => [ sort @{ $self->$reader } ]) } + map {; my $reader = $_->[0]; ($_->[1] => [ sort $self->$reader->@* ]) } grep {; my $pred = "_has_$_->[0]"; $self->$pred } map {; [ $_ => $ATTR_ALIAS{$_}[0] ] } keys %ATTR_ALIAS diff --git a/lib/Dist/Zilla/Plugin/MetaResources.pm b/lib/Dist/Zilla/Plugin/MetaResources.pm index 101d0f5d1..dacd2a91e 100644 --- a/lib/Dist/Zilla/Plugin/MetaResources.pm +++ b/lib/Dist/Zilla/Plugin/MetaResources.pm @@ -33,7 +33,7 @@ around BUILDARGS => sub { my ($class, @arg) = @_; my $args = $class->$orig(@arg); - my %copy = %{ $args }; + my %copy = %$args; my $zilla = delete $copy{zilla}; my $name = delete $copy{plugin_name}; diff --git a/lib/Dist/Zilla/Plugin/ModuleBuild.pm b/lib/Dist/Zilla/Plugin/ModuleBuild.pm index 99e8e91f7..71667c690 100644 --- a/lib/Dist/Zilla/Plugin/ModuleBuild.pm +++ b/lib/Dist/Zilla/Plugin/ModuleBuild.pm @@ -56,7 +56,7 @@ has 'mb_version' => ( lazy => 1, default => sub { my $self = shift; - keys %{$self->zilla->_share_dir_map} ? '0.3601' : '0.28'; + keys $self->zilla->_share_dir_map->%* ? '0.3601' : '0.28'; }, ); @@ -125,7 +125,7 @@ sub _dump_as { } sub _add_build_elements { - my @elems = @{ shift->build_element } or return ''; + my @elems = shift->build_element->@* or return ''; return '$build->add_build_element($_) for qw(' . join(' ', @elems) . ');'; } @@ -147,7 +147,7 @@ sub module_build_args { my ($self) = @_; my @exe_files = map { $_->name } - @{ $self->zilla->find_files(':ExecFiles') }; + $self->zilla->find_files(':ExecFiles')->@*; $self->log_fatal("can't install files with whitespace in their names") if grep { /\s/ } @exe_files; @@ -171,7 +171,9 @@ sub module_build_args { dist_version => $self->zilla->version, dist_author => [ $self->zilla->authors ], @exe_files ? ( script_files => [ sort @exe_files ] ) : (), - ( keys %{$self->zilla->_share_dir_map} ? (share_dir => $self->zilla->_share_dir_map) : ()), + (keys $self->zilla->_share_dir_map->%* + ? (share_dir => $self->zilla->_share_dir_map) + : ()), (map {; my $modules = $prereqs{$_}->as_string_hash; keys %$modules ? ( $_ => $modules ) : () } keys %prereqs), recursive_test_files => 1, @@ -217,7 +219,7 @@ sub setup_installer { my $fallback_build_requires = $self->fallback_build_requires; - my $file = first { $_->name eq 'Build.PL' } @{$self->zilla->files}; + my $file = first { $_->name eq 'Build.PL' } $self->zilla->files->@*; $self->log_debug([ 'updating contents of Build.PL in memory' ]); my $content = $self->fill_in_string( diff --git a/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm b/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm index 516e2ec4b..cc6849e8c 100644 --- a/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm +++ b/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm @@ -31,7 +31,7 @@ sub find_files { for my $mod ( keys %$modmap ) { my $dir = $modmap->{$mod}; my @mod_files = grep { index($_->name, "$dir/") == 0 } - @{ $self->zilla->files }; + $self->zilla->files->@*; push @files, @mod_files; } @@ -51,7 +51,7 @@ around BUILDARGS => sub { my ($class, @arg) = @_; my $args = $class->$orig(@arg); - my %copy = %{ $args }; + my %copy = %$args; my $zilla = delete $copy{zilla}; my $name = delete $copy{plugin_name}; diff --git a/lib/Dist/Zilla/Plugin/NextRelease.pm b/lib/Dist/Zilla/Plugin/NextRelease.pm index 41e3f5df0..1b9aba424 100644 --- a/lib/Dist/Zilla/Plugin/NextRelease.pm +++ b/lib/Dist/Zilla/Plugin/NextRelease.pm @@ -116,7 +116,7 @@ has _original_changes_content => ( sub munge_files { my ($self) = @_; - my ($file) = grep { $_->name eq $self->filename } @{ $self->zilla->files }; + my ($file) = grep { $_->name eq $self->filename } $self->zilla->files->@*; $self->log_fatal([ 'failed to find %s in the distribution', $self->filename ]) if not $file; # save original unmunged content, for replacing back in the repo later @@ -139,7 +139,7 @@ sub munge_files { sub after_release { my ($self) = @_; my $filename = $self->filename; - my ($gathered_file) = grep { $_->name eq $filename } @{ $self->zilla->files }; + my ($gathered_file) = grep { $_->name eq $filename } $self->zilla->files->@*; $self->log_fatal("failed to find $filename in the distribution") if not $gathered_file; my $iolayer = sprintf(":raw:encoding(%s)", $gathered_file->encoding); diff --git a/lib/Dist/Zilla/Plugin/PkgDist.pm b/lib/Dist/Zilla/Plugin/PkgDist.pm index 9fe25062e..865267613 100644 --- a/lib/Dist/Zilla/Plugin/PkgDist.pm +++ b/lib/Dist/Zilla/Plugin/PkgDist.pm @@ -35,7 +35,7 @@ typically used when doing monkey patching or other tricky things. sub munge_files { my ($self) = @_; - $self->munge_file($_) for @{ $self->found_files }; + $self->munge_file($_) for $self->found_files->@*; } sub munge_file { diff --git a/lib/Dist/Zilla/Plugin/PkgVersion.pm b/lib/Dist/Zilla/Plugin/PkgVersion.pm index 69b527755..2bf03890c 100644 --- a/lib/Dist/Zilla/Plugin/PkgVersion.pm +++ b/lib/Dist/Zilla/Plugin/PkgVersion.pm @@ -114,7 +114,7 @@ sub BUILD { sub munge_files { my ($self) = @_; - $self->munge_file($_) for @{ $self->found_files }; + $self->munge_file($_) for $self->found_files->@*; } sub munge_file { diff --git a/lib/Dist/Zilla/Plugin/PodVersion.pm b/lib/Dist/Zilla/Plugin/PodVersion.pm index a138e62a1..3b0f930f7 100644 --- a/lib/Dist/Zilla/Plugin/PodVersion.pm +++ b/lib/Dist/Zilla/Plugin/PodVersion.pm @@ -30,7 +30,7 @@ section). sub munge_files { my ($self) = @_; - $self->munge_file($_) for @{ $self->found_files }; + $self->munge_file($_) for $self->found_files->@*; } sub munge_file { diff --git a/lib/Dist/Zilla/Plugin/Prereqs.pm b/lib/Dist/Zilla/Plugin/Prereqs.pm index e82d062cd..7a934a465 100644 --- a/lib/Dist/Zilla/Plugin/Prereqs.pm +++ b/lib/Dist/Zilla/Plugin/Prereqs.pm @@ -129,7 +129,7 @@ around BUILDARGS => sub { my ($class, @arg) = @_; my $args = $class->$orig(@arg); - my %copy = %{ $args }; + my %copy = %$args; my $zilla = delete $copy{zilla}; my $name = delete $copy{plugin_name}; @@ -181,7 +181,7 @@ sub register_prereqs { type => $self->prereq_type, phase => $self->prereq_phase, }, - %{ $self->_prereq }, + $self->_prereq->%*, ); } diff --git a/lib/Dist/Zilla/Plugin/PruneCruft.pm b/lib/Dist/Zilla/Plugin/PruneCruft.pm index a2a05e364..55759bfff 100644 --- a/lib/Dist/Zilla/Plugin/PruneCruft.pm +++ b/lib/Dist/Zilla/Plugin/PruneCruft.pm @@ -52,7 +52,7 @@ L. sub _dont_exclude_file { my ($self, $file) = @_; - for my $exception (@{ $self->except }) { + for my $exception ($self->except->@*) { return 1 if $file->name =~ $exception; } return; @@ -79,7 +79,7 @@ sub exclude_file { return 1 if substr($file->name, 0, 4) eq 'tmp/'; if (my $file = $file->name =~ s/\.c$//r) { - for my $other (@{ $self->zilla->files }) { + for my $other ($self->zilla->files->@*) { return 1 if $other->name eq "${file}.xs"; } } @@ -91,7 +91,7 @@ sub prune_files { my ($self) = @_; # Copy list (break reference) so we can mutate. - for my $file ((), @{ $self->zilla->files }) { + for my $file ((), $self->zilla->files->@*) { next unless $self->exclude_file($file); $self->log_debug([ 'pruning %s', $file->name ]); diff --git a/lib/Dist/Zilla/Plugin/PruneFiles.pm b/lib/Dist/Zilla/Plugin/PruneFiles.pm index 334ef87d7..fe0536520 100644 --- a/lib/Dist/Zilla/Plugin/PruneFiles.pm +++ b/lib/Dist/Zilla/Plugin/PruneFiles.pm @@ -63,10 +63,10 @@ sub prune_files { # never match (at least the filename characters) my $matches_regex = qr/\000/; - $matches_regex = qr/$matches_regex|$_/ for (@{ $self->matches }); + $matches_regex = qr/$matches_regex|$_/ for ($self->matches->@*); # \A\Q$_\E should also handle the `eq` check - $matches_regex = qr/$matches_regex|\A\Q$_\E/ for (@{ $self->filenames }); + $matches_regex = qr/$matches_regex|\A\Q$_\E/ for ($self->filenames->@*); # Copy list (break reference) so we can mutate. for my $file ((), @{ $self->zilla->files }) { diff --git a/lib/Dist/Zilla/Plugin/RemovePrereqs.pm b/lib/Dist/Zilla/Plugin/RemovePrereqs.pm index 8761317d5..9835dbef5 100644 --- a/lib/Dist/Zilla/Plugin/RemovePrereqs.pm +++ b/lib/Dist/Zilla/Plugin/RemovePrereqs.pm @@ -47,7 +47,7 @@ around dump_config => sub { my $config = $self->$orig; my $this_config = { - modules_to_remove => [ sort @{ $self->modules_to_remove } ], + modules_to_remove => [ sort $self->modules_to_remove->@* ], }; $config->{'' . __PACKAGE__} = $this_config; @@ -65,7 +65,7 @@ sub register_prereqs { for my $p (@phases) { for my $t (@types) { - for my $m (@{ $self->modules_to_remove }) { + for my $m ($self->modules_to_remove->@*) { $prereqs->requirements_for($p, $t)->clear_requirement($m); } } diff --git a/lib/Dist/Zilla/Plugin/ShareDir.pm b/lib/Dist/Zilla/Plugin/ShareDir.pm index ae42355b2..ceffec101 100644 --- a/lib/Dist/Zilla/Plugin/ShareDir.pm +++ b/lib/Dist/Zilla/Plugin/ShareDir.pm @@ -28,10 +28,7 @@ sub find_files { my ($self) = @_; my $dir = $self->dir; - my $files = [ - grep { index($_->name, "$dir/") == 0 } - @{ $self->zilla->files } - ]; + return [ grep { index($_->name, "$dir/") == 0 } $self->zilla->files->@* ]; } sub share_dir_map { diff --git a/lib/Dist/Zilla/Plugin/TemplateModule.pm b/lib/Dist/Zilla/Plugin/TemplateModule.pm index 9d5eb4d32..e414d3c34 100644 --- a/lib/Dist/Zilla/Plugin/TemplateModule.pm +++ b/lib/Dist/Zilla/Plugin/TemplateModule.pm @@ -75,7 +75,7 @@ sub make_module { if ($self->has_template) { $template = path( $self->template )->slurp_utf8; } else { - $template = ${ $self->section_data('Module.pm') }; + $template = $self->section_data('Module.pm')->$*; } my $content = $self->fill_in_string( diff --git a/lib/Dist/Zilla/PluginBundle/Filter.pm b/lib/Dist/Zilla/PluginBundle/Filter.pm index ca6d87a24..897828383 100644 --- a/lib/Dist/Zilla/PluginBundle/Filter.pm +++ b/lib/Dist/Zilla/PluginBundle/Filter.pm @@ -53,8 +53,8 @@ sub bundle_config { my $config = {}; - my $has_filter_args = any { /^-/ } keys %{ $section->{payload} }; - for my $key (keys %{ $section->{payload} }) { + my $has_filter_args = any { /^-/ } keys $section->{payload}->%*; + for my $key (keys $section->{payload}->%*) { my $val = $section->{payload}->{$key}; my $target = $has_filter_args && ($key !~ /^-/) ? 'bundle' diff --git a/lib/Dist/Zilla/Role/ExecFiles.pm b/lib/Dist/Zilla/Role/ExecFiles.pm index f37451d65..f2092f11e 100644 --- a/lib/Dist/Zilla/Role/ExecFiles.pm +++ b/lib/Dist/Zilla/Role/ExecFiles.pm @@ -14,10 +14,7 @@ sub find_files { my ($self) = @_; my $dir = $self->dir; - my $files = [ - grep { index($_->name, "$dir/") == 0 } - @{ $self->zilla->files } - ]; + return [ grep { index($_->name, "$dir/") == 0 } $self->zilla->files->@* ]; } 1; diff --git a/lib/Dist/Zilla/Role/FileFinderUser.pm b/lib/Dist/Zilla/Role/FileFinderUser.pm index 3aca01b2c..e4b25e2b3 100644 --- a/lib/Dist/Zilla/Role/FileFinderUser.pm +++ b/lib/Dist/Zilla/Role/FileFinderUser.pm @@ -20,7 +20,7 @@ Here's an example of a finder: ( taken from AutoPrereqs ) Then you use it in your code like this: - foreach my $file ( @{ $self->found_files }) { + foreach my $file ($self->found_files->@*) { # $file is an object! Look at L } @@ -122,7 +122,7 @@ parameter method => ( role { my ($p) = @_; - my ($finder_arg, @finder_arg_aliases) = @{ $p->finder_arg_names }; + my ($finder_arg, @finder_arg_aliases) = $p->finder_arg_names->@*; confess "no finder arg names given!" unless $finder_arg; around mvp_multivalue_args => sub { @@ -151,14 +151,14 @@ role { has $finder_arg => ( is => 'ro', isa => 'ArrayRef[Str]', - default => sub { [ @{ $p->default_finders } ] }, + default => sub { [ $p->default_finders->@* ] }, ); method $p->method => sub { my ($self) = @_; my @filesets = map {; $self->zilla->find_files($_) } - @{ $self->$finder_arg }; + $self->$finder_arg->@*; my %by_name = map {; $_->name, $_ } map { @$_ } @filesets; diff --git a/lib/Dist/Zilla/Role/FileInjector.pm b/lib/Dist/Zilla/Role/FileInjector.pm index 73077bc81..5fbac4236 100644 --- a/lib/Dist/Zilla/Role/FileInjector.pm +++ b/lib/Dist/Zilla/Role/FileInjector.pm @@ -31,7 +31,7 @@ sub add_file { ); $self->log_debug([ 'adding file %s', $file->name ]); - push @{ $self->zilla->files }, $file; + push $self->zilla->files->@*, $file; } 1; diff --git a/lib/Dist/Zilla/Role/FileMunger.pm b/lib/Dist/Zilla/Role/FileMunger.pm index f99c32ede..81146fbd4 100644 --- a/lib/Dist/Zilla/Role/FileMunger.pm +++ b/lib/Dist/Zilla/Role/FileMunger.pm @@ -31,7 +31,7 @@ sub munge_files { $self->log_fatal("no munge_file behavior implemented!") unless $self->can('munge_file'); - my @files = @{ $self->zilla->files }; + my @files = $self->zilla->files->@*; for my $file ( @files ) { if ($file->is_bytes) { $self->log_debug($file->name . " has 'bytes' encoding, skipping..."); diff --git a/lib/Dist/Zilla/Role/LicenseProvider.pm b/lib/Dist/Zilla/Role/LicenseProvider.pm index 99ab456ed..713ea20d3 100644 --- a/lib/Dist/Zilla/Role/LicenseProvider.pm +++ b/lib/Dist/Zilla/Role/LicenseProvider.pm @@ -17,7 +17,12 @@ ignored. =head1 REQUIRED METHODS -=head2 C<< provide_license({ copyright_holder => $holder, copyright_year => $year }) >> +=head2 provide_license + + $plugin->provide_license({ + copyright_holder => $holder, + copyright_year => $year, + }); Generate license object. Returned object should be an instance of L. diff --git a/lib/Dist/Zilla/Role/PPI.pm b/lib/Dist/Zilla/Role/PPI.pm index 1baed1c61..49c55fbb9 100644 --- a/lib/Dist/Zilla/Role/PPI.pm +++ b/lib/Dist/Zilla/Role/PPI.pm @@ -82,7 +82,7 @@ sub document_assigns_to_variable { my ($self, $document, $variable) = @_; my $package_stmts = $document->find('PPI::Statement::Package'); - my @namespaces = map { $_->namespace } @{ $package_stmts || []}; + my @namespaces = map { $_->namespace } $package_stmts->@*; my ($sigil, $varname) = ($variable =~ m'^([$@%*])(.+)$'); diff --git a/lib/Dist/Zilla/Role/Plugin.pm b/lib/Dist/Zilla/Role/Plugin.pm index 4ac28b7fb..84f5d54c5 100644 --- a/lib/Dist/Zilla/Role/Plugin.pm +++ b/lib/Dist/Zilla/Role/Plugin.pm @@ -84,7 +84,7 @@ sub register_component { $self->log_debug([ 'online, %s v%s', $self->meta->name, $version ]); - push @{ $self->zilla->_plugins }, $self; + $self->zilla->_add_plugin($self); return; } diff --git a/lib/Dist/Zilla/Role/PluginBundle/Easy.pm b/lib/Dist/Zilla/Role/PluginBundle/Easy.pm index 1fdc11f0b..327c2dbfd 100644 --- a/lib/Dist/Zilla/Role/PluginBundle/Easy.pm +++ b/lib/Dist/Zilla/Role/PluginBundle/Easy.pm @@ -177,7 +177,7 @@ sub add_bundle { $bundle = "\@$bundle" unless $bundle =~ /^@/; - push @{ $self->_plugins }, + push $self->_plugins->@*, $package->bundle_config({ name => $self->name . '/' . $bundle, package => $package, diff --git a/lib/Dist/Zilla/Role/PrereqScanner.pm b/lib/Dist/Zilla/Role/PrereqScanner.pm index cc38d6984..e0189e0ba 100644 --- a/lib/Dist/Zilla/Role/PrereqScanner.pm +++ b/lib/Dist/Zilla/Role/PrereqScanner.pm @@ -61,12 +61,14 @@ be registered as prerequisites. has skips => ( is => 'ro', isa => 'ArrayRef[Str]', + default => sub { [] }, ); around mvp_multivalue_args => sub { my ($orig, $self) = @_; ($self->$orig, 'skips') }; + around mvp_aliases => sub { my ($orig, $self) = @_; my $aliases = $self->$orig; @@ -74,7 +76,6 @@ around mvp_aliases => sub { return $aliases }; - requires 'scan_file_reqs'; sub scan_prereqs { @@ -140,7 +141,7 @@ sub scan_prereqs { } # remove prereqs from skiplist - for my $skip (@{ $self->skips || [] }) { + for my $skip ($self->skips->@*) { my $re = qr/$skip/; foreach my $k ($req->required_modules) { @@ -160,7 +161,8 @@ sub scan_prereqs { $req->clear_requirement($_) for qw(Config DB Errno NEXT Pod::Functions); # never indexed # we're done, return what we've found - my %got = %{ $req->as_string_hash }; + my %got = $req->as_string_hash->%*; + if ($phase eq 'runtime') { %runtime_final = %got; } else { diff --git a/lib/Dist/Zilla/Tester.pm b/lib/Dist/Zilla/Tester.pm index ee4a63cc0..030dd92f4 100644 --- a/lib/Dist/Zilla/Tester.pm +++ b/lib/Dist/Zilla/Tester.pm @@ -89,7 +89,7 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } sub log_messages { my ($self) = @_; - [ map {; $_->{message} } @{ $self->chrome->logger->events } ]; + [ map {; $_->{message} } $self->chrome->logger->events->@* ]; } sub slurp_file { @@ -125,7 +125,7 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } our $Log_Events = []; sub most_recent_log_events { - return @{ $Log_Events } + return @$Log_Events; } around from_config => sub { @@ -154,7 +154,7 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } dircopy($source, $root); if ($tester_arg->{also_copy}) { - while (my ($src, $dest) = each %{ $tester_arg->{also_copy} }) { + while (my ($src, $dest) = each $tester_arg->{also_copy}->%*) { dircopy($src, $tempdir->child($dest)); } } @@ -263,7 +263,7 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } our $Log_Events = []; sub most_recent_log_events { - return @{ $Log_Events } + return @$Log_Events; } sub _mint_target_dir { diff --git a/lib/Dist/Zilla/Util/AuthorDeps.pm b/lib/Dist/Zilla/Util/AuthorDeps.pm index f6f0b0cde..ff8172788 100644 --- a/lib/Dist/Zilla/Util/AuthorDeps.pm +++ b/lib/Dist/Zilla/Util/AuthorDeps.pm @@ -13,8 +13,8 @@ sub format_author_deps { my ($reqs, $versions) = @_; my $formatted = ''; - foreach my $rec (@{ $reqs }) { - my ($mod, $ver) = each(%{ $rec }); + foreach my $rec (@$reqs) { + my ($mod, $ver) = each %$rec; $formatted .= $versions ? "$mod = $ver\n" : "$mod\n"; } chomp($formatted); @@ -92,7 +92,7 @@ sub extract_author_deps { my $vermap = $reqs->as_string_hash; # Add the other requirements - push(@packages, sort keys %{ $vermap }); + push @packages, sort keys %$vermap; # Move inc:: first in list as they may impact the loading of other # plugins (in particular local ones). diff --git a/lib/Test/DZil.pm b/lib/Test/DZil.pm index 16abf5ac5..b5a3097be 100644 --- a/lib/Test/DZil.pm +++ b/lib/Test/DZil.pm @@ -128,7 +128,7 @@ sub _build_ini_builder { for my $key (sort keys %$core_config) { my @values = ref $core_config->{ $key } - ? @{ $core_config->{ $key } } + ? $core_config->{ $key }->@* : $core_config->{ $key }; $config .= "$key = $_\n" for grep {defined} @values; @@ -150,7 +150,7 @@ sub _build_ini_builder { for my $key (sort keys %$payload) { my @values = ref $payload->{ $key } - ? @{ $payload->{ $key } } + ? $payload->{ $key }->@* : $payload->{ $key }; $config .= "$key = $_\n" for grep {defined} @values; From c6d84207c1908e43e19095ea90bedfb8a9a63bf9 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 21 Apr 2018 21:32:25 +0200 Subject: [PATCH 07/20] eliminate coderef where lexical sub will do --- t/commands/listdeps.t | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/t/commands/listdeps.t b/t/commands/listdeps.t index 341f5c390..131ae333a 100644 --- a/t/commands/listdeps.t +++ b/t/commands/listdeps.t @@ -3,6 +3,7 @@ use warnings; use Test::More 0.88; use Test::Deep; +use Dist::Zilla::Dialect; use Dist::Zilla::App::Tester; # see also t/plugins/autoprereqs.t @@ -60,7 +61,7 @@ for my $how ( my $map = $how->[1]; my $desc = @opt ? "@opt" : "default"; - my $make_bag = sub { bag(map {; $map->() } grep {; $_ ne 'perl' } @_) }; + my sub nonperl_bag { bag(map {; $map->() } grep {; $_ ne 'perl' } @_) }; subtest "$desc output" => sub { { @@ -71,7 +72,7 @@ for my $how ( cmp_deeply( [ split("\n", $output) ], - $make_bag->(@default_prereqs), + nonperl_bag(@default_prereqs), "all prereqs listed as output", ); } @@ -84,7 +85,7 @@ for my $how ( cmp_deeply( [ split("\n", $output) ], - $make_bag->(keys %{$prereqs{recommends}}), + nonperl_bag(keys %{$prereqs{recommends}}), "no recommended prereqs listed as output, --no-requires", ); } @@ -97,7 +98,7 @@ for my $how ( cmp_deeply( [ split("\n", $output) ], - $make_bag->(keys %{$prereqs{requires}}), + nonperl_bag(keys %{$prereqs{requires}}), 'no recommended prereqs listed as output, --no-recommends', ); } @@ -110,7 +111,7 @@ for my $how ( cmp_deeply( [ split("\n", $output) ], - $make_bag->(@default_prereqs, keys %{$prereqs{suggests}}), + nonperl_bag(@default_prereqs, keys %{$prereqs{suggests}}), 'no recommended prereqs listed as output, --suggests', ); } @@ -123,7 +124,7 @@ for my $how ( cmp_deeply( [ split("\n", $output) ], - $make_bag->('String::Formatter', @default_prereqs), + nonperl_bag('String::Formatter', @default_prereqs), 'develop prereqs included in output for ' . $arg, ); } From 91bc26ab9d507b87ad18183bc458b75c51f2b2e9 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 21 Apr 2018 21:41:45 +0200 Subject: [PATCH 08/20] clean up some sub definitions --- lib/Dist/Zilla/Plugin/MakeMaker.pm | 12 +++++------- lib/Dist/Zilla/Role/PPI.pm | 7 +++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/Dist/Zilla/Plugin/MakeMaker.pm b/lib/Dist/Zilla/Plugin/MakeMaker.pm index 271e28425..bcf5b0bb5 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker.pm @@ -208,18 +208,16 @@ sub write_makefile_args { $perl_prereq = version->parse($perl_prereq)->numify if $perl_prereq; - my $prereqs_dump = sub { + my sub dump_prereqs ($phase, $type) { $self->_normalize_eumm_versions( $prereqs->requirements_for(@_) ->clone ->clear_requirement('perl') - ->as_string_hash - ); - }; + ->as_string_hash) + } - my %require_prereqs = map { - $_ => $prereqs_dump->($_, 'requires'); - } qw(configure build test runtime); + my %require_prereqs = map { $_ => dump_prereqs($_, 'requires'); } + qw(configure build test runtime); # EUMM may soon be able to support this, but until we decide to inject a # higher configure-requires version, we should at least warn the user diff --git a/lib/Dist/Zilla/Role/PPI.pm b/lib/Dist/Zilla/Role/PPI.pm index 49c55fbb9..3610bef46 100644 --- a/lib/Dist/Zilla/Role/PPI.pm +++ b/lib/Dist/Zilla/Role/PPI.pm @@ -1,11 +1,12 @@ package Dist::Zilla::Role::PPI; # ABSTRACT: a role for plugins which use PPI +use Moose::Role; + use Dist::Zilla::Dialect; use namespace::autoclean; -use Moose::Role; use Digest::MD5 qw(md5); =head1 DESCRIPTION @@ -87,9 +88,7 @@ sub document_assigns_to_variable { my ($sigil, $varname) = ($variable =~ m'^([$@%*])(.+)$'); my $package; - my $finder = sub { - my $node = $_[1]; - + my $finder = sub ($top, $node) { if ($node->isa('PPI::Statement') && !$node->isa('PPI::Statement::End') && !$node->isa('PPI::Statement::Data')) { From 75674cfe1a4f60e557d985e0d04fbc99fc32df8a Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Sat, 9 Dec 2017 17:36:11 -0800 Subject: [PATCH 09/20] remove all uses of File::HomeDir ...as inspired by File::HomeDir::Tiny Note that all of this can be replaced by (glob('~'))[0] when perl 5.20 is required. --- Changes | 1 + lib/Dist/Zilla/Plugin/GatherDir.pm | 5 +++-- lib/Dist/Zilla/Plugin/GatherFile.pm | 6 +++--- lib/Dist/Zilla/Plugin/UploadToCPAN.pm | 5 +++-- lib/Dist/Zilla/Util.pm | 9 ++++++--- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Changes b/Changes index a21523052..48bc5914a 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for {{$dist->name}} {{$NEXT}} + - replace uses of File::HomeDir with a simple glob() 6.012 2018-04-21 10:20:21+02:00 Europe/Oslo - revert addition of Archive::Tar::Wrapper as a mandatory prereq (in diff --git a/lib/Dist/Zilla/Plugin/GatherDir.pm b/lib/Dist/Zilla/Plugin/GatherDir.pm index 0e1ebf807..da9269f4d 100644 --- a/lib/Dist/Zilla/Plugin/GatherDir.pm +++ b/lib/Dist/Zilla/Plugin/GatherDir.pm @@ -3,6 +3,7 @@ package Dist::Zilla::Plugin::GatherDir; use Moose; use Dist::Zilla::Types qw(Path); +use Dist::Zilla::Util; with 'Dist::Zilla::Role::FileGatherer'; use Dist::Zilla::Dialect; @@ -14,7 +15,7 @@ use namespace::autoclean; This is a very, very simple L plugin. It looks in the directory named in the L attribute and adds all the files it finds there. If the root begins with a tilde, the tilde is -replaced with the current user's home directory according to L. +passed through C first. Almost every dist will be built with one GatherDir plugin, since it's the easiest way to get files from disk into your dist. Most users just need: @@ -176,7 +177,7 @@ sub gather_files { my $repo_root = $self->zilla->root; my $root = "" . $self->root; - $root =~ s{^~([\\/])}{require File::HomeDir; File::HomeDir::->my_home . $1}e; + $root =~ s{^~([\\/])}{ Dist::Zilla::Util->homedir . $1 }e; $root = path($root)->absolute($repo_root)->stringify if path($root)->is_relative; my $prune_regex = qr/\000/; diff --git a/lib/Dist/Zilla/Plugin/GatherFile.pm b/lib/Dist/Zilla/Plugin/GatherFile.pm index 90eb39d1c..830bcc049 100644 --- a/lib/Dist/Zilla/Plugin/GatherFile.pm +++ b/lib/Dist/Zilla/Plugin/GatherFile.pm @@ -10,6 +10,7 @@ use Dist::Zilla::Dialect; use MooseX::Types::Moose 'ArrayRef'; use Path::Tiny; use Dist::Zilla::File::OnDisk; +use Dist::Zilla::Util; use namespace::autoclean; =head1 SYNOPSIS @@ -22,8 +23,7 @@ use namespace::autoclean; This is a very, very simple L plugin. It adds all the files referenced by the C option that are found in the directory named in the L attribute. If the root begins -with a tilde, the tilde is replaced with the current user's home directory -according to L. +with a tilde, the tilde is passed through C first. Since normally every distribution will use a GatherDir plugin, you would only need to use the GatherFile plugin if the file was already being excluded (e.g. @@ -99,7 +99,7 @@ sub gather_files { my $repo_root = $self->zilla->root; my $root = "" . $self->root; - $root =~ s{^~([\\/])}{require File::HomeDir; File::HomeDir::->my_home . $1}e; + $root =~ s{^~([\\/])}{ Dist::Zilla::Util->homedir . $1 }e; $root = path($root); $root = $root->absolute($repo_root) if path($root)->is_relative; diff --git a/lib/Dist/Zilla/Plugin/UploadToCPAN.pm b/lib/Dist/Zilla/Plugin/UploadToCPAN.pm index 5c81ea7d7..a0a5d304a 100644 --- a/lib/Dist/Zilla/Plugin/UploadToCPAN.pm +++ b/lib/Dist/Zilla/Plugin/UploadToCPAN.pm @@ -9,6 +9,7 @@ use Dist::Zilla::Dialect; use File::Spec; use Moose::Util::TypeConstraints; use Scalar::Util qw(weaken); +use Dist::Zilla::Util; use Try::Tiny; use namespace::autoclean; @@ -156,7 +157,7 @@ has pause_cfg_file => ( =attr pause_cfg_dir This is the directory for resolving a relative L. -It defaults to C<< File::HomeDir->my_home >>. +it defaults to the glob expansion of F<~>. =cut @@ -164,7 +165,7 @@ has pause_cfg_dir => ( is => 'ro', isa => 'Str', lazy => 1, - default => sub { require File::HomeDir; File::HomeDir::->my_home }, + default => sub { Dist::Zilla::Util->homedir }, ); =attr pause_cfg diff --git a/lib/Dist/Zilla/Util.pm b/lib/Dist/Zilla/Util.pm index 7f29f6e48..e67e1636b 100644 --- a/lib/Dist/Zilla/Util.pm +++ b/lib/Dist/Zilla/Util.pm @@ -104,13 +104,16 @@ sub expand_config_package_name { shift; goto &_expand_config_package_name } +sub homedir { + $^O eq 'MSWin32' && "$]" < 5.016 ? $ENV{HOME} || $ENV{USERPROFILE} : (glob('~'))[0]; +} + sub _global_config_root { require Dist::Zilla::Path; return Dist::Zilla::Path::path($ENV{DZIL_GLOBAL_CONFIG_ROOT}) if $ENV{DZIL_GLOBAL_CONFIG_ROOT}; - require File::HomeDir; - my $homedir = File::HomeDir->my_home - or Carp::croak("couldn't determine home directory"); + my $homedir = homedir(); + Carp::croak("couldn't determine home directory") if not $homedir; return Dist::Zilla::Path::path($homedir)->child('.dzil'); } From fd6e0ee8c0de2cc128f9beab4b8f10be2e487e41 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Tue, 17 May 2016 21:36:20 -0700 Subject: [PATCH 10/20] do not chdir into the source dir when building --- Changes | 3 +++ lib/Dist/Zilla/Dist/Builder.pm | 2 +- lib/Dist/Zilla/Plugin/ConfirmRelease.pm | 2 +- lib/Dist/Zilla/Plugin/NextRelease.pm | 2 +- lib/Dist/Zilla/Tester.pm | 8 -------- t/plugins/nextrelease.t | 2 +- 6 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Changes b/Changes index 48bc5914a..a08428c74 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,9 @@ Revision history for {{$dist->name}} {{$NEXT}} - replace uses of File::HomeDir with a simple glob() + - Dist::Zilla::Tester no longer changes into the source directory when + building. This may break some plugins that do not prepend + $zilla->root to paths when they should. 6.012 2018-04-21 10:20:21+02:00 Europe/Oslo - revert addition of Archive::Tar::Wrapper as a mandatory prereq (in diff --git a/lib/Dist/Zilla/Dist/Builder.pm b/lib/Dist/Zilla/Dist/Builder.pm index 9645f1094..7620f5539 100644 --- a/lib/Dist/Zilla/Dist/Builder.pm +++ b/lib/Dist/Zilla/Dist/Builder.pm @@ -489,7 +489,7 @@ sub build_archive { my $archive = $self->$method($built_in, $basename, $basedir); - my $file = path($self->archive_filename); + my $file = path($self->root, $self->archive_filename); $self->log("writing archive to $file"); $archive->write("$file", 9); diff --git a/lib/Dist/Zilla/Plugin/ConfirmRelease.pm b/lib/Dist/Zilla/Plugin/ConfirmRelease.pm index 9d66d06cf..53bf7d547 100644 --- a/lib/Dist/Zilla/Plugin/ConfirmRelease.pm +++ b/lib/Dist/Zilla/Plugin/ConfirmRelease.pm @@ -15,7 +15,7 @@ sub before_release { map {; $_->plugin_name } $self->zilla->plugins_with(-Releaser); - $self->log("*** Preparing to release $tgz with $releasers ***"); + $self->log([ '*** Preparing to release %s with %s ***', $tgz->basename, $releasers ]); my $prompt = "Do you want to continue the release process?"; my $default = exists $ENV{DZIL_CONFIRMRELEASE_DEFAULT} diff --git a/lib/Dist/Zilla/Plugin/NextRelease.pm b/lib/Dist/Zilla/Plugin/NextRelease.pm index 1b9aba424..20ca11ef2 100644 --- a/lib/Dist/Zilla/Plugin/NextRelease.pm +++ b/lib/Dist/Zilla/Plugin/NextRelease.pm @@ -156,7 +156,7 @@ sub after_release { $self->log_debug([ 'updating contents of %s on disk', $update_fn ]); # and finally rewrite the changelog on disk - path($update_fn)->spew({binmode => $iolayer}, $content); + path($self->zilla->root, $update_fn)->spew({binmode => $iolayer}, $content); } __PACKAGE__->meta->make_immutable; diff --git a/lib/Dist/Zilla/Tester.pm b/lib/Dist/Zilla/Tester.pm index 030dd92f4..ddd2e1566 100644 --- a/lib/Dist/Zilla/Tester.pm +++ b/lib/Dist/Zilla/Tester.pm @@ -207,10 +207,6 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } around build_in => sub { my ($orig, $self, $target) = @_; - # XXX: We *must eliminate* the need for this! It's only here because right - # now building a dist with (root <> cwd) doesn't work. -- rjbs, 2010-03-08 - my $wd = File::pushd::pushd($self->root); - $target ||= do { my $target = path($self->tempdir)->child('build'); $target->mkpath; @@ -223,10 +219,6 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } around ['test', 'release'] => sub { my ($orig, $self) = @_; - # XXX: We *must eliminate* the need for this! It's only here because right - # now building a dist with (root <> cwd) doesn't work. -- rjbs, 2010-03-08 - my $wd = File::pushd::pushd($self->root); - return $self->$orig; }; diff --git a/t/plugins/nextrelease.t b/t/plugins/nextrelease.t index 036039234..2beb576a9 100644 --- a/t/plugins/nextrelease.t +++ b/t/plugins/nextrelease.t @@ -25,7 +25,7 @@ END_CHANGES with 'Dist::Zilla::Role::AfterRelease'; sub after_release { - Path::Tiny::path('Changes')->spew('OHHAI'); + Path::Tiny::path(shift->zilla->root, 'Changes')->spew('OHHAI'); } } From c24316feb213878dfb7dd3eb017cc14eff9c94e2 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 16 Dec 2016 16:39:02 -0800 Subject: [PATCH 11/20] prohibit _ in non-decimal versions This will prevent discouraged formats from being used, even though CPAN::Meta still lets some of them in (despite contradictory language in CPAN::Meta::Spec). Following the Lyon version roundtable, _ is no longer interpreted as another dot in non-decimal versions, so the sort order can now be different. --- Changes | 2 ++ lib/Dist/Zilla.pm | 9 ++++----- lib/Dist/Zilla/Types.pm | 7 +++++++ t/types.t | 12 ++++++++++++ 4 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 t/types.t diff --git a/Changes b/Changes index a08428c74..bc4b076bf 100644 --- a/Changes +++ b/Changes @@ -5,6 +5,8 @@ Revision history for {{$dist->name}} - Dist::Zilla::Tester no longer changes into the source directory when building. This may break some plugins that do not prepend $zilla->root to paths when they should. + - version strings must now pass version.pm's is_strict checks, which + eliminates such discouraged constructs as v1.23_01. 6.012 2018-04-21 10:20:21+02:00 Europe/Oslo - revert addition of Archive::Tar::Wrapper as a mandatory prereq (in diff --git a/lib/Dist/Zilla.pm b/lib/Dist/Zilla.pm index a5f18b816..f450e033a 100644 --- a/lib/Dist/Zilla.pm +++ b/lib/Dist/Zilla.pm @@ -7,12 +7,12 @@ with 'Dist::Zilla::Role::ConfigDumper'; # This comment has fün̈n̈ÿ characters. use MooseX::Types::Moose qw(ArrayRef Bool HashRef Object Str); -use MooseX::Types::Perl qw(DistName LaxVersionStr); +use MooseX::Types::Perl qw(DistName); use Moose::Util::TypeConstraints; use Dist::Zilla::Dialect; -use Dist::Zilla::Types qw(Path License ReleaseStatus); +use Dist::Zilla::Types qw(Path License ReleaseStatus VersionStr); use Log::Dispatchouli 1.100712; # proxy_loggers, quiet_fatal use Dist::Zilla::Path; @@ -73,15 +73,14 @@ This is the version of the distribution to be created. =cut has _version_override => ( - isa => LaxVersionStr, + isa => VersionStr, is => 'ro' , init_arg => 'version', ); -# XXX: *clearly* this needs to be really much smarter -- rjbs, 2008-06-01 has version => ( is => 'rw', - isa => LaxVersionStr, + isa => VersionStr, lazy => 1, init_arg => undef, builder => '_build_version', diff --git a/lib/Dist/Zilla/Types.pm b/lib/Dist/Zilla/Types.pm index 8dae57ee8..22cdb00e5 100644 --- a/lib/Dist/Zilla/Types.pm +++ b/lib/Dist/Zilla/Types.pm @@ -19,6 +19,7 @@ use MooseX::Types -declare => [qw( License OneZero YesNoStr ReleaseStatus Path ArrayRefOfPaths _Filename + VersionStr )]; use MooseX::Types::Moose qw(Str Int Defined ArrayRef); use Path::Tiny; @@ -49,4 +50,10 @@ subtype _Filename, as Str, where { $_ !~ qr/(?:\x{0a}|\x{0b}|\x{0c}|\x{0d}|\x{85}|\x{2028}|\x{2029})/ }, message { "Filename not a Str, or contains a newline or other vertical whitespace" }; +use MooseX::Types::Perl qw(LaxVersionStr); +subtype VersionStr, as LaxVersionStr, + # non-decimal versions cannot use underscores + where { /_/ && (/^v/ || (()= /\./g) > 1) ? 0 : 1 }, + message { 'Only decimal versions can contain underscores' }; + 1; diff --git a/t/types.t b/t/types.t new file mode 100644 index 000000000..f81355d03 --- /dev/null +++ b/t/types.t @@ -0,0 +1,12 @@ +use strict; +use warnings; + +use Test::More 0.88; + +use Dist::Zilla::Types qw(VersionStr); + +ok(is_VersionStr($_), "$_ isa VersionStr") foreach qw(1.23 1.23000 1.004_002 v1.23 v1.23.45); + +ok(!is_VersionStr($_), "$_ is not a VersionStr") foreach qw(v1.23_01 v1.23.45_01 1.23.45_01); + +done_testing; From cee59bf8c688737afc6c22caca13601dda1d8647 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 21 Apr 2018 21:48:52 +0200 Subject: [PATCH 12/20] VersionStr type: very slightly simplification of check --- lib/Dist/Zilla/Types.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Dist/Zilla/Types.pm b/lib/Dist/Zilla/Types.pm index 22cdb00e5..a1c88d5da 100644 --- a/lib/Dist/Zilla/Types.pm +++ b/lib/Dist/Zilla/Types.pm @@ -53,7 +53,7 @@ subtype _Filename, as Str, use MooseX::Types::Perl qw(LaxVersionStr); subtype VersionStr, as LaxVersionStr, # non-decimal versions cannot use underscores - where { /_/ && (/^v/ || (()= /\./g) > 1) ? 0 : 1 }, + where { /_/ && (/^v/ || tr/././ > 1) ? 0 : 1 }, message { 'Only decimal versions can contain underscores' }; 1; From 48fe7a09fe8b7c2416b9d029a67379a7e4bb10f3 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 12 May 2017 17:31:52 +0200 Subject: [PATCH 13/20] homedir: on v5.20, we can just use glob("~") for homedir even on MSWin32 --- Changes | 21 ++++++++++++++++++--- lib/Dist/Zilla/Plugin/MetaTests.pm | 6 +++--- lib/Dist/Zilla/Util.pm | 2 +- t/plugins/misctests.t | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Changes b/Changes index bc4b076bf..8a5c63eb2 100644 --- a/Changes +++ b/Changes @@ -1,12 +1,27 @@ Revision history for {{$dist->name}} {{$NEXT}} - - replace uses of File::HomeDir with a simple glob() + [THIS RELEASE MIGHT BREAK YOUR BUILD] + - now requires perl v5.20.0 + - the "plugins" and "plugins_with" methods, along with a few others, + now are meant to be called in list context rather than scalar; you + should update to calling in list context, as Dist::Zilla v8 will stop + returning references + + [LESS TERRIFYING CHANGES] + - Introducing Dist::Zilla::Dialect! This library turns on the features + being used by core Dist::Zilla code. Probably don't just use this + blindly in your code, but there it is. + - replace uses of File::HomeDir with a simple glob() (thanks, Karen + Etheridge) - Dist::Zilla::Tester no longer changes into the source directory when building. This may break some plugins that do not prepend - $zilla->root to paths when they should. + $zilla->root to paths when they should. (thanks, Karen Etheridge) - version strings must now pass version.pm's is_strict checks, which - eliminates such discouraged constructs as v1.23_01. + eliminates such discouraged constructs as v1.23_01 (thanks, Karen + Etheridge) + - the test generated by [MetaTests] is now an author test, not a + release test (thanks, Karen Etheridge) 6.012 2018-04-21 10:20:21+02:00 Europe/Oslo - revert addition of Archive::Tar::Wrapper as a mandatory prereq (in diff --git a/lib/Dist/Zilla/Plugin/MetaTests.pm b/lib/Dist/Zilla/Plugin/MetaTests.pm index c23b80d96..e37fd188f 100644 --- a/lib/Dist/Zilla/Plugin/MetaTests.pm +++ b/lib/Dist/Zilla/Plugin/MetaTests.pm @@ -14,7 +14,7 @@ use namespace::autoclean; This is an extension of L, providing the following files: - xt/release/meta-yaml.t - a standard Test::CPAN::Meta test + xt/author/meta-yaml.t - a standard Test::CPAN::Meta test L will be added as a C dependency (which can be installed via C<< dzil listdeps --author | cpanm >>). @@ -30,7 +30,7 @@ L. =cut -# Register the release test prereq as a "develop requires" +# Register the author test prereq as a "develop requires" # so it will be listed in "dzil listdeps --author" sub register_prereqs { my ($self) = @_; @@ -47,7 +47,7 @@ __PACKAGE__->meta->make_immutable; 1; __DATA__ -___[ xt/release/distmeta.t ]___ +___[ xt/author/distmeta.t ]___ #!perl # This file was automatically generated by Dist::Zilla::Plugin::MetaTests. diff --git a/lib/Dist/Zilla/Util.pm b/lib/Dist/Zilla/Util.pm index e67e1636b..130fd7398 100644 --- a/lib/Dist/Zilla/Util.pm +++ b/lib/Dist/Zilla/Util.pm @@ -105,7 +105,7 @@ sub expand_config_package_name { } sub homedir { - $^O eq 'MSWin32' && "$]" < 5.016 ? $ENV{HOME} || $ENV{USERPROFILE} : (glob('~'))[0]; + (glob('~'))[0]; } sub _global_config_root { diff --git a/t/plugins/misctests.t b/t/plugins/misctests.t index 92b630b0a..ef25e496d 100644 --- a/t/plugins/misctests.t +++ b/t/plugins/misctests.t @@ -19,7 +19,7 @@ my $tzil = Builder->from_config( $tzil->build; -my $meta_test = $tzil->slurp_file('build/xt/release/distmeta.t'); +my $meta_test = $tzil->slurp_file('build/xt/author/distmeta.t'); like($meta_test, qr{meta_yaml_ok}, "we have a distmeta file that tests it"); my $pod_test = $tzil->slurp_file('build/xt/author/pod-syntax.t'); From a91a22324dbb9850ed9aac6a697e9d935c616ed1 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Mon, 27 Jul 2015 15:37:16 -0700 Subject: [PATCH 14/20] skip an intermediary step, as the tempdir is guaranteed to be unique --- lib/Dist/Zilla/Dist/Builder.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Dist/Zilla/Dist/Builder.pm b/lib/Dist/Zilla/Dist/Builder.pm index 7620f5539..9e352dc9c 100644 --- a/lib/Dist/Zilla/Dist/Builder.pm +++ b/lib/Dist/Zilla/Dist/Builder.pm @@ -672,7 +672,7 @@ sub ensure_built_in_tmpdir { or $self->log('cannot create link .build/latest'); } - $self->ensure_built_in($target); + $self->build_in($target); return ($target, $latest, $previous); } From e5adaddb6a380e04dc4adf5451bba6b7007806bf Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Mon, 27 Jul 2015 11:55:04 -0700 Subject: [PATCH 15/20] create a symlink in .build/latest for all builds --- Changes | 2 ++ lib/Dist/Zilla/Dist/Builder.pm | 32 +++++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Changes b/Changes index 8a5c63eb2..19aab512e 100644 --- a/Changes +++ b/Changes @@ -22,6 +22,8 @@ Revision history for {{$dist->name}} Etheridge) - the test generated by [MetaTests] is now an author test, not a release test (thanks, Karen Etheridge) + - all builds now result in a .build/latest symlink (thanks again, + Karen) 6.012 2018-04-21 10:20:21+02:00 Europe/Oslo - revert addition of Archive::Tar::Wrapper as a mandatory prereq (in diff --git a/lib/Dist/Zilla/Dist/Builder.pm b/lib/Dist/Zilla/Dist/Builder.pm index 9e352dc9c..11a020d63 100644 --- a/lib/Dist/Zilla/Dist/Builder.pm +++ b/lib/Dist/Zilla/Dist/Builder.pm @@ -378,6 +378,8 @@ sub build_in { $_->after_build({ build_root => $build_root }) for $self->plugins_with(-AfterBuild); + $self->_create_build_symlinks(path('.build'), $build_root); + $self->built_in($build_root); } @@ -653,28 +655,40 @@ sub ensure_built_in_tmpdir { my $target = path( File::Temp::tempdir(DIR => $build_root) ); $self->log("building distribution under $target for installation"); + my ($latest, $previous) = $self->_create_build_symlinks($build_root, $target); + + $self->build_in($target); + + return ($target, $latest, $previous); +} + +sub _create_build_symlinks { + my ($self, $symlink_root, $build_target) = @_; + + $symlink_root->mkpath unless -d $symlink_root; + my $os_has_symlinks = eval { symlink("",""); 1 }; my $previous; my $latest; if( $os_has_symlinks ) { - $previous = path( $build_root, 'previous' ); - $latest = path( $build_root, 'latest' ); + $previous = path( $symlink_root, 'previous' ); + $latest = path( $symlink_root, 'latest' ); if( -l $previous ) { $previous->remove - or $self->log("cannot remove old .build/previous link"); + or $self->log([ 'cannot remove old %s/previous link', $symlink_root ]); } if( -l $latest ) { rename $latest, $previous - or $self->log("cannot move .build/latest link to .build/previous"); + or $self->log([ 'cannot move %s/latest link to .build/previous', $symlink_root ]); } - symlink $target->basename, $latest - or $self->log('cannot create link .build/latest'); - } - $self->build_in($target); + my $link_dest = path($build_target)->relative(path($latest)->parent); + symlink $link_dest->stringify, $latest + or $self->log([ 'cannot create link %s/latest', $symlink_root ]); + } - return ($target, $latest, $previous); + return ($latest, $previous); } =method install From 7bde3934ebe39967d92a9bf20c2b19b9925830ac Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 21 Apr 2016 14:45:16 +0100 Subject: [PATCH 16/20] stringify directory, for String::Flogger --- lib/Dist/Zilla/Dist/Builder.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Dist/Zilla/Dist/Builder.pm b/lib/Dist/Zilla/Dist/Builder.pm index 11a020d63..84ba9fbf7 100644 --- a/lib/Dist/Zilla/Dist/Builder.pm +++ b/lib/Dist/Zilla/Dist/Builder.pm @@ -676,16 +676,16 @@ sub _create_build_symlinks { $latest = path( $symlink_root, 'latest' ); if( -l $previous ) { $previous->remove - or $self->log([ 'cannot remove old %s/previous link', $symlink_root ]); + or $self->log([ 'cannot remove old %s/previous link', "$symlink_root" ]); } if( -l $latest ) { rename $latest, $previous - or $self->log([ 'cannot move %s/latest link to .build/previous', $symlink_root ]); + or $self->log([ 'cannot move %s/latest link to .build/previous', "$symlink_root" ]); } my $link_dest = path($build_target)->relative(path($latest)->parent); symlink $link_dest->stringify, $latest - or $self->log([ 'cannot create link %s/latest', $symlink_root ]); + or $self->log([ 'cannot create link %s/latest', "$symlink_root" ]); } return ($latest, $previous); From 1a77ae14511b9dccd0925d4fe906e78fe2d200e8 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Mon, 23 Apr 2018 00:50:54 +0200 Subject: [PATCH 17/20] avoid use of @_ where practical --- lib/Dist/Zilla.pm | 83 +++++-------- lib/Dist/Zilla/App.pm | 15 +-- lib/Dist/Zilla/App/Command.pm | 8 +- lib/Dist/Zilla/App/Command/add.pm | 8 +- lib/Dist/Zilla/App/Command/authordeps.pm | 4 +- lib/Dist/Zilla/App/Command/build.pm | 4 +- lib/Dist/Zilla/App/Command/clean.pm | 4 +- lib/Dist/Zilla/App/Command/install.pm | 4 +- lib/Dist/Zilla/App/Command/listdeps.pm | 15 +-- lib/Dist/Zilla/App/Command/new.pm | 8 +- lib/Dist/Zilla/App/Command/nop.pm | 6 +- lib/Dist/Zilla/App/Command/release.pm | 4 +- lib/Dist/Zilla/App/Command/run.pm | 4 +- lib/Dist/Zilla/App/Command/setup.pm | 8 +- lib/Dist/Zilla/App/Command/smoke.pm | 8 +- lib/Dist/Zilla/App/Command/test.pm | 18 ++- lib/Dist/Zilla/App/Command/version.pm | 8 +- lib/Dist/Zilla/App/Tester.pm | 29 ++--- lib/Dist/Zilla/Chrome/Term.pm | 14 +-- lib/Dist/Zilla/Chrome/Test.pm | 11 +- lib/Dist/Zilla/Dist/Builder.pm | 109 +++++------------- lib/Dist/Zilla/Dist/Minter.pm | 17 +-- lib/Dist/Zilla/File/FromCode.pm | 22 ++-- lib/Dist/Zilla/File/OnDisk.pm | 10 +- lib/Dist/Zilla/MVP/Assembler.pm | 13 +-- lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm | 4 +- lib/Dist/Zilla/MVP/Assembler/Zilla.pm | 10 +- lib/Dist/Zilla/MVP/Reader/Perl.pm | 4 +- lib/Dist/Zilla/MVP/RootSection.pm | 9 +- lib/Dist/Zilla/MVP/Section.pm | 8 +- lib/Dist/Zilla/MintingProfile/Default.pm | 4 +- lib/Dist/Zilla/Plugin/AutoPrereqs.pm | 14 +-- lib/Dist/Zilla/Plugin/AutoVersion.pm | 4 +- lib/Dist/Zilla/Plugin/CPANFile.pm | 8 +- lib/Dist/Zilla/Plugin/ConfirmRelease.pm | 4 +- lib/Dist/Zilla/Plugin/DistINI.pm | 4 +- lib/Dist/Zilla/Plugin/Encoding.pm | 4 +- lib/Dist/Zilla/Plugin/ExtraTests.pm | 17 +-- lib/Dist/Zilla/Plugin/FakeRelease.pm | 4 +- lib/Dist/Zilla/Plugin/FileFinder/ByName.pm | 10 +- lib/Dist/Zilla/Plugin/FileFinder/Filter.pm | 7 +- lib/Dist/Zilla/Plugin/FinderCode.pm | 16 +-- lib/Dist/Zilla/Plugin/GatherDir.pm | 15 +-- lib/Dist/Zilla/Plugin/GatherDir/Template.pm | 13 +-- lib/Dist/Zilla/Plugin/GatherFile.pm | 13 +-- lib/Dist/Zilla/Plugin/GenerateFile.pm | 12 +- lib/Dist/Zilla/Plugin/InlineFiles.pm | 4 +- lib/Dist/Zilla/Plugin/License.pm | 4 +- lib/Dist/Zilla/Plugin/MakeMaker.pm | 32 ++--- lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm | 8 +- lib/Dist/Zilla/Plugin/Manifest.pm | 7 +- lib/Dist/Zilla/Plugin/ManifestSkip.pm | 3 +- lib/Dist/Zilla/Plugin/MetaConfig.pm | 4 +- lib/Dist/Zilla/Plugin/MetaJSON.pm | 17 ++- lib/Dist/Zilla/Plugin/MetaResources.pm | 11 +- lib/Dist/Zilla/Plugin/MetaTests.pm | 4 +- lib/Dist/Zilla/Plugin/MetaYAML.pm | 7 +- lib/Dist/Zilla/Plugin/ModuleBuild.pm | 32 ++--- lib/Dist/Zilla/Plugin/ModuleShareDirs.pm | 13 +-- lib/Dist/Zilla/Plugin/PkgDist.pm | 12 +- lib/Dist/Zilla/Plugin/PkgVersion.pm | 15 +-- lib/Dist/Zilla/Plugin/PodCoverageTests.pm | 4 +- lib/Dist/Zilla/Plugin/PodSyntaxTests.pm | 6 +- lib/Dist/Zilla/Plugin/PodVersion.pm | 12 +- lib/Dist/Zilla/Plugin/Prereqs.pm | 14 +-- lib/Dist/Zilla/Plugin/PruneCruft.pm | 11 +- lib/Dist/Zilla/Plugin/PruneFiles.pm | 4 +- lib/Dist/Zilla/Plugin/Readme.pm | 11 +- lib/Dist/Zilla/Plugin/RemovePrereqs.pm | 7 +- lib/Dist/Zilla/Plugin/ShareDir.pm | 7 +- lib/Dist/Zilla/Plugin/TemplateModule.pm | 4 +- lib/Dist/Zilla/Plugin/TestRelease.pm | 3 +- lib/Dist/Zilla/Plugin/UploadToCPAN.pm | 36 +++--- lib/Dist/Zilla/PluginBundle/Basic.pm | 4 +- lib/Dist/Zilla/PluginBundle/Classic.pm | 4 +- lib/Dist/Zilla/PluginBundle/FakeClassic.pm | 6 +- lib/Dist/Zilla/PluginBundle/Filter.pm | 3 +- lib/Dist/Zilla/Prereqs.pm | 15 +-- lib/Dist/Zilla/Role/BuildPL.pm | 8 +- lib/Dist/Zilla/Role/ExecFiles.pm | 4 +- lib/Dist/Zilla/Role/File.pm | 49 +++----- lib/Dist/Zilla/Role/FileFinderUser.pm | 12 +- lib/Dist/Zilla/Role/FileMunger.pm | 4 +- lib/Dist/Zilla/Role/MintingProfile.pm | 5 +- .../Zilla/Role/MintingProfile/ShareDir.pm | 4 +- lib/Dist/Zilla/Role/MutableFile.pm | 26 ++--- lib/Dist/Zilla/Role/PPI.pm | 12 +- lib/Dist/Zilla/Role/Plugin.pm | 17 ++- lib/Dist/Zilla/Role/PluginBundle.pm | 3 +- lib/Dist/Zilla/Role/PluginBundle/Easy.pm | 18 +-- lib/Dist/Zilla/Role/PrereqScanner.pm | 14 +-- lib/Dist/Zilla/Role/Stash.pm | 8 +- lib/Dist/Zilla/Role/TestRunner.pm | 3 +- lib/Dist/Zilla/Role/TextTemplate.pm | 4 +- lib/Dist/Zilla/Tester.pm | 54 +++------ lib/Dist/Zilla/Util.pm | 6 +- lib/Dist/Zilla/Util/AuthorDeps.pm | 8 +- lib/Test/DZil.pm | 17 +-- t/lib/Dist/Zilla/Stash/Heap.pm | 7 +- 99 files changed, 378 insertions(+), 847 deletions(-) diff --git a/lib/Dist/Zilla.pm b/lib/Dist/Zilla.pm index f450e033a..249010625 100644 --- a/lib/Dist/Zilla.pm +++ b/lib/Dist/Zilla.pm @@ -86,9 +86,7 @@ has version => ( builder => '_build_version', ); -sub _build_name { - my ($self) = @_; - +sub _build_name ($self) { my $name; for my $plugin ($self->plugins_with(-NameProvider)) { next unless defined(my $this_name = $plugin->provide_name); @@ -103,9 +101,7 @@ sub _build_name { $name; } -sub _build_version { - my ($self) = @_; - +sub _build_version ($self) { my $version = $self->_version_override; for my $plugin ($self->plugins_with(-VersionProvider)) { @@ -156,9 +152,7 @@ has release_status => ( builder => '_build_release_status', ); -sub _build_release_status { - my ($self) = @_; - +sub _build_release_status ($self) { # environment variables override completely return $self->_release_status_from_env if $self->_release_status_from_env; @@ -190,7 +184,6 @@ has _release_status_from_env => ( ); sub _build_release_status_from_env { - my ($self) = @_; return $ENV{RELEASE_STATUS} if $ENV{RELEASE_STATUS}; return $ENV{TRIAL} ? 'testing' : ''; } @@ -206,9 +199,7 @@ has abstract => ( is => 'rw', isa => 'Str', lazy => 1, - default => sub { - my ($self) = @_; - + default => sub ($self, @) { unless ($self->main_module) { die "no abstract given and no main_module found; make sure your main module is in ./lib\n"; } @@ -255,9 +246,7 @@ has main_module => ( isa => 'Dist::Zilla::Role::File', lazy => 1, init_arg => undef, - default => sub { - my ($self) = @_; - + default => sub ($self, @) { my $file; my $guess; @@ -327,9 +316,7 @@ has license => ( }, ); -sub _build_license { - my ($self) = @_; - +sub _build_license ($self) { my $license_class = $self->_license_class; my $copyright_holder = $self->_copyright_holder; my $copyright_year = $self->_copyright_year; @@ -403,8 +390,8 @@ has _license_class => ( lazy => 1, init_arg => 'license', clearer => '_clear_license_class', - default => sub { - my $stash = $_[0]->stash_named('%Rights'); + default => sub ($self, @) { + my $stash = $self->stash_named('%Rights'); $stash && return $stash->license_class; return; } @@ -416,8 +403,8 @@ has _copyright_holder => ( lazy => 1, init_arg => 'copyright_holder', clearer => '_clear_copyright_holder', - default => sub { - return unless my $stash = $_[0]->stash_named('%Rights'); + default => sub ($self, @) { + return unless my $stash = $self->stash_named('%Rights'); $stash && return $stash->copyright_holder; return; } @@ -429,7 +416,7 @@ has _copyright_year => ( lazy => 1, init_arg => 'copyright_year', clearer => '_clear_copyright_year', - default => sub { + default => sub ($self, @) { # Oh man. This is a terrible idea! I mean, what if by the code gets run # around like Dec 31, 23:59:59.9 and by the time the default gets called # it's the next year but the default was already set up? Oh man. That @@ -437,7 +424,7 @@ has _copyright_year => ( # but think of the performance hit! I guess we'll have to suffer through # this until we can optimize the code to not take .1s to run, right? -- # rjbs, 2008-06-13 - my $stash = $_[0]->stash_named('%Rights'); + my $stash = $self->stash_named('%Rights'); my $year = $stash && $stash->copyright_year; return( $year // (localtime)[5] + 1900 ); } @@ -463,9 +450,7 @@ has authors => ( lazy => 1, traits => [ 'Array' ], reader => '_authors', - default => sub { - my ($self) = @_; - + default => sub ($self) { if (my $stash = $self->stash_named('%User')) { return [ $stash->authors ]; } @@ -515,8 +500,7 @@ has files => ( default => sub { [] }, ); -sub prune_file { - my ($self, $file) = @_; +sub prune_file ($self, $file) { my @files = $self->files->@*; for my $i (0 .. $#files) { @@ -566,9 +550,8 @@ has _override_is_trial => ( default => 0, ); -sub _build_is_trial { - my ($self) = @_; - return $self->release_status =~ /\A(?:testing|unstable)\z/ ? 1 : 0; +sub _build_is_trial ($self) { + return $self->release_status =~ /\A(?:testing|unstable)\z/ ? 1 : 0; } =attr plugins @@ -622,9 +605,7 @@ has distmeta => ( builder => '_build_distmeta', ); -sub _build_distmeta { - my ($self) = @_; - +sub _build_distmeta ($self) { require CPAN::Meta::Merge; my $meta_merge = CPAN::Meta::Merge->new(default_version => 2); my $meta = {}; @@ -685,8 +666,7 @@ has prereqs => ( =cut -sub plugin_named { - my ($self, $name) = @_; +sub plugin_named ($self, $name) { my $plugin = first { $_->plugin_name eq $name } $self->plugins; return $plugin if $plugin; @@ -703,9 +683,7 @@ replaced with "Dist::Zilla::Role::" =cut -sub plugins_with { - my ($self, $role) = @_; - +sub plugins_with ($self, $role) { $role =~ s/^-/Dist::Zilla::Role::/; my @plugins = grep { $_->does($role) } $self->plugins; @@ -732,9 +710,7 @@ found, an exception will be raised. =cut -sub find_files { - my ($self, $finder_name) = @_; - +sub find_files ($self, $finder_name) { $self->log_fatal("no plugin named $finder_name found") unless my $plugin = $self->plugin_named($finder_name); @@ -744,9 +720,7 @@ sub find_files { $plugin->find_files; } -sub _check_dupe_files { - my ($self) = @_; - +sub _check_dupe_files ($self) { my %files_named; my @dupes; for my $file ($self->files->@*) { @@ -770,9 +744,7 @@ sub _check_dupe_files { Carp::croak("aborting; duplicate files would be produced"); } -sub _write_out_file { - my ($self, $file, $build_root) = @_; - +sub _write_out_file ($self, $file, $build_root) { # Okay, this is a bit much, until we have ->debug. -- rjbs, 2008-06-13 # $self->log("writing out " . $file->name); @@ -809,13 +781,12 @@ has logger => ( isa => 'Log::Dispatchouli::Proxy', # could be duck typed, I guess lazy => 1, handles => [ qw(log log_debug log_fatal) ], - default => sub { - $_[0]->chrome->logger->proxy({ proxy_prefix => '[DZ] ' }) + default => sub ($self, @) { + $self->chrome->logger->proxy({ proxy_prefix => '[DZ] ' }) }, ); -around dump_config => sub { - my ($orig, $self) = @_; +around dump_config => sub ($orig, $self) { my $config = $self->$orig; $config->{is_trial} = $self->is_trial; return $config; @@ -845,9 +816,7 @@ stash (from the user's global configuration). =cut -sub stash_named { - my ($self, $name) = @_; - +sub stash_named ($self, $name) { return $self->_local_stashes->{ $name } if $self->_local_stashes->{$name}; return $self->_global_stashes->{ $name }; } diff --git a/lib/Dist/Zilla/App.pm b/lib/Dist/Zilla/App.pm index 2b24d198f..890118603 100644 --- a/lib/Dist/Zilla/App.pm +++ b/lib/Dist/Zilla/App.pm @@ -12,9 +12,7 @@ use Try::Tiny; $Carp::Internal{'Module::Runtime'} = 1; -sub global_opt_spec { - my ($self) = @_; - +sub global_opt_spec ($self) { return ( [ "verbose|v", "log additional output" ], [ "verbose-plugin|V=s@", "log additional output from some plugins only" ], @@ -25,9 +23,7 @@ sub global_opt_spec { ); } -sub _build_global_stashes { - my ($self) = @_; - +sub _build_global_stashes ($self) { return $self->{__global_stashes__} if $self->{__global_stashes__}; # tests shouldn't depend on the user's configuration @@ -100,8 +96,7 @@ been constructed, one will be by calling C<< Dist::Zilla->from_config >>. =cut -sub chrome { - my ($self) = @_; +sub chrome ($self) { require Dist::Zilla::Chrome::Term; return $self->{__chrome__} if $self->{__chrome__}; @@ -119,9 +114,7 @@ sub chrome { return $self->{__chrome__}; } -sub zilla { - my ($self) = @_; - +sub zilla ($self) { require Dist::Zilla::Dist::Builder; return $self->{'' . __PACKAGE__}{zilla} ||= do { diff --git a/lib/Dist/Zilla/App/Command.pm b/lib/Dist/Zilla/App/Command.pm index d0c98d2d9..a773ade35 100644 --- a/lib/Dist/Zilla/App/Command.pm +++ b/lib/Dist/Zilla/App/Command.pm @@ -16,9 +16,7 @@ been constructed, one will be by calling C<< Dist::Zilla->from_config >>. =cut -sub zilla { - return $_[0]->app->zilla; -} +sub zilla ($self) { $self->app->zilla } =method log @@ -26,8 +24,8 @@ This method calls the C method of the application's chrome. =cut -sub log { - $_[0]->app->chrome->logger->log($_[1]); +sub log ($self, $what) { + $self->app->chrome->logger->log($what); } 1; diff --git a/lib/Dist/Zilla/App/Command/add.pm b/lib/Dist/Zilla/App/Command/add.pm index 655be28b4..7d79b59b9 100644 --- a/lib/Dist/Zilla/App/Command/add.pm +++ b/lib/Dist/Zilla/App/Command/add.pm @@ -34,9 +34,7 @@ sub opt_spec { # [ 'module|m=s@', 'module(s) to create; may be given many times' ], } -sub validate_args { - my ($self, $opt, $args) = @_; - +sub validate_args ($self, $opt, $args) { require MooseX::Types::Perl; $self->usage_error('dzil add takes one or more arguments') if @$args < 1; @@ -47,9 +45,7 @@ sub validate_args { } } -sub execute { - my ($self, $opt, $arg) = @_; - +sub execute ($self, $opt, $arg) { my $zilla = $self->zilla; my $dist = $zilla->name; diff --git a/lib/Dist/Zilla/App/Command/authordeps.pm b/lib/Dist/Zilla/App/Command/authordeps.pm index 2c156b6c0..0ee7a9a7d 100644 --- a/lib/Dist/Zilla/App/Command/authordeps.pm +++ b/lib/Dist/Zilla/App/Command/authordeps.pm @@ -30,9 +30,7 @@ sub opt_spec { ); } -sub execute { - my ($self, $opt, $arg) = @_; - +sub execute ($self, $opt, $arg) { require Dist::Zilla::Path; require Dist::Zilla::Util::AuthorDeps; diff --git a/lib/Dist/Zilla/App/Command/build.pm b/lib/Dist/Zilla/App/Command/build.pm index a6a03eff4..78de5d778 100644 --- a/lib/Dist/Zilla/App/Command/build.pm +++ b/lib/Dist/Zilla/App/Command/build.pm @@ -88,9 +88,7 @@ necessary, the directory will be created. An archive will not be created. =cut -sub execute { - my ($self, $opt, $args) = @_; - +sub execute ($self, $opt, $args) { if ($opt->in) { require Path::Tiny; die qq{using "--in ." would destroy your working directory!\n} diff --git a/lib/Dist/Zilla/App/Command/clean.pm b/lib/Dist/Zilla/App/Command/clean.pm index 2e8ccabc1..6e36f87e9 100644 --- a/lib/Dist/Zilla/App/Command/clean.pm +++ b/lib/Dist/Zilla/App/Command/clean.pm @@ -32,9 +32,7 @@ Nothing is removed; instead, everything that would be removed will be listed. sub abstract { 'clean up after build, test, or install' } -sub execute { - my ($self, $opt, $arg) = @_; - +sub execute ($self, $opt, $arg) { $self->zilla->clean($opt->dry_run); } diff --git a/lib/Dist/Zilla/App/Command/install.pm b/lib/Dist/Zilla/App/Command/install.pm index 55214ab93..640f95376 100644 --- a/lib/Dist/Zilla/App/Command/install.pm +++ b/lib/Dist/Zilla/App/Command/install.pm @@ -45,9 +45,7 @@ Dist::Zilla. =cut -sub execute { - my ($self, $opt, $arg) = @_; - +sub execute ($self, $opt, $arg) { $self->zilla->install({ $opt->install_command ? (install_command => [ $opt->install_command ]) diff --git a/lib/Dist/Zilla/App/Command/listdeps.pm b/lib/Dist/Zilla/App/Command/listdeps.pm index 76fe44c23..77005ae21 100644 --- a/lib/Dist/Zilla/App/Command/listdeps.pm +++ b/lib/Dist/Zilla/App/Command/listdeps.pm @@ -82,9 +82,7 @@ sub opt_spec { [ 'omit-core=s', 'Omit dependencies that are shipped with the specified version of perl' ], } -sub prereqs { - my ($self, $zilla) = @_; - +sub prereqs ($self, $zilla) { $_->before_build for $zilla->plugins_with(-BeforeBuild); $_->gather_files for $zilla->plugins_with(-FileGatherer); $_->set_file_encodings for $zilla->plugins_with(-EncodingProvider); @@ -98,8 +96,7 @@ sub prereqs { my @phases = qw/configure build test runtime develop/; my @relationships = qw/requires recommends suggests/; -sub filter_core { - my ($prereqs, $core_version) = @_; +my sub filter_core ($prereqs, $core_version) { $core_version = sprintf '%7.6f', $core_version if $core_version >= 5.010; $prereqs = $prereqs->clone if $prereqs->is_finalized; require Module::CoreList; @@ -115,9 +112,7 @@ sub filter_core { return $prereqs; } -sub extract_dependencies { - my ($self, $zilla, $phases, $opt) = @_; - +sub extract_dependencies ($self, $zilla, $phases, $opt) { my $prereqs = $self->prereqs($zilla); $prereqs = filter_core($prereqs, $opt->omit_core) if $opt->omit_core; @@ -151,9 +146,7 @@ sub extract_dependencies { return map { $_ => $versions->{$_} } @required; } -sub execute { - my ($self, $opt, $arg) = @_; - +sub execute ($self, $opt, $arg) { $self->app->chrome->logger->mute; my @phases = qw(build test configure runtime); diff --git a/lib/Dist/Zilla/App/Command/new.pm b/lib/Dist/Zilla/App/Command/new.pm index 4fad5eede..6e9850eee 100644 --- a/lib/Dist/Zilla/App/Command/new.pm +++ b/lib/Dist/Zilla/App/Command/new.pm @@ -55,9 +55,7 @@ sub opt_spec { # [ 'module|m=s@', 'module(s) to create; may be given many times' ], } -sub validate_args { - my ($self, $opt, $args) = @_; - +sub validate_args ($self, $opt, $args) { require MooseX::Types::Perl; $self->usage_error('dzil new takes exactly one argument') if @$args != 1; @@ -73,9 +71,7 @@ sub validate_args { $args->[0] = $name; } -sub execute { - my ($self, $opt, $arg) = @_; - +sub execute ($self, $opt, $arg) { my $dist = $arg->[0]; require Dist::Zilla::Dist::Minter; diff --git a/lib/Dist/Zilla/App/Command/nop.pm b/lib/Dist/Zilla/App/Command/nop.pm index 388951719..007baa246 100644 --- a/lib/Dist/Zilla/App/Command/nop.pm +++ b/lib/Dist/Zilla/App/Command/nop.pm @@ -26,10 +26,6 @@ sub description { "It is sometimes useful for diagnostic purposes." } -sub execute { - my ($self, $opt, $arg) = @_; - - $self->zilla; -} +sub execute ($self, @) { $self->zilla } 1; diff --git a/lib/Dist/Zilla/App/Command/release.pm b/lib/Dist/Zilla/App/Command/release.pm index 41d2d1898..a4f412e61 100644 --- a/lib/Dist/Zilla/App/Command/release.pm +++ b/lib/Dist/Zilla/App/Command/release.pm @@ -26,9 +26,7 @@ sub opt_spec { [ 'trial' => 'build a trial release that PAUSE will not index' ], } -sub execute { - my ($self, $opt, $arg) = @_; - +sub execute ($self, $opt, $arg) { my $zilla; { # isolate changes to RELEASE_STATUS to zilla construction diff --git a/lib/Dist/Zilla/App/Command/run.pm b/lib/Dist/Zilla/App/Command/run.pm index 9f1e2b697..0ba083bbc 100644 --- a/lib/Dist/Zilla/App/Command/run.pm +++ b/lib/Dist/Zilla/App/Command/run.pm @@ -56,9 +56,7 @@ sub usage_desc { return '%c run %o [ command [ arg1 arg2 ... ] ]'; } -sub execute { - my ($self, $opt, $args) = @_; - +sub execute ($self, $opt, $args) { unless (@$args) { my $envname = $^O eq 'MSWin32' ? 'COMSPEC' : 'SHELL'; unless ($ENV{$envname}) { diff --git a/lib/Dist/Zilla/App/Command/setup.pm b/lib/Dist/Zilla/App/Command/setup.pm index a38b5cea0..d5e1c86dc 100644 --- a/lib/Dist/Zilla/App/Command/setup.pm +++ b/lib/Dist/Zilla/App/Command/setup.pm @@ -30,15 +30,11 @@ sub description { "a basic Dist::Zilla configuration in ~/.dzil/config.ini" } -sub validate_args { - my ($self, $opt, $args) = @_; - +sub validate_args ($self, $opt, $args) { $self->usage_error('too many arguments') if @$args != 0; } -sub execute { - my ($self, $opt, $arg) = @_; - +sub execute ($self, $opt, $arg) { my $chrome = $self->app->chrome; require Dist::Zilla::Util; diff --git a/lib/Dist/Zilla/App/Command/smoke.pm b/lib/Dist/Zilla/App/Command/smoke.pm index aef308614..bb6390e56 100644 --- a/lib/Dist/Zilla/App/Command/smoke.pm +++ b/lib/Dist/Zilla/App/Command/smoke.pm @@ -56,11 +56,9 @@ This will run the test suite with AUTHOR_TESTING=1 sub abstract { 'smoke your dist' } -sub execute { - my ($self, $opt, $arg) = @_; - - local $ENV{RELEASE_TESTING} = 1 if $opt->release; - local $ENV{AUTHOR_TESTING} = 1 if $opt->author; +sub execute ($self, $opt, $arg) { + local $ENV{RELEASE_TESTING} = 1 if $opt->release; + local $ENV{AUTHOR_TESTING} = 1 if $opt->author; local $ENV{AUTOMATED_TESTING} = 1 if $opt->automated; $self->zilla->test; diff --git a/lib/Dist/Zilla/App/Command/test.pm b/lib/Dist/Zilla/App/Command/test.pm index 69a937c4d..212ca1ba8 100644 --- a/lib/Dist/Zilla/App/Command/test.pm +++ b/lib/Dist/Zilla/App/Command/test.pm @@ -67,13 +67,11 @@ Equivalent to --release --automated --extended --author sub abstract { 'test your dist' } -sub execute { - my ($self, $opt, $arg) = @_; - - local $ENV{RELEASE_TESTING} = 1 if $opt->release or $opt->all; - local $ENV{AUTHOR_TESTING} = 1 if $opt->author or $opt->all; - local $ENV{AUTOMATED_TESTING} = 1 if $opt->automated or $opt->all; - local $ENV{EXTENDED_TESTING} = 1 if $opt->extended or $opt->all; +sub execute ($self, $opt, $arg) { + local $ENV{RELEASE_TESTING} = 1 if $opt->all or $opt->release; + local $ENV{AUTHOR_TESTING} = 1 if $opt->all or $opt->author; + local $ENV{AUTOMATED_TESTING} = 1 if $opt->all or $opt->automated; + local $ENV{EXTENDED_TESTING} = 1 if $opt->all or $opt->extended; $self->zilla->test({ $opt->keep_build_dir @@ -82,9 +80,9 @@ sub execute { $opt->jobs ? (jobs => $opt->jobs) : (), - $opt->test_verbose - ? (test_verbose => $opt->test_verbose) - : (), + $opt->test_verbose + ? (test_verbose => $opt->test_verbose) + : (), }); } diff --git a/lib/Dist/Zilla/App/Command/version.pm b/lib/Dist/Zilla/App/Command/version.pm index 522ac78a7..1139ddccb 100644 --- a/lib/Dist/Zilla/App/Command/version.pm +++ b/lib/Dist/Zilla/App/Command/version.pm @@ -21,11 +21,9 @@ Print dzil version =cut -sub version_for_display { - my $version_pkg = $_[0]->version_package; - my $version = ( $version_pkg->VERSION ? - $version_pkg->VERSION : - 'dev' ); +sub version_for_display ($self) { + my $version_pkg = $self->version_package; + my $version = $version_pkg->VERSION // 'dev'; } 1; diff --git a/lib/Dist/Zilla/App/Tester.pm b/lib/Dist/Zilla/App/Tester.pm index 753ed6d10..eaab38b6f 100644 --- a/lib/Dist/Zilla/App/Tester.pm +++ b/lib/Dist/Zilla/App/Tester.pm @@ -23,10 +23,7 @@ use Sub::Exporter -setup => { sub result_class { 'Dist::Zilla::App::Tester::Result' } -sub test_dzil { - my ($self, $source, $argv, $arg) = @_; - $arg ||= {}; - +sub test_dzil ($self, $source, $argv, $arg = {}) { local @INC = map {; ref($_) ? $_ : File::Spec->rel2abs($_) } @INC; my $tmpdir = $arg->{tempdir} || File::Temp::tempdir(CLEANUP => 1); @@ -49,33 +46,27 @@ sub test_dzil { BEGIN { our @ISA = qw(App::Cmd::Tester::Result); } - sub tempdir { - my ($self) = @_; + sub tempdir ($self) { return $self->{tempdir}; } - sub zilla { - my ($self) = @_; + sub zilla ($self) { return $self->app->zilla; } - sub build_dir { - my ($self) = @_; + sub build_dir ($self) { return $self->zilla->built_in; } - sub clear_log_events { - my ($self) = @_; + sub clear_log_events ($self) { $self->app->zilla->logger->logger->clear_events; } - sub log_events { - my ($self) = @_; + sub log_events ($self) { $self->app->zilla->logger->logger->events; } - sub log_messages { - my ($self) = @_; + sub log_messages ($self) { [ map {; $_->{message} } $self->app->zilla->logger->logger->events->@* ]; } } @@ -88,15 +79,15 @@ This module exports only one function, C. This function is used to test L. It receives two mandatory options. The first is the path to a Dist::Zilla-based -distribution. The second, an array reference to a list of arguments. +distribution. The second, an array reference to a list of arguments. The third optional argument is a hash reference, with further options. At the moment the only supported option is c. -It returns a L, that inherits from +It returns a L, that inherits from L. Typical methods called from this result are: -=over 4 +=over 4 =item C diff --git a/lib/Dist/Zilla/Chrome/Term.pm b/lib/Dist/Zilla/Chrome/Term.pm index ba484b34c..59b6f186e 100644 --- a/lib/Dist/Zilla/Chrome/Term.pm +++ b/lib/Dist/Zilla/Chrome/Term.pm @@ -27,8 +27,7 @@ has logger => ( builder => '_build_logger', ); -sub _build_logger { - my $self = shift; +sub _build_logger ($self, @) { my $enc = $self->term_enc; if ($enc && Encode::resolve_alias($enc)) { @@ -66,9 +65,7 @@ has term_enc => ( }, ); -sub prompt_str { - my ($self, $prompt, $arg) = @_; - $arg ||= {}; +sub prompt_str ($self, $prompt, $arg = {}) { my $default = $arg->{default}; my $check = $arg->{check}; @@ -107,9 +104,7 @@ sub prompt_str { return $input; } -sub prompt_yn { - my ($self, $prompt, $arg) = @_; - $arg ||= {}; +sub prompt_yn ($self, $prompt, $arg = {}) { my $default = $arg->{default}; if (! $self->_isa_tty) { @@ -135,8 +130,7 @@ sub _isa_tty { return $isa_tty; } -sub prompt_any_key { - my ($self, $prompt) = @_; +sub prompt_any_key ($self, $prompt) { $prompt ||= 'press any key to continue'; my $isa_tty = $self->_isa_tty; diff --git a/lib/Dist/Zilla/Chrome/Test.pm b/lib/Dist/Zilla/Chrome/Test.pm index 9e4bf439e..d20db9f72 100644 --- a/lib/Dist/Zilla/Chrome/Test.pm +++ b/lib/Dist/Zilla/Chrome/Test.pm @@ -49,10 +49,7 @@ has response_for => ( }, ); -sub prompt_str { - my ($self, $prompt, $arg) = @_; - $arg ||= {}; - +sub prompt_str ($self, $prompt, $arg = {}) { my $response = $self->response_for($prompt); $response = shift @$response if ref $response; @@ -65,10 +62,8 @@ sub prompt_str { return $response; } -sub prompt_yn { - my $self = shift; - - return OneZero->coerce( $self->prompt_str(@_) ); +sub prompt_yn ($self, @rest) { + return OneZero->coerce( $self->prompt_str(@rest) ); } sub prompt_any_key { return } diff --git a/lib/Dist/Zilla/Dist/Builder.pm b/lib/Dist/Zilla/Dist/Builder.pm index 84ba9fbf7..fc19766db 100644 --- a/lib/Dist/Zilla/Dist/Builder.pm +++ b/lib/Dist/Zilla/Dist/Builder.pm @@ -34,10 +34,7 @@ Valid arguments are: =cut -sub from_config { - my ($class, $arg) = @_; - $arg ||= {}; - +sub from_config ($class, $arg = {}) { my $root = path($arg->{dist_root} || '.'); my $sequence = $class->_load_config({ @@ -54,16 +51,14 @@ sub from_config { return $self; } -sub _setup_default_plugins { - my ($self) = @_; +sub _setup_default_plugins ($self) { unless ($self->plugin_named(':InstallModules')) { require Dist::Zilla::Plugin::FinderCode; my $plugin = Dist::Zilla::Plugin::FinderCode->new({ plugin_name => ':InstallModules', zilla => $self, style => 'grep', - code => sub { - my ($file, $self) = @_; + code => sub ($file, $) { local $_ = $file->name; return 1 if m{\Alib/} and m{\.(pm|pod)$}; return; @@ -79,8 +74,7 @@ sub _setup_default_plugins { plugin_name => ':IncModules', zilla => $self, style => 'grep', - code => sub { - my ($file, $self) = @_; + code => sub ($file, $) { local $_ = $file->name; return 1 if m{\Ainc/} and m{\.pm$}; return; @@ -96,7 +90,7 @@ sub _setup_default_plugins { plugin_name => ':TestFiles', zilla => $self, style => 'grep', - code => sub { local $_ = $_->name; m{\At/} }, + code => sub { $_->name =~ m{\At/} }, }); $self->_add_plugin($plugin); @@ -120,9 +114,9 @@ sub _setup_default_plugins { plugin_name => ':ExecFiles', zilla => $self, style => 'list', - code => sub { + code => sub ($file, @) { my @files = uniq map {; $_->find_files->@* } - $_[0]->zilla->plugins_with(-ExecFiles); + $file->zilla->plugins_with(-ExecFiles); return \@files; }, @@ -156,18 +150,18 @@ sub _setup_default_plugins { plugin_name => ':ShareFiles', zilla => $self, style => 'list', - code => sub { - my $self = shift; - my $map = $self->zilla->_share_dir_map; + code => sub ($file, @) { + my $zilla = $file->zilla; + my $map = $zilla->_share_dir_map; my @files; if ( $map->{dist} ) { push @files, grep {; $_->name =~ m{\A\Q$map->{dist}\E/} } - $self->zilla->files->@*; + $zilla->files->@*; } if ( my $mod_map = $map->{module} ) { for my $mod ( keys %$mod_map ) { push @files, grep { $_->name =~ m{\A\Q$mod_map->{$mod}\E/} } - $self->zilla->files->@*; + $zilla->files->@*; } } return \@files; @@ -183,8 +177,7 @@ sub _setup_default_plugins { plugin_name => ':MainModule', zilla => $self, style => 'grep', - code => sub { - my ($file, $self) = @_; + code => sub ($file, $self) { local $_ = $file->name; return 1 if $_ eq $self->zilla->main_module->name; return; @@ -227,9 +220,7 @@ has _share_dir_map => ( builder => '_build_share_dir_map', ); -sub _build_share_dir_map { - my ($self) = @_; - +sub _build_share_dir_map ($self) { my $share_dir_map = {}; for my $plugin ($self->plugins_with(-ShareDir)) { @@ -254,10 +245,7 @@ sub _build_share_dir_map { } -sub _load_config { - my ($class, $arg) = @_; - $arg ||= {}; - +sub _load_config ($class, $arg = {}) { my $config_class = $arg->{config_class} ||= 'Dist::Zilla::MVP::Reader::Finder'; @@ -335,9 +323,7 @@ for the preposition! sub build { $_[0]->build_in } -sub build_in { - my ($self, $root) = @_; - +sub build_in ($self, $root = undef) { $self->log_fatal("tried to build with a minter") if $self->isa('Dist::Zilla::Dist::Minter'); @@ -415,9 +401,7 @@ sub ensure_built { $_[0]->ensure_built_in; } -sub ensure_built_in { - my ($self, $root) = @_; - +sub ensure_built_in ($self, $root = undef) { # $root ||= $self->name . q{-} . $self->version; return $self->built_in if $self->built_in and (!$root or ($self->built_in eq $root)); @@ -436,8 +420,7 @@ does not include C<-TRIAL>, even if building a trial dist. =cut -sub dist_basename { - my ($self) = @_; +sub dist_basename ($self) { return join(q{}, $self->name, '-', @@ -456,8 +439,7 @@ might not exist. =cut -sub archive_filename { - my ($self) = @_; +sub archive_filename ($self) { return join(q{}, $self->dist_basename, ( $self->is_trial && $self->version !~ /_/ ? '-TRIAL' : '' ), @@ -474,9 +456,7 @@ tarball of the build directory in the current directory. =cut -sub build_archive { - my ($self) = @_; - +sub build_archive ($self) { my $built_in = $self->ensure_built; my $basename = $self->dist_basename; @@ -499,9 +479,7 @@ sub build_archive { return $file; } -sub _build_archive { - my ($self, $built_in, $basename, $basedir) = @_; - +sub _build_archive ($self, $built_in, $basename, $basedir) { $self->log("building archive with Archive::Tar; install Archive::Tar::Wrapper 0.15 or newer for improved speed"); require Archive::Tar; @@ -531,9 +509,7 @@ sub _build_archive { return $archive; } -sub _build_archive_with_wrapper { - my ($self, $built_in, $basename, $basedir) = @_; - +sub _build_archive_with_wrapper ($self, $built_in, $basename, $basedir) { $self->log("building archive with Archive::Tar::Wrapper"); my $archive = Archive::Tar::Wrapper->new; @@ -554,9 +530,7 @@ sub _build_archive_with_wrapper { return $archive; } -sub _prep_build_root { - my ($self, $build_root) = @_; - +sub _prep_build_root ($self, $build_root = undef) { $build_root = path($build_root || $self->dist_basename); $build_root->mkpath unless -d $build_root; @@ -592,9 +566,7 @@ by the loaded plugins. =cut -sub release { - my $self = shift; - +sub release ($self) { Carp::croak("you can't release without any Releaser plugins") unless my @releasers = $self->plugins_with(-Releaser); @@ -621,9 +593,7 @@ like matching the glob C. =cut -sub clean { - my ($self, $dry_run) = @_; - +sub clean ($self, $dry_run) { require File::Path; for my $x (grep { -e } '.build', glob($self->name . '-*')) { if ($dry_run) { @@ -644,9 +614,7 @@ subdirectory. It will return the path for the temporary build location. =cut -sub ensure_built_in_tmpdir { - my $self = shift; - +sub ensure_built_in_tmpdir ($self) { require File::Temp; my $build_root = path('.build'); @@ -662,9 +630,7 @@ sub ensure_built_in_tmpdir { return ($target, $latest, $previous); } -sub _create_build_symlinks { - my ($self, $symlink_root, $build_target) = @_; - +sub _create_build_symlinks ($self, $symlink_root, $build_target) { $symlink_root->mkpath unless -d $symlink_root; my $os_has_symlinks = eval { symlink("",""); 1 }; @@ -710,10 +676,7 @@ Valid arguments are: =cut -sub install { - my ($self, $arg) = @_; - $arg ||= {}; - +sub install ($self, $arg = {}) { my ($target, $latest) = $self->ensure_built_in_tmpdir; my $ok = eval { @@ -759,9 +722,7 @@ C<\%arg> may be omitted. Otherwise, valid arguments are: =cut -sub test { - my ($self, $arg) = @_; - +sub test ($self, $arg = {}) { Carp::croak("you can't test without any TestRunner plugins") unless my @testers = $self->plugins_with(-TestRunner); @@ -791,9 +752,7 @@ does it clean up C<$directory> afterwards. =cut -sub run_tests_in { - my ($self, $target, $arg) = @_; - +sub run_tests_in ($self, $target, $arg = {}) { Carp::croak("you can't test without any TestRunner plugins") unless my @testers = $self->plugins_with(-TestRunner); @@ -815,9 +774,7 @@ non-zero, the directory will be left in place. =cut -sub run_in_build { - my ($self, $cmd, $arg) = @_; - +sub run_in_build ($self, $cmd, $arg) { my @runners = $self->plugins_with(-BuildRunner); $self->log_fatal("you can't build without any BuildRunner plugins") @@ -866,9 +823,7 @@ sub run_in_build { # C<-BuildRunner> plugins to generate it. Useful for commands that operate on # F, such as C or C. -sub _ensure_blib { - my ($self) = @_; - +sub _ensure_blib ($self) { unless ( -d 'blib' ) { my @builders = $self->plugins_with( -BuildRunner ); $self->log_fatal("no BuildRunner plugins specified") unless @builders; diff --git a/lib/Dist/Zilla/Dist/Minter.pm b/lib/Dist/Zilla/Dist/Minter.pm index 3d5d2e21d..3ffc44384 100644 --- a/lib/Dist/Zilla/Dist/Minter.pm +++ b/lib/Dist/Zilla/Dist/Minter.pm @@ -12,9 +12,7 @@ use Module::Runtime 'require_module'; use namespace::autoclean; -sub _setup_default_plugins { - my ($self) = @_; - +sub _setup_default_plugins ($self) { unless ($self->plugin_named(':DefaultModuleMaker')) { require Dist::Zilla::Plugin::TemplateModule; my $plugin = Dist::Zilla::Plugin::TemplateModule->new({ @@ -26,10 +24,7 @@ sub _setup_default_plugins { } } -sub _new_from_profile { - my ($class, $profile_data, $arg) = @_; - $arg ||= {}; - +sub _new_from_profile ($class, $profile_data, $arg = {}) { my $config_class = $arg->{config_class} ||= 'Dist::Zilla::MVP::Reader::Finder'; require_module($config_class); @@ -83,9 +78,7 @@ sub _new_from_profile { return $self; } -sub _mint_target_dir { - my ($self) = @_; - +sub _mint_target_dir ($self) { my $name = $self->name; my $dir = path($name); $self->log_fatal("./$name already exists") if -e $dir; @@ -93,9 +86,7 @@ sub _mint_target_dir { return $dir = $dir->absolute; } -sub mint_dist { - my ($self, $arg) = @_; - +sub mint_dist ($self, $arg = {}) { my $name = $self->name; my $dir = $self->_mint_target_dir; diff --git a/lib/Dist/Zilla/File/FromCode.pm b/lib/Dist/Zilla/File/FromCode.pm index 57a3385ed..5653da91c 100644 --- a/lib/Dist/Zilla/File/FromCode.pm +++ b/lib/Dist/Zilla/File/FromCode.pm @@ -1,11 +1,11 @@ package Dist::Zilla::File::FromCode; # ABSTRACT: a file whose content is (re-)built on demand -use Dist::Zilla::Dialect; - use Moose; use Moose::Util::TypeConstraints; +use Dist::Zilla::Dialect; + use namespace::autoclean; =head1 DESCRIPTION @@ -53,8 +53,7 @@ has encoding => ( builder => "_build_encoding", ); -sub _build_encoding { - my ($self) = @_; +sub _build_encoding ($self) { return $self->code_return_type eq 'text' ? 'UTF-8' : 'bytes'; } @@ -62,10 +61,8 @@ sub _build_encoding { =cut -sub content { - my ($self) = @_; - - confess("cannot set content of a FromCode file") if @_ > 1; +sub content ($self, @rest) { + confess("cannot set content of a FromCode file") if @rest; my $code = $self->code; my $result = $self->$code; @@ -82,10 +79,8 @@ sub content { =cut -sub encoded_content { - my ($self) = @_; - - confess( "cannot set encoded_content of a FromCode file" ) if @_ > 1; +sub encoded_content ($self, @rest) { + confess( "cannot set encoded_content of a FromCode file" ) if @rest; my $code = $self->code; my $result = $self->$code; @@ -98,8 +93,7 @@ sub encoded_content { } } -sub _set_added_by { - my ($self, $value) = @_; +sub _set_added_by ($self, $value) { return $self->_push_added_by(sprintf("%s from coderef added by %s", $self->code_return_type, $value)); }; diff --git a/lib/Dist/Zilla/File/OnDisk.pm b/lib/Dist/Zilla/File/OnDisk.pm index 7feeffe96..4b865e7d5 100644 --- a/lib/Dist/Zilla/File/OnDisk.pm +++ b/lib/Dist/Zilla/File/OnDisk.pm @@ -1,10 +1,10 @@ package Dist::Zilla::File::OnDisk; # ABSTRACT: a file that comes from your filesystem -use Dist::Zilla::Dialect; - use Moose; +use Dist::Zilla::Dialect; + use Dist::Zilla::Path; use namespace::autoclean; @@ -26,13 +26,11 @@ has _original_name => ( init_arg => undef, ); -after 'BUILD' => sub { - my ($self) = @_; +after 'BUILD' => sub ($self, @) { $self->_set_original_name( $self->name ); }; -sub _build_encoded_content { - my ($self) = @_; +sub _build_encoded_content ($self) { return path($self->_original_name)->slurp_raw; } diff --git a/lib/Dist/Zilla/MVP/Assembler.pm b/lib/Dist/Zilla/MVP/Assembler.pm index 279618972..d9b524efb 100644 --- a/lib/Dist/Zilla/MVP/Assembler.pm +++ b/lib/Dist/Zilla/MVP/Assembler.pm @@ -44,25 +44,22 @@ has logger => ( isa => 'Log::Dispatchouli::Proxy', # could be duck typed, I guess lazy => 1, handles => [ qw(log log_debug log_fatal) ], - default => sub { - $_[0]->chrome->logger->proxy({ proxy_prefix => '[DZ] ' }) + default => sub ($self, @) { + $self->chrome->logger->proxy({ proxy_prefix => '[DZ] ' }) }, ); -sub expand_package { +sub expand_package ($self, $pkg) { return scalar Dist::Zilla::Util->expand_config_package_name($_[1]); } -sub package_bundle_method { - my ($self, $pkg) = @_; +sub package_bundle_method ($self, $pkg) { return unless $pkg->isa('Moose::Object') and $pkg->does('Dist::Zilla::Role::PluginBundle'); return 'bundle_config'; } -before add_value => sub { - my ($self, $name) = @_; - +before add_value => sub ($self, $name, $) { return unless $name =~ /\A(?:plugin_name|zilla)\z/; my $section_name = $self->current_section->name; diff --git a/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm b/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm index a639c7587..6e41370a9 100644 --- a/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm +++ b/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm @@ -35,9 +35,7 @@ already taken, in which case an exception is raised. =cut -sub register_stash { - my ($self, $name, $object) = @_; - +sub register_stash ($self, $name, $object) { # $self->log_fatal("tried to register $name stash entry twice") confess("tried to register $name stash entry twice") if $self->stash_registry->{ $name }; diff --git a/lib/Dist/Zilla/MVP/Assembler/Zilla.pm b/lib/Dist/Zilla/MVP/Assembler/Zilla.pm index 75c46d5c7..5ac471e4b 100644 --- a/lib/Dist/Zilla/MVP/Assembler/Zilla.pm +++ b/lib/Dist/Zilla/MVP/Assembler/Zilla.pm @@ -25,9 +25,7 @@ as the initial section. use MooseX::Types::Perl qw(PackageName); use Dist::Zilla::MVP::RootSection; -sub BUILD { - my ($self) = @_; - +sub BUILD ($self, @) { my $root = Dist::Zilla::MVP::RootSection->new; $self->sequence->add_section($root); } @@ -46,8 +44,7 @@ exception. =cut -sub zilla { - my ($self) = @_; +sub zilla ($self) { $self->sequence->section_named('_')->zilla; } @@ -60,8 +57,7 @@ is already taken, in which case an exception is raised. =cut -sub register_stash { - my ($self, $name, $object) = @_; +sub register_stash ($self, $name, $object) { $self->log_fatal("tried to register $name stash entry twice") if $self->zilla->_local_stashes->{ $name }; diff --git a/lib/Dist/Zilla/MVP/Reader/Perl.pm b/lib/Dist/Zilla/MVP/Reader/Perl.pm index c1374b046..2b2d36287 100644 --- a/lib/Dist/Zilla/MVP/Reader/Perl.pm +++ b/lib/Dist/Zilla/MVP/Reader/Perl.pm @@ -17,9 +17,7 @@ Dist::Zilla::Config reads in the F file for a distribution. sub default_extension { 'pl' } -sub read_into_assembler { - my ($self, $location, $asm) = @_; - +sub read_into_assembler ($self, $location, $asm) { my @input = do File::Spec->rel2abs($location); while (@input and ! ref $input[0]) { my ($key, $value) = (shift(@input), shift(@input)); diff --git a/lib/Dist/Zilla/MVP/RootSection.pm b/lib/Dist/Zilla/MVP/RootSection.pm index 6dc6308e7..a1b671e17 100644 --- a/lib/Dist/Zilla/MVP/RootSection.pm +++ b/lib/Dist/Zilla/MVP/RootSection.pm @@ -4,6 +4,9 @@ package Dist::Zilla::MVP::RootSection; use Moose; extends 'Config::MVP::Section'; +use Moose::Util::TypeConstraints; +use MooseX::LazyRequire; # turns warnings on aaauuugh -- rjbs, 2018-04-23 + use Dist::Zilla::Dialect; use namespace::autoclean; @@ -24,9 +27,7 @@ Those useful defaults are: =cut -use MooseX::LazyRequire; use MooseX::SetOnce; -use Moose::Util::TypeConstraints; has '+name' => (default => '_'); @@ -42,9 +43,7 @@ has zilla => ( lazy_required => 1, ); -after finalize => sub { - my ($self) = @_; - +after finalize => sub ($self, @) { my $assembler = $self->sequence->assembler; my %payload = $self->payload->%*; diff --git a/lib/Dist/Zilla/MVP/Section.pm b/lib/Dist/Zilla/MVP/Section.pm index 01265396c..05ce183b2 100644 --- a/lib/Dist/Zilla/MVP/Section.pm +++ b/lib/Dist/Zilla/MVP/Section.pm @@ -10,9 +10,7 @@ use namespace::autoclean; use Config::MVP::Section 2.200009; # not-installed error with section_name -around add_value => sub { - my ($orig, $self, $name, $value) = @_; - +around add_value => sub ($orig, $self, $name, $value) { if ($name =~ s/\A://) { if ($name eq 'version') { Dist::Zilla::Util->_assert_loaded_class_version_ok( @@ -27,9 +25,7 @@ around add_value => sub { $self->$orig($name, $value); }; -after finalize => sub { - my ($self) = @_; - +after finalize => sub ($self, @) { my ($name, $plugin_class, $arg) = ( $self->name, $self->package, diff --git a/lib/Dist/Zilla/MintingProfile/Default.pm b/lib/Dist/Zilla/MintingProfile/Default.pm index 6ba31bfd1..9b36ca7c4 100644 --- a/lib/Dist/Zilla/MintingProfile/Default.pm +++ b/lib/Dist/Zilla/MintingProfile/Default.pm @@ -19,9 +19,7 @@ if not found it looks among the default profiles shipped with Dist::Zilla. =cut -around profile_dir => sub { - my ($orig, $self, $profile_name) = @_; - +around profile_dir => sub ($orig, $self, $profile_name) { $profile_name ||= 'default'; # shouldn't look in user's config when testing diff --git a/lib/Dist/Zilla/Plugin/AutoPrereqs.pm b/lib/Dist/Zilla/Plugin/AutoPrereqs.pm index 4a15fbadc..a8b66fd47 100644 --- a/lib/Dist/Zilla/Plugin/AutoPrereqs.pm +++ b/lib/Dist/Zilla/Plugin/AutoPrereqs.pm @@ -8,9 +8,10 @@ with( 'Dist::Zilla::Role::PPI', ); +use Moose::Util::TypeConstraints 'enum'; + use Dist::Zilla::Dialect; -use Moose::Util::TypeConstraints 'enum'; use namespace::autoclean; =head1 SYNOPSIS @@ -117,9 +118,7 @@ has scanners => ( has _scanner => ( is => 'ro', lazy => 1, - default => sub { - my $self = shift; - + default => sub ($self, @) { require Perl::PrereqScanner; Perl::PrereqScanner->VERSION('1.016'); # don't skip "lib" @@ -137,14 +136,11 @@ has type => ( default => 'requires', ); -sub scan_file_reqs { - my ($self, $file) = @_; +sub scan_file_reqs ($self, $file) { return $self->_scanner->scan_ppi_document($self->ppi_document_for_file($file)) } -sub register_prereqs { - my $self = shift; - +sub register_prereqs ($self) { my $type = $self->type; my $reqs_by_phase = $self->scan_prereqs; diff --git a/lib/Dist/Zilla/Plugin/AutoVersion.pm b/lib/Dist/Zilla/Plugin/AutoVersion.pm index 9ef7f12ea..29d224cdd 100644 --- a/lib/Dist/Zilla/Plugin/AutoVersion.pm +++ b/lib/Dist/Zilla/Plugin/AutoVersion.pm @@ -66,9 +66,7 @@ has format => ( . q<{{$ENV{DEV} ? (sprintf '_%03u', $ENV{DEV}) : ''}}> ); -sub provide_version { - my ($self) = @_; - +sub provide_version ($self) { if (exists $ENV{V}) { $self->log_debug([ 'providing version %s', $ENV{V} ]); return $ENV{V}; diff --git a/lib/Dist/Zilla/Plugin/CPANFile.pm b/lib/Dist/Zilla/Plugin/CPANFile.pm index 4b3aa559f..58339ed67 100644 --- a/lib/Dist/Zilla/Plugin/CPANFile.pm +++ b/lib/Dist/Zilla/Plugin/CPANFile.pm @@ -43,9 +43,7 @@ has filename => ( default => 'cpanfile', ); -sub _hunkify_hunky_hunk_hunks { - my ($self, $indent, $type, $req) = @_; - +sub _hunkify_hunky_hunk_hunks ($self, $indent, $type, $req) { my $str = ''; for my $module (sort $req->required_modules) { my $vstr = $req->requirements_for_module($module); @@ -55,9 +53,7 @@ sub _hunkify_hunky_hunk_hunks { return $str; } -sub gather_files { - my ($self, $arg) = @_; - +sub gather_files ($self) { my $zilla = $self->zilla; my $file = Dist::Zilla::File::FromCode->new({ diff --git a/lib/Dist/Zilla/Plugin/ConfirmRelease.pm b/lib/Dist/Zilla/Plugin/ConfirmRelease.pm index 53bf7d547..f1d305bb4 100644 --- a/lib/Dist/Zilla/Plugin/ConfirmRelease.pm +++ b/lib/Dist/Zilla/Plugin/ConfirmRelease.pm @@ -8,9 +8,7 @@ use Dist::Zilla::Dialect; use namespace::autoclean; -sub before_release { - my ($self, $tgz) = @_; - +sub before_release ($self, $tgz) { my $releasers = join q{, }, map {; $_->plugin_name } $self->zilla->plugins_with(-Releaser); diff --git a/lib/Dist/Zilla/Plugin/DistINI.pm b/lib/Dist/Zilla/Plugin/DistINI.pm index c31dd1e2e..d4ea919a7 100644 --- a/lib/Dist/Zilla/Plugin/DistINI.pm +++ b/lib/Dist/Zilla/Plugin/DistINI.pm @@ -61,9 +61,7 @@ has append_file => ( default => sub { [] }, ); -sub gather_files { - my ($self, $arg) = @_; - +sub gather_files ($self) { my $zilla = $self->zilla; my $postlude = ''; diff --git a/lib/Dist/Zilla/Plugin/Encoding.pm b/lib/Dist/Zilla/Plugin/Encoding.pm index c4f3b557c..38ec2335e 100644 --- a/lib/Dist/Zilla/Plugin/Encoding.pm +++ b/lib/Dist/Zilla/Plugin/Encoding.pm @@ -80,9 +80,7 @@ has ignore => ( default => sub { [] }, ); -sub set_file_encodings { - my ($self) = @_; - +sub set_file_encodings ($self) { # never match (at least the filename characters) my $matches_regex = qr/\000/; diff --git a/lib/Dist/Zilla/Plugin/ExtraTests.pm b/lib/Dist/Zilla/Plugin/ExtraTests.pm index d234b7648..7a4ae937a 100644 --- a/lib/Dist/Zilla/Plugin/ExtraTests.pm +++ b/lib/Dist/Zilla/Plugin/ExtraTests.pm @@ -22,9 +22,7 @@ not set. =cut -sub munge_file { - my ($self, $file) = @_; - +sub munge_file ($self, $file) { return unless $file->name =~ m{\Axt/(smoke|author|release)/.+\.t\z}; my $method = "_rewrite_$1\_test"; @@ -33,24 +31,19 @@ sub munge_file { $self->$method($file); } -sub _rewrite_smoke_test { - my ($self, $file) = @_; +sub _rewrite_smoke_test ($self, $file) { $self->_rewrite($file, 'AUTOMATED_TESTING', '"smoke bot" testing'); } -sub _rewrite_author_test { - my ($self, $file) = @_; +sub _rewrite_author_test ($self, $file) { $self->_rewrite($file, 'AUTHOR_TESTING', 'testing by the author'); } -sub _rewrite_release_test { - my ($self, $file) = @_; +sub _rewrite_release_test ($self, $file) { $self->_rewrite($file, 'RELEASE_TESTING', 'release candidate testing'); } -sub _rewrite { - my ($self, $file, $env, $msg) = @_; - +sub _rewrite ($self, $file, $env, $msg) { my $name = $file->name =~ s{^xt/([^/]+)/}{t/$1-}r; $file->name($name); diff --git a/lib/Dist/Zilla/Plugin/FakeRelease.pm b/lib/Dist/Zilla/Plugin/FakeRelease.pm index 28904be01..4014b3475 100644 --- a/lib/Dist/Zilla/Plugin/FakeRelease.pm +++ b/lib/Dist/Zilla/Plugin/FakeRelease.pm @@ -17,9 +17,7 @@ has user => ( sub cpanid { shift->user } -sub release { - my $self = shift; - +sub release ($self, $) { for my $env ( 'DIST_ZILLA_FAKERELEASE_FAIL', # old 'DZIL_FAKERELEASE_FAIL', # new diff --git a/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm b/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm index ecc2f721c..afabd121e 100644 --- a/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm +++ b/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm @@ -4,6 +4,8 @@ package Dist::Zilla::Plugin::FileFinder::ByName; use Moose; with 'Dist::Zilla::Role::FileFinder'; +use Moose::Util::TypeConstraints; + use Dist::Zilla::Dialect; use namespace::autoclean; @@ -25,7 +27,6 @@ This plugin was originally contributed by Christopher J. Madsen. =cut -use Moose::Util::TypeConstraints; use MooseX::Types::Moose qw(ArrayRef RegexpRef Str); use Text::Glob 0.08 qw(glob_to_regex_string); @@ -95,8 +96,7 @@ sub mvp_aliases { +{ qw( sub mvp_multivalue_args { qw(dirs files matches skips) } -sub _join_re { - my $list = shift; +my sub _join_re ($list) { return undef unless @$list; # Special case to avoid stringify+compile return $list->[0] if @$list == 1; @@ -105,9 +105,7 @@ sub _join_re { qr/$re/ } -sub find_files { - my $self = shift; - +sub find_files ($self) { my $skip = _join_re($self->skips); my $dir = _join_re([ map { qr!^\Q$_/! } $self->dirs->@* ]); my $match = _join_re([ diff --git a/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm b/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm index 3f7dec7d0..09b346bbe 100644 --- a/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm +++ b/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm @@ -9,6 +9,8 @@ with( }, ); +use Moose::Util::TypeConstraints; + use Dist::Zilla::Dialect; use namespace::autoclean; @@ -28,7 +30,6 @@ This plugin was originally contributed by Christopher J. Madsen. =cut -use Moose::Util::TypeConstraints; use MooseX::Types::Moose qw(ArrayRef RegexpRef Str); { @@ -61,9 +62,7 @@ sub mvp_aliases { +{ qw( sub mvp_multivalue_args { qw(skips) } -sub find_files { - my $self = shift; - +sub find_files ($self) { my $files = $self->found_files; foreach my $re ($self->skips->@*) { diff --git a/lib/Dist/Zilla/Plugin/FinderCode.pm b/lib/Dist/Zilla/Plugin/FinderCode.pm index 5bb164f52..dd8e53167 100644 --- a/lib/Dist/Zilla/Plugin/FinderCode.pm +++ b/lib/Dist/Zilla/Plugin/FinderCode.pm @@ -4,12 +4,12 @@ package Dist::Zilla::Plugin::FinderCode; use Moose; with 'Dist::Zilla::Role::FileFinder'; +use Moose::Util::TypeConstraints; + use Dist::Zilla::Dialect; use namespace::autoclean; -use Moose::Util::TypeConstraints; - has code => ( is => 'ro', isa => 'CodeRef', @@ -22,24 +22,18 @@ has style => ( required => 1, ); -sub find_files { - my ($self) = @_; - +sub find_files ($self) { my $method = '_find_via_' . $self->style; $self->$method; } -sub _find_via_grep { - my ($self) = @_; - +sub _find_via_grep ($self) { my @files = grep { $self->code->($_, $self) } $self->zilla->files->@*; return \@files; } -sub _find_via_list { - my ($self) = @_; - +sub _find_via_list ($self) { my $code = $self->code; $self->$code; } diff --git a/lib/Dist/Zilla/Plugin/GatherDir.pm b/lib/Dist/Zilla/Plugin/GatherDir.pm index da9269f4d..d3661399f 100644 --- a/lib/Dist/Zilla/Plugin/GatherDir.pm +++ b/lib/Dist/Zilla/Plugin/GatherDir.pm @@ -59,7 +59,7 @@ has root => ( lazy => 1, coerce => 1, required => 1, - default => sub { shift->zilla->root }, + default => sub ($self, @) { $self->zilla->root }, ); =attr prefix @@ -152,10 +152,7 @@ has prune_directory => ( default => sub { [] }, ); -around dump_config => sub { - my $orig = shift; - my $self = shift; - +around dump_config => sub ($orig, $self) { my $config = $self->$orig; $config->{+__PACKAGE__} = { @@ -169,9 +166,7 @@ around dump_config => sub { return $config; }; -sub gather_files { - my ($self) = @_; - +sub gather_files ($self) { my $exclude_regex = qr/\000/; $exclude_regex = qr/(?:$exclude_regex)|$_/ for $self->exclude_match->@*; @@ -231,9 +226,7 @@ sub gather_files { return; } -sub _file_from_filename { - my ($self, $filename) = @_; - +sub _file_from_filename ($self, $filename) { my @stat = stat $filename or $self->log_fatal("$filename does not exist!"); return Dist::Zilla::File::OnDisk->new({ diff --git a/lib/Dist/Zilla/Plugin/GatherDir/Template.pm b/lib/Dist/Zilla/Plugin/GatherDir/Template.pm index a7afacf40..f50016257 100644 --- a/lib/Dist/Zilla/Plugin/GatherDir/Template.pm +++ b/lib/Dist/Zilla/Plugin/GatherDir/Template.pm @@ -50,11 +50,8 @@ has _rename => ( default => sub { +{} }, ); -around BUILDARGS => sub { - my $orig = shift; - my ($class, @arg) = @_; - - my $args = $class->$orig(@arg); +around BUILDARGS => sub ($orig, $class, @rest) { + my $args = $class->$orig(@rest); my %retargs = %$args; for my $rename (grep /^rename/, keys %retargs) { @@ -66,9 +63,7 @@ around BUILDARGS => sub { return \%retargs; }; -sub _file_from_filename { - my ($self, $filename) = @_; - +sub _file_from_filename ($self, $filename) { my $template = path($filename)->slurp_utf8; my @stat = stat $filename or $self->log_fatal("$filename does not exist!"); @@ -92,7 +87,7 @@ sub _file_from_filename { return Dist::Zilla::File::FromCode->new({ name => $new_filename, mode => ($stat[2] & 0755) | 0200, # kill world-writeability, make sure owner-writable. - code => sub { + code => sub ($file, @) { my ($file_obj) = @_; $self->fill_in_string( $template, diff --git a/lib/Dist/Zilla/Plugin/GatherFile.pm b/lib/Dist/Zilla/Plugin/GatherFile.pm index 830bcc049..617df97c5 100644 --- a/lib/Dist/Zilla/Plugin/GatherFile.pm +++ b/lib/Dist/Zilla/Plugin/GatherFile.pm @@ -78,10 +78,7 @@ has filenames => ( sub mvp_aliases { +{ filename => 'filenames' } } sub mvp_multivalue_args { qw(filenames) } -around dump_config => sub { - my $orig = shift; - my $self = shift; - +around dump_config => sub ($orig, $self) { my $config = $self->$orig; $config->{+__PACKAGE__} = { @@ -94,9 +91,7 @@ around dump_config => sub { return $config; }; -sub gather_files { - my ($self) = @_; - +sub gather_files ($self) { my $repo_root = $self->zilla->root; my $root = "" . $self->root; $root =~ s{^~([\\/])}{ Dist::Zilla::Util->homedir . $1 }e; @@ -122,9 +117,7 @@ sub gather_files { } # as in GatherDir -sub _file_from_filename { - my ($self, $filename) = @_; - +sub _file_from_filename ($self, $filename) { my @stat = stat $filename or $self->log_fatal("$filename does not exist!"); return Dist::Zilla::File::OnDisk->new({ diff --git a/lib/Dist/Zilla/Plugin/GenerateFile.pm b/lib/Dist/Zilla/Plugin/GenerateFile.pm index d321aaf4c..c3af8a54f 100644 --- a/lib/Dist/Zilla/Plugin/GenerateFile.pm +++ b/lib/Dist/Zilla/Plugin/GenerateFile.pm @@ -105,9 +105,7 @@ has name_is_template => ( default => 0, ); -sub gather_files { - my ($self, $arg) = @_; - +sub gather_files ($self, $arg = {}) { my $file = Dist::Zilla::File::InMemory->new({ name => $self->_filename, content => $self->_content, @@ -117,9 +115,7 @@ sub gather_files { return; } -sub _content { - my $self = shift; - +sub _content ($self) { my $content = join "\n", $self->content->@*; $content .= qq{\n}; @@ -136,9 +132,7 @@ sub _content { return $content; } -sub _filename { - my $self = shift; - +sub _filename ($self) { my $filename = $self->filename; if ($self->name_is_template) { diff --git a/lib/Dist/Zilla/Plugin/InlineFiles.pm b/lib/Dist/Zilla/Plugin/InlineFiles.pm index 75bfb10ac..082df2355 100644 --- a/lib/Dist/Zilla/Plugin/InlineFiles.pm +++ b/lib/Dist/Zilla/Plugin/InlineFiles.pm @@ -22,9 +22,7 @@ use Data::Section 0.200002 # encoding and bytes '-setup' => { encoding => 'bytes' }; use Dist::Zilla::File::InMemory; -sub gather_files { - my ($self) = @_; - +sub gather_files ($self) { my $data = $self->merged_section_data; return unless $data and %$data; diff --git a/lib/Dist/Zilla/Plugin/License.pm b/lib/Dist/Zilla/Plugin/License.pm index f15233cd3..17e8b6bd8 100644 --- a/lib/Dist/Zilla/Plugin/License.pm +++ b/lib/Dist/Zilla/Plugin/License.pm @@ -28,9 +28,7 @@ has filename => ( default => 'LICENSE', ); -sub gather_files { - my ($self, $arg) = @_; - +sub gather_files ($self) { my $file = Dist::Zilla::File::InMemory->new({ name => $self->filename, content => $self->zilla->license->fulltext, diff --git a/lib/Dist/Zilla/Plugin/MakeMaker.pm b/lib/Dist/Zilla/Plugin/MakeMaker.pm index bcf5b0bb5..d9a0365f3 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker.pm @@ -69,8 +69,7 @@ has '_runner' => ( is => 'ro', lazy => 1, handles => [qw(build test)], - default => sub { - my ($self) = @_; + default => sub ($self, @) { Dist::Zilla::Plugin::MakeMaker::Runner->new({ zilla => $self->zilla, plugin_name => $self->plugin_name . '::Runner', @@ -117,9 +116,7 @@ delete $WriteMakefileArgs{CONFIGURE_REQUIRES} WriteMakefile(%WriteMakefileArgs); {{ $share_dir_code{postamble} || '' }}!; -sub register_prereqs { - my ($self) = @_; - +sub register_prereqs ($self) { $self->zilla->register_prereqs( { phase => 'configure' }, 'ExtUtils::MakeMaker' => $self->eumm_version || 0, @@ -133,9 +130,7 @@ sub register_prereqs { ); } -sub gather_files { - my ($self) = @_; - +sub gather_files ($self) { require Dist::Zilla::File::InMemory; my $file = Dist::Zilla::File::InMemory->new({ @@ -147,9 +142,7 @@ sub gather_files { return; } -sub share_dir_code { - my ($self) = @_; - +sub share_dir_code ($self) { my $share_dir_code = {}; my $share_dir_map = $self->zilla->_share_dir_map; @@ -180,9 +173,7 @@ PREAMBLE return $share_dir_code; } -sub write_makefile_args { - my ($self) = @_; - +sub write_makefile_args ($self) { my $name = $self->zilla->name =~ s/-/::/gr; my @exe_files = map { $_->name } $self->zilla->find_files(':ExecFiles')->@*; @@ -263,8 +254,7 @@ sub write_makefile_args { return \%write_makefile_args; } -sub _normalize_eumm_versions { - my ($self, $prereqs) = @_; +sub _normalize_eumm_versions ($self, $prereqs) { for my $v (values %$prereqs) { if (version::is_strict($v)) { my $version = version->parse($v); @@ -281,8 +271,7 @@ sub _normalize_eumm_versions { return $prereqs; } -sub _dump_as { - my ($self, $ref, $name) = @_; +sub _dump_as ($self, $ref, $name) { require Data::Dumper; my $dumper = Data::Dumper->new( [ $ref ], [ $name ] ); $dumper->Sortkeys( 1 ); @@ -291,8 +280,7 @@ sub _dump_as { return $dumper->Dump; } -sub fallback_prereq_pm { - my $self = shift; +sub fallback_prereq_pm ($self) { my $fallback = $self->_normalize_eumm_versions( $self->zilla->prereqs->merged_requires @@ -303,9 +291,7 @@ sub fallback_prereq_pm { return $self->_dump_as( $fallback, '*FallbackPrereqs' ); } -sub setup_installer { - my ($self) = @_; - +sub setup_installer ($self) { my $write_makefile_args = $self->write_makefile_args; $self->__write_makefile_args($write_makefile_args); # save for testing diff --git a/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm b/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm index e9e4272a4..3913c115e 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm @@ -19,9 +19,7 @@ has 'make_path' => ( default => $Config{make} || 'make', ); -sub build { - my $self = shift; - +sub build ($self) { my $make = $self->make_path; my $makefile = $^O eq 'VMS' ? 'Descrip.MMS' : 'Makefile'; @@ -38,9 +36,7 @@ sub build { return; } -sub test { - my ($self, $target, $arg) = @_; - +sub test ($self, $target, $arg = {}) { my $make = $self->make_path; $self->build; diff --git a/lib/Dist/Zilla/Plugin/Manifest.pm b/lib/Dist/Zilla/Plugin/Manifest.pm index 9aadf0da7..db66de89b 100644 --- a/lib/Dist/Zilla/Plugin/Manifest.pm +++ b/lib/Dist/Zilla/Plugin/Manifest.pm @@ -29,17 +29,14 @@ Other modules: L. =cut -sub __fix_filename { - my ($name) = @_; +sub __fix_filename ($name) { return $name unless $name =~ /[ '\\]/; $name =~ s/\\/\\\\/g; $name =~ s/'/\\'/g; return qq{'$name'}; } -sub gather_files { - my ($self, $arg) = @_; - +sub gather_files ($self) { my $zilla = $self->zilla; my $file = Dist::Zilla::File::FromCode->new({ diff --git a/lib/Dist/Zilla/Plugin/ManifestSkip.pm b/lib/Dist/Zilla/Plugin/ManifestSkip.pm index 494fad2d6..d67ec6d59 100644 --- a/lib/Dist/Zilla/Plugin/ManifestSkip.pm +++ b/lib/Dist/Zilla/Plugin/ManifestSkip.pm @@ -35,8 +35,7 @@ Other modules: L. has skipfile => (is => 'ro', required => 1, default => 'MANIFEST.SKIP'); -sub prune_files { - my ($self) = @_; +sub prune_files ($self) { my $files = $self->zilla->files; my $skipfile_name = $self->skipfile; diff --git a/lib/Dist/Zilla/Plugin/MetaConfig.pm b/lib/Dist/Zilla/Plugin/MetaConfig.pm index d51cfd182..ff43e5f32 100644 --- a/lib/Dist/Zilla/Plugin/MetaConfig.pm +++ b/lib/Dist/Zilla/Plugin/MetaConfig.pm @@ -22,9 +22,7 @@ on. =cut -sub metadata { - my ($self) = @_; - +sub metadata ($self) { my $dump = { }; my @plugins; diff --git a/lib/Dist/Zilla/Plugin/MetaJSON.pm b/lib/Dist/Zilla/Plugin/MetaJSON.pm index 426871418..78739acd9 100644 --- a/lib/Dist/Zilla/Plugin/MetaJSON.pm +++ b/lib/Dist/Zilla/Plugin/MetaJSON.pm @@ -4,12 +4,12 @@ package Dist::Zilla::Plugin::MetaJSON; use Moose; with 'Dist::Zilla::Role::FileGatherer'; +use Moose::Util::TypeConstraints; + use Dist::Zilla::Dialect; use namespace::autoclean; -use Moose::Util::TypeConstraints; - =head1 DESCRIPTION This plugin will add a F file to the distribution. @@ -40,11 +40,10 @@ If you want a fixed version, specify it. =cut -my $version_type = subtype( - as 'Num', - where { $_ >= 2 }, - message { "MetaJSON version must be 2 or greater" }, -); +my $version_type = subtype + as 'Num', + where { $_ >= 2 }, + message { "MetaJSON version must be 2 or greater" }; has version => ( is => 'ro', @@ -52,9 +51,7 @@ has version => ( default => '2', ); -sub gather_files { - my ($self, $arg) = @_; - +sub gather_files ($self) { my $zilla = $self->zilla; require JSON::MaybeXS; diff --git a/lib/Dist/Zilla/Plugin/MetaResources.pm b/lib/Dist/Zilla/Plugin/MetaResources.pm index dacd2a91e..42c61cc4b 100644 --- a/lib/Dist/Zilla/Plugin/MetaResources.pm +++ b/lib/Dist/Zilla/Plugin/MetaResources.pm @@ -28,11 +28,8 @@ has resources => ( required => 1, ); -around BUILDARGS => sub { - my $orig = shift; - my ($class, @arg) = @_; - - my $args = $class->$orig(@arg); +around BUILDARGS => sub ($orig, $class, @rest) { + my $args = $class->$orig(@rest); my %copy = %$args; my $zilla = delete $copy{zilla}; @@ -66,9 +63,7 @@ around BUILDARGS => sub { }; }; -sub metadata { - my ($self) = @_; - +sub metadata ($self) { return { resources => $self->resources }; } diff --git a/lib/Dist/Zilla/Plugin/MetaTests.pm b/lib/Dist/Zilla/Plugin/MetaTests.pm index e37fd188f..25f9a41b2 100644 --- a/lib/Dist/Zilla/Plugin/MetaTests.pm +++ b/lib/Dist/Zilla/Plugin/MetaTests.pm @@ -32,9 +32,7 @@ L. # Register the author test prereq as a "develop requires" # so it will be listed in "dzil listdeps --author" -sub register_prereqs { - my ($self) = @_; - +sub register_prereqs ($self) { $self->zilla->register_prereqs( { phase => 'develop', type => 'requires', diff --git a/lib/Dist/Zilla/Plugin/MetaYAML.pm b/lib/Dist/Zilla/Plugin/MetaYAML.pm index d4c05c6d8..e0494400d 100644 --- a/lib/Dist/Zilla/Plugin/MetaYAML.pm +++ b/lib/Dist/Zilla/Plugin/MetaYAML.pm @@ -28,9 +28,7 @@ has filename => ( default => 'META.yml', ); -sub gather_files { - my ($self, $arg) = @_; - +sub gather_files ($self) { require Dist::Zilla::File::FromCode; require YAML::Tiny; require CPAN::Meta::Converter; @@ -61,8 +59,7 @@ sub gather_files { my $yaml = try { YAML::Tiny->new($output)->write_string; # text! - } - catch { + } catch { $self->log_fatal("Could not create YAML string: " . YAML::Tiny->errstr) }; return $yaml; diff --git a/lib/Dist/Zilla/Plugin/ModuleBuild.pm b/lib/Dist/Zilla/Plugin/ModuleBuild.pm index 71667c690..3d1486bf3 100644 --- a/lib/Dist/Zilla/Plugin/ModuleBuild.pm +++ b/lib/Dist/Zilla/Plugin/ModuleBuild.pm @@ -40,8 +40,8 @@ to the generated Build.PL file. =attr mb_lib -B Specify the list of directories to be passed to lib when using -mb_class. Defaults to C. +B Specify the list of directories to be passed to lib when using +mb_class. Defaults to C. =attr build_element @@ -54,8 +54,7 @@ has 'mb_version' => ( isa => 'Str', is => 'rw', lazy => 1, - default => sub { - my $self = shift; + default => sub ($self, @) { keys $self->zilla->_share_dir_map->%* ? '0.3601' : '0.28'; }, ); @@ -103,8 +102,7 @@ my $build = {{ $plugin->mb_class }}->new(%module_build_args); $build->create_build_script; |; -sub _use_custom_class { - my ($self) = @_; +sub _use_custom_class ($self) { my $class = $self->mb_class; if ( $class eq 'Module::Build' ) { return ""; @@ -114,8 +112,7 @@ sub _use_custom_class { } } -sub _dump_as { - my ($self, $ref, $name) = @_; +sub _dump_as ($self, $ref, $name) { require Data::Dumper; my $dumper = Data::Dumper->new( [ $ref ], [ $name ] ); $dumper->Sortkeys( 1 ); @@ -129,9 +126,7 @@ sub _add_build_elements { return '$build->add_build_element($_) for qw(' . join(' ', @elems) . ');'; } -sub register_prereqs { - my ($self) = @_; - +sub register_prereqs ($self) { $self->zilla->register_prereqs( { phase => 'configure' }, 'Module::Build' => $self->mb_version, @@ -143,9 +138,7 @@ sub register_prereqs { ); } -sub module_build_args { - my ($self) = @_; - +sub module_build_args ($self) { my @exe_files = map { $_->name } $self->zilla->find_files(':ExecFiles')->@*; @@ -180,8 +173,7 @@ sub module_build_args { }; } -sub fallback_build_requires { - my $self = shift; +sub fallback_build_requires ($self) { my $prereqs = $self->zilla->prereqs; my $merged = CPAN::Meta::Requirements->new; for my $phase ( qw/build test/ ) { @@ -191,9 +183,7 @@ sub fallback_build_requires { return $self->_dump_as( $merged->as_string_hash, '*fallback_build_requires' ); } -sub gather_files { - my ($self) = @_; - +sub gather_files ($self) { require Dist::Zilla::File::InMemory; my $file = Dist::Zilla::File::InMemory->new({ @@ -205,9 +195,7 @@ sub gather_files { return; } -sub setup_installer { - my ($self) = @_; - +sub setup_installer ($self) { $self->log_fatal("can't build Build.PL; license has no known META.yml value") unless $self->zilla->license->meta_yml_name; diff --git a/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm b/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm index cc6849e8c..ac07d26f2 100644 --- a/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm +++ b/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm @@ -23,8 +23,7 @@ has _module_map => ( default => sub { {} }, ); -sub find_files { - my ($self) = @_; +sub find_files ($self) { my $modmap = $self->_module_map; my @files; @@ -38,19 +37,15 @@ sub find_files { return \@files; } -sub share_dir_map { - my ($self) = @_; +sub share_dir_map ($self) { my $modmap = $self->_module_map; return unless keys %$modmap; return { module => $modmap }; } -around BUILDARGS => sub { - my $orig = shift; - my ($class, @arg) = @_; - - my $args = $class->$orig(@arg); +around BUILDARGS => sub ($orig, $class, @rest) { + my $args = $class->$orig(@rest); my %copy = %$args; my $zilla = delete $copy{zilla}; diff --git a/lib/Dist/Zilla/Plugin/PkgDist.pm b/lib/Dist/Zilla/Plugin/PkgDist.pm index 865267613..dc15eaa79 100644 --- a/lib/Dist/Zilla/Plugin/PkgDist.pm +++ b/lib/Dist/Zilla/Plugin/PkgDist.pm @@ -32,15 +32,11 @@ typically used when doing monkey patching or other tricky things. =cut -sub munge_files { - my ($self) = @_; - +sub munge_files ($self) { $self->munge_file($_) for $self->found_files->@*; } -sub munge_file { - my ($self, $file) = @_; - +sub munge_file ($self, $file) { # XXX: for test purposes, for now! evil! -- rjbs, 2010-03-17 return if $file->name =~ /^corpus\//; @@ -50,9 +46,7 @@ sub munge_file { return; } -sub munge_perl { - my ($self, $file) = @_; - +sub munge_perl ($self, $file) { my $dist_name = $self->zilla->name; my $document = $self->ppi_document_for_file($file); diff --git a/lib/Dist/Zilla/Plugin/PkgVersion.pm b/lib/Dist/Zilla/Plugin/PkgVersion.pm index 2bf03890c..918175fa7 100644 --- a/lib/Dist/Zilla/Plugin/PkgVersion.pm +++ b/lib/Dist/Zilla/Plugin/PkgVersion.pm @@ -101,8 +101,7 @@ L<[FileFinder::Filter]|Dist::Zilla::Plugin::FileFinder::Filter> plugins. =cut -sub BUILD { - my ($self) = @_; +sub BUILD ($self, @) { $self->log("use_our option to PkgVersion is deprecated and will be removed") if $self->use_our; @@ -111,15 +110,11 @@ sub BUILD { } } -sub munge_files { - my ($self) = @_; - +sub munge_files ($self) { $self->munge_file($_) for $self->found_files->@*; } -sub munge_file { - my ($self, $file) = @_; - +sub munge_file ($self, $file) { if ($file->is_bytes) { $self->log_debug($file->name . " has 'bytes' encoding, skipping..."); return; @@ -163,9 +158,7 @@ has use_begin => ( default => 0, ); -sub munge_perl { - my ($self, $file) = @_; - +sub munge_perl ($self, $file) { my $version = $self->zilla->version; require version; diff --git a/lib/Dist/Zilla/Plugin/PodCoverageTests.pm b/lib/Dist/Zilla/Plugin/PodCoverageTests.pm index 791eb9a63..8d63d7cec 100644 --- a/lib/Dist/Zilla/Plugin/PodCoverageTests.pm +++ b/lib/Dist/Zilla/Plugin/PodCoverageTests.pm @@ -29,9 +29,7 @@ C dependencies. # Register the author test prereq as a "develop requires" # so it will be listed in "dzil listdeps --author" -sub register_prereqs { - my ($self) = @_; - +sub register_prereqs ($self) { $self->zilla->register_prereqs( { type => 'requires', diff --git a/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm b/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm index 7be5c4ff6..787e1c8d4 100644 --- a/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm +++ b/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm @@ -20,12 +20,9 @@ L C<1.41> will be added as a C dependency. =cut - # Register the author test prereq as a "develop requires" # so it will be listed in "dzil listdeps --author" -sub register_prereqs { - my ($self) = @_; - +sub register_prereqs ($self) { $self->zilla->register_prereqs( { type => 'requires', @@ -35,7 +32,6 @@ sub register_prereqs { ); } - __PACKAGE__->meta->make_immutable; 1; diff --git a/lib/Dist/Zilla/Plugin/PodVersion.pm b/lib/Dist/Zilla/Plugin/PodVersion.pm index 3b0f930f7..f16631b4f 100644 --- a/lib/Dist/Zilla/Plugin/PodVersion.pm +++ b/lib/Dist/Zilla/Plugin/PodVersion.pm @@ -27,21 +27,15 @@ section). =cut -sub munge_files { - my ($self) = @_; - +sub munge_files ($self) { $self->munge_file($_) for $self->found_files->@*; } -sub munge_file { - my ($self, $file) = @_; - +sub munge_file ($self, $file) { return $self->munge_pod($file); } -sub munge_pod { - my ($self, $file) = @_; - +sub munge_pod ($self, $file) { my @content = split /\n/, $file->content; require List::Util; diff --git a/lib/Dist/Zilla/Plugin/Prereqs.pm b/lib/Dist/Zilla/Plugin/Prereqs.pm index 7a934a465..ef65f82a9 100644 --- a/lib/Dist/Zilla/Plugin/Prereqs.pm +++ b/lib/Dist/Zilla/Plugin/Prereqs.pm @@ -102,8 +102,7 @@ has prereq_type => ( default => 'requires', ); -around dump_config => sub { - my ($orig, $self) = @_; +around dump_config => sub ($orig, $self, @) { my $config = $self->$orig; my $this_config = { @@ -124,11 +123,8 @@ has _prereq => ( sub mvp_aliases { return { -relationship => '-type' } } -around BUILDARGS => sub { - my $orig = shift; - my ($class, @arg) = @_; - - my $args = $class->$orig(@arg); +around BUILDARGS => sub ($orig, $class, @rest) { + my $args = $class->$orig(@rest); my %copy = %$args; my $zilla = delete $copy{zilla}; @@ -173,9 +169,7 @@ around BUILDARGS => sub { } }; -sub register_prereqs { - my ($self) = @_; - +sub register_prereqs ($self) { $self->zilla->register_prereqs( { type => $self->prereq_type, diff --git a/lib/Dist/Zilla/Plugin/PruneCruft.pm b/lib/Dist/Zilla/Plugin/PruneCruft.pm index 55759bfff..f5b1aa4ae 100644 --- a/lib/Dist/Zilla/Plugin/PruneCruft.pm +++ b/lib/Dist/Zilla/Plugin/PruneCruft.pm @@ -50,17 +50,14 @@ L. sub mvp_multivalue_args { qw(except) } } -sub _dont_exclude_file { - my ($self, $file) = @_; +sub _dont_exclude_file ($self, $file) { for my $exception ($self->except->@*) { return 1 if $file->name =~ $exception; } return; } -sub exclude_file { - my ($self, $file) = @_; - +sub exclude_file ($self, $file) { return 0 if $self->_dont_exclude_file($file); return 1 if index($file->name, $self->zilla->name . '-') == 0; return 1 if $file->name =~ /\A\./; @@ -87,9 +84,7 @@ sub exclude_file { return; } -sub prune_files { - my ($self) = @_; - +sub prune_files ($self) { # Copy list (break reference) so we can mutate. for my $file ((), $self->zilla->files->@*) { next unless $self->exclude_file($file); diff --git a/lib/Dist/Zilla/Plugin/PruneFiles.pm b/lib/Dist/Zilla/Plugin/PruneFiles.pm index fe0536520..f6ed7f187 100644 --- a/lib/Dist/Zilla/Plugin/PruneFiles.pm +++ b/lib/Dist/Zilla/Plugin/PruneFiles.pm @@ -57,9 +57,7 @@ has matches => ( default => sub { [] }, ); -sub prune_files { - my ($self) = @_; - +sub prune_files ($self) { # never match (at least the filename characters) my $matches_regex = qr/\000/; diff --git a/lib/Dist/Zilla/Plugin/Readme.pm b/lib/Dist/Zilla/Plugin/Readme.pm index 704e7dd82..8cc9e905f 100644 --- a/lib/Dist/Zilla/Plugin/Readme.pm +++ b/lib/Dist/Zilla/Plugin/Readme.pm @@ -6,9 +6,10 @@ with qw/Dist::Zilla::Role::FileGatherer Dist::Zilla::Role::TextTemplate Dist::Zilla::Role::FileMunger/; +use Moose::Util::TypeConstraints; + use Dist::Zilla::Dialect; -use Moose::Util::TypeConstraints; use namespace::autoclean; =head1 DESCRIPTION @@ -23,9 +24,7 @@ has _file_obj => ( is => 'rw', isa => role_type('Dist::Zilla::Role::File'), ); -sub gather_files { - my ($self, $arg) = @_; - +sub gather_files ($self) { require Dist::Zilla::File::InMemory; my $template = q| @@ -55,9 +54,7 @@ This README file was generated by {{ $generated_by }}. return; } -sub munge_files { - my $self = shift; - +sub munge_files ($self) { my $file = $self->_file_obj; $file->content( diff --git a/lib/Dist/Zilla/Plugin/RemovePrereqs.pm b/lib/Dist/Zilla/Plugin/RemovePrereqs.pm index 9835dbef5..c34a11544 100644 --- a/lib/Dist/Zilla/Plugin/RemovePrereqs.pm +++ b/lib/Dist/Zilla/Plugin/RemovePrereqs.pm @@ -42,8 +42,7 @@ has modules_to_remove => ( required => 1, ); -around dump_config => sub { - my ($orig, $self) = @_; +around dump_config => sub ($orig, $self, @) { my $config = $self->$orig; my $this_config = { @@ -58,9 +57,7 @@ around dump_config => sub { my @phases = qw(configure build test runtime develop); my @types = qw(requires recommends suggests conflicts); -sub register_prereqs { - my ($self) = @_; - +sub register_prereqs ($self) { my $prereqs = $self->zilla->prereqs; for my $p (@phases) { diff --git a/lib/Dist/Zilla/Plugin/ShareDir.pm b/lib/Dist/Zilla/Plugin/ShareDir.pm index ceffec101..9436100ae 100644 --- a/lib/Dist/Zilla/Plugin/ShareDir.pm +++ b/lib/Dist/Zilla/Plugin/ShareDir.pm @@ -24,15 +24,12 @@ has dir => ( default => 'share', ); -sub find_files { - my ($self) = @_; - +sub find_files ($self) { my $dir = $self->dir; return [ grep { index($_->name, "$dir/") == 0 } $self->zilla->files->@* ]; } -sub share_dir_map { - my ($self) = @_; +sub share_dir_map ($self) { my $files = $self->find_files; return unless @$files; diff --git a/lib/Dist/Zilla/Plugin/TemplateModule.pm b/lib/Dist/Zilla/Plugin/TemplateModule.pm index e414d3c34..4a76da562 100644 --- a/lib/Dist/Zilla/Plugin/TemplateModule.pm +++ b/lib/Dist/Zilla/Plugin/TemplateModule.pm @@ -67,9 +67,7 @@ has template => ( predicate => 'has_template', ); -sub make_module { - my ($self, $arg) = @_; - +sub make_module ($self, $arg = {}){ my $template; if ($self->has_template) { diff --git a/lib/Dist/Zilla/Plugin/TestRelease.pm b/lib/Dist/Zilla/Plugin/TestRelease.pm index 954dc9bac..a3e292597 100644 --- a/lib/Dist/Zilla/Plugin/TestRelease.pm +++ b/lib/Dist/Zilla/Plugin/TestRelease.pm @@ -28,8 +28,7 @@ This plugin was originally contributed by Christopher J. Madsen. use File::pushd (); use Dist::Zilla::Path; -sub before_release { - my ($self, $tgz) = @_; +sub before_release ($self, $tgz) { $tgz = $tgz->absolute; my $build_root = $self->zilla->root->child('.build'); diff --git a/lib/Dist/Zilla/Plugin/UploadToCPAN.pm b/lib/Dist/Zilla/Plugin/UploadToCPAN.pm index a0a5d304a..df2426fbd 100644 --- a/lib/Dist/Zilla/Plugin/UploadToCPAN.pm +++ b/lib/Dist/Zilla/Plugin/UploadToCPAN.pm @@ -4,10 +4,11 @@ package Dist::Zilla::Plugin::UploadToCPAN; use Moose; with qw(Dist::Zilla::Role::BeforeRelease Dist::Zilla::Role::Releaser); +use Moose::Util::TypeConstraints; + use Dist::Zilla::Dialect; use File::Spec; -use Moose::Util::TypeConstraints; use Scalar::Util qw(weaken); use Dist::Zilla::Util; use Try::Tiny; @@ -49,9 +50,8 @@ You can't put your password in your F. C'mon now! # Report CPAN::Uploader's version, not ours: sub _ua_string { CPAN::Uploader->_ua_string } - sub log { - my $self = shift; - $self->{'Dist::Zilla'}{plugin}->log(@_); + sub log ($self, @rest) { + $self->{'Dist::Zilla'}{plugin}->log(@rest); } } @@ -74,12 +74,11 @@ has _credentials_stash_obj => ( isa => maybe_type( class_type('Dist::Zilla::Stash::PAUSE') ), lazy => 1, init_arg => undef, - default => sub { $_[0]->zilla->stash_named( $_[0]->credentials_stash ) }, + default => sub ($self, @) { + $self->zilla->stash_named( $self->credentials_stash ) }, ); -sub _credential { - my ($self, $name) = @_; - +sub _credential ($self, $name) { return unless my $stash = $self->_credentials_stash_obj; return $stash->$name; } @@ -100,8 +99,7 @@ has username => ( is => 'ro', isa => 'Str', lazy => 1, - default => sub { - my ($self) = @_; + default => sub ($self, @) { return $self->_credential('username') || $self->pause_cfg->{user} || $self->zilla->chrome->prompt_str("PAUSE username: "); @@ -123,8 +121,7 @@ has password => ( isa => 'Str', init_arg => undef, lazy => 1, - default => sub { - my ($self) = @_; + default => sub ($self, @) { my $pw = $self->_credential('password') || $self->pause_cfg->{password}; unless ($pw){ @@ -180,8 +177,7 @@ has pause_cfg => ( is => 'ro', isa => 'HashRef[Str]', lazy => 1, - default => sub { - my $self = shift; + default => sub ($self, @) { require CPAN::Uploader; my $file = $self->pause_cfg_file; $file = File::Spec->catfile($self->pause_cfg_dir, $file) @@ -228,9 +224,7 @@ has uploader => ( is => 'ro', isa => 'CPAN::Uploader', lazy => 1, - default => sub { - my ($self) = @_; - + default => sub ($self, @) { # Load the module lazily require CPAN::Uploader; CPAN::Uploader->VERSION('0.103004'); # require HTTPS @@ -251,9 +245,7 @@ has uploader => ( } ); -sub before_release { - my $self = shift; - +sub before_release ($self, $tgz) { my $problem; try { for my $attr (qw(username password)) { @@ -266,9 +258,7 @@ sub before_release { $self->log_fatal(['You need to supply a %s', $problem]) if $problem; } -sub release { - my ($self, $archive) = @_; - +sub release ($self, $archive) { $self->uploader->upload_file("$archive"); } diff --git a/lib/Dist/Zilla/PluginBundle/Basic.pm b/lib/Dist/Zilla/PluginBundle/Basic.pm index 079a7c6a9..b72655f31 100644 --- a/lib/Dist/Zilla/PluginBundle/Basic.pm +++ b/lib/Dist/Zilla/PluginBundle/Basic.pm @@ -8,9 +8,7 @@ use Dist::Zilla::Dialect; use namespace::autoclean; -sub configure { - my ($self) = @_; - +sub configure ($self) { $self->add_plugins(qw( GatherDir PruneCruft diff --git a/lib/Dist/Zilla/PluginBundle/Classic.pm b/lib/Dist/Zilla/PluginBundle/Classic.pm index 3c81b82b2..e17404efd 100644 --- a/lib/Dist/Zilla/PluginBundle/Classic.pm +++ b/lib/Dist/Zilla/PluginBundle/Classic.pm @@ -8,9 +8,7 @@ use Dist::Zilla::Dialect; use namespace::autoclean; -sub configure { - my ($self) = @_; - +sub configure ($self) { $self->add_plugins(qw( GatherDir PruneCruft diff --git a/lib/Dist/Zilla/PluginBundle/FakeClassic.pm b/lib/Dist/Zilla/PluginBundle/FakeClassic.pm index 205225f45..9faa94e04 100644 --- a/lib/Dist/Zilla/PluginBundle/FakeClassic.pm +++ b/lib/Dist/Zilla/PluginBundle/FakeClassic.pm @@ -8,10 +8,8 @@ use Dist::Zilla::Dialect; use namespace::autoclean; -around bundle_config => sub { - my ($orig, $self, $arg) = @_; - - my @config = $self->$orig($arg); +around bundle_config => sub ($orig, $self, $arg, @rest) { + my @config = $self->$orig($arg, @rest); for my $i (0 .. $#config) { if ($config[ $i ][1] eq 'Dist::Zilla::Plugin::UploadToCPAN') { diff --git a/lib/Dist/Zilla/PluginBundle/Filter.pm b/lib/Dist/Zilla/PluginBundle/Filter.pm index 897828383..a75cd8a04 100644 --- a/lib/Dist/Zilla/PluginBundle/Filter.pm +++ b/lib/Dist/Zilla/PluginBundle/Filter.pm @@ -47,8 +47,7 @@ Dist::Zilla roles: L. sub mvp_multivalue_args { qw(remove -remove) } -sub bundle_config { - my ($self, $section) = @_; +sub bundle_config ($self, $section) { my $class = (ref $self) || $self; my $config = {}; diff --git a/lib/Dist/Zilla/Prereqs.pm b/lib/Dist/Zilla/Prereqs.pm index 0523e1ddb..0c6c75b86 100644 --- a/lib/Dist/Zilla/Prereqs.pm +++ b/lib/Dist/Zilla/Prereqs.pm @@ -81,10 +81,9 @@ If not given, phase and type default to runtime and requires, respectively. =cut -sub register_prereqs { - my $self = shift; - my $arg = ref($_[0]) ? shift(@_) : {}; - my %prereq = @_; +sub register_prereqs ($self, @rest) { + my $arg = ref($rest[0]) ? shift(@rest) : {}; + my %prereq = @rest; my $phase = $arg->{phase} || 'runtime'; my $type = $arg->{type} || 'requires'; @@ -98,18 +97,14 @@ sub register_prereqs { return; } -before 'finalize' => sub { - my ($self) = @_; +before 'finalize' => sub ($self) { $self->sync_runtime_build_test_requires; }; - # this avoids a long-standing CPAN.pm bug that incorrectly merges runtime and # "build" (build+test) requirements by ensuring requirements stay unified # across all three phases -sub sync_runtime_build_test_requires { - my $self = shift; - +sub sync_runtime_build_test_requires ($self) { # first pass: generated merged requirements for my $phase ( qw/runtime build test/ ) { my $req = $self->requirements_for($phase, 'requires'); diff --git a/lib/Dist/Zilla/Role/BuildPL.pm b/lib/Dist/Zilla/Role/BuildPL.pm index 64056fbcc..a3d811e92 100644 --- a/lib/Dist/Zilla/Role/BuildPL.pm +++ b/lib/Dist/Zilla/Role/BuildPL.pm @@ -21,9 +21,7 @@ and L roles yourself. =cut -sub build { - my $self = shift; - +sub build ($self) { return if -e 'Build' and (stat 'Build.PL')[9] <= (stat 'Build')[9]; @@ -36,9 +34,7 @@ sub build { return; } -sub test { - my ($self, $target, $arg) = @_; - +sub test ($self, $target, $arg = {}) { $self->build; my $job_count = $arg && exists $arg->{jobs} diff --git a/lib/Dist/Zilla/Role/ExecFiles.pm b/lib/Dist/Zilla/Role/ExecFiles.pm index f2092f11e..2f1ebc1fd 100644 --- a/lib/Dist/Zilla/Role/ExecFiles.pm +++ b/lib/Dist/Zilla/Role/ExecFiles.pm @@ -10,9 +10,7 @@ use namespace::autoclean; requires 'dir'; -sub find_files { - my ($self) = @_; - +sub find_files ($self) { my $dir = $self->dir; return [ grep { index($_->name, "$dir/") == 0 } $self->zilla->files->@* ]; } diff --git a/lib/Dist/Zilla/Role/File.pm b/lib/Dist/Zilla/Role/File.pm index 6e0eaebfc..986a73255 100644 --- a/lib/Dist/Zilla/Role/File.pm +++ b/lib/Dist/Zilla/Role/File.pm @@ -3,10 +3,11 @@ package Dist::Zilla::Role::File; use Moose::Role; +use Moose::Util::TypeConstraints; + use Dist::Zilla::Dialect; use Dist::Zilla::Types qw(_Filename); -use Moose::Util::TypeConstraints; use Try::Tiny; use namespace::autoclean; @@ -51,21 +52,16 @@ has added_by => ( }, ); -around name => sub { - my $orig = shift; - my $self = shift; - if (@_) { +around name => sub ($orig, $self, @rest) { + if (@rest) { my ($pkg, $line) = $self->_caller_of('name'); $self->_push_added_by(sprintf("filename set by %s (%s line %s)", $self->_caller_plugin_name, $pkg, $line)); } - return $self->$orig(@_); + return $self->$orig(@rest); }; -sub _caller_of { - my ($self, $function) = @_; - - for (my $level = 1; $level < 50; ++$level) - { +sub _caller_of ($self, $function) { + for (my $level = 1; $level < 50; ++$level) { my @frame = caller($level); last if not defined $frame[0]; return ( (caller($level))[0,2] ) if $frame[3] =~ m/::${function}$/; @@ -73,11 +69,8 @@ sub _caller_of { return 'unknown', '0'; } -sub _caller_plugin_name { - my $self = shift; - - for (my $level = 1; $level < 50; ++$level) - { +sub _caller_plugin_name ($self) { + for (my $level = 1; $level < 50; ++$level) { my @frame = caller($level); last if not defined $frame[0]; return $1 if $frame[0] =~ m/^Dist::Zilla::Plugin::(.+)$/; @@ -115,28 +108,23 @@ C will be an error. =cut -sub is_bytes { - my ($self) = @_; - return $self->encoding eq 'bytes'; +sub is_bytes ($self) { + return $self->encoding eq 'bytes'; } -sub _encode { - my ($self, $text) = @_; +sub _encode ($self, $text) { my $enc = $self->encoding; - if ( $self->is_bytes ) { + if ($self->is_bytes) { return $text; # XXX hope you were right that it really was bytes - } - else { + } else { require Encode; - my $bytes = - try { Encode::encode($enc, $text, Encode::FB_CROAK()) } - catch { $self->_throw("encode $enc" => $_) }; + my $bytes = try { Encode::encode($enc, $text, Encode::FB_CROAK()) } + catch { $self->_throw("encode $enc" => $_) }; return $bytes; } } -sub _decode { - my ($self, $bytes) = @_; +sub _decode ($self, $bytes) { my $enc = $self->encoding; if ( $self->is_bytes ) { $self->_throw(decode => "Can't decode text from 'bytes' encoding"); @@ -165,8 +153,7 @@ sub _decode { } } -sub _throw { - my ($self, $op, $msg) = @_; +sub _throw ($self, $op, $msg) { my ($name, $added_by) = map {; $self->$_ } qw/name added_by/; confess( "Could not $op $name; $added_by; error was: $msg; maybe you need the [Encoding] plugin to specify an encoding" diff --git a/lib/Dist/Zilla/Role/FileFinderUser.pm b/lib/Dist/Zilla/Role/FileFinderUser.pm index e4b25e2b3..8dc02eaad 100644 --- a/lib/Dist/Zilla/Role/FileFinderUser.pm +++ b/lib/Dist/Zilla/Role/FileFinderUser.pm @@ -125,17 +125,13 @@ role { my ($finder_arg, @finder_arg_aliases) = $p->finder_arg_names->@*; confess "no finder arg names given!" unless $finder_arg; - around mvp_multivalue_args => sub { - my ($orig, $self) = @_; - + around mvp_multivalue_args => sub ($orig, $self) { my @start = $self->$orig; return (@start, $finder_arg); }; if (@finder_arg_aliases) { - around mvp_aliases => sub { - my ($orig, $self) = @_; - + around mvp_aliases => sub ($orig, $self) { my $start = $self->$orig; for my $alias (@finder_arg_aliases) { @@ -154,9 +150,7 @@ role { default => sub { [ $p->default_finders->@* ] }, ); - method $p->method => sub { - my ($self) = @_; - + method $p->method => sub ($self) { my @filesets = map {; $self->zilla->find_files($_) } $self->$finder_arg->@*; diff --git a/lib/Dist/Zilla/Role/FileMunger.pm b/lib/Dist/Zilla/Role/FileMunger.pm index 81146fbd4..0150d2e73 100644 --- a/lib/Dist/Zilla/Role/FileMunger.pm +++ b/lib/Dist/Zilla/Role/FileMunger.pm @@ -25,9 +25,7 @@ C method. =cut -sub munge_files { - my ($self) = @_; - +sub munge_files ($self) { $self->log_fatal("no munge_file behavior implemented!") unless $self->can('munge_file'); diff --git a/lib/Dist/Zilla/Role/MintingProfile.pm b/lib/Dist/Zilla/Role/MintingProfile.pm index e964c1e93..b86c106b9 100644 --- a/lib/Dist/Zilla/Role/MintingProfile.pm +++ b/lib/Dist/Zilla/Role/MintingProfile.pm @@ -31,9 +31,8 @@ based on your profile with the: requires 'profile_dir'; -around profile_dir => sub { - my ($orig, $self, @args) = @_; - path($self->$orig(@args)); +around profile_dir => sub ($orig, $self, @rest) { + path($self->$orig(@rest)); }; 1; diff --git a/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm b/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm index ba217702e..85afe7a99 100644 --- a/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm +++ b/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm @@ -18,9 +18,7 @@ C method that looks in the I's L. =cut -sub profile_dir { - my ($self, $profile_name) = @_; - +sub profile_dir ($self, $profile_name) { my $profile_dir = path( File::ShareDir::module_dir($self->meta->name) ) ->child( $profile_name ); diff --git a/lib/Dist/Zilla/Role/MutableFile.pm b/lib/Dist/Zilla/Role/MutableFile.pm index 7ddad2efc..cb383fc52 100644 --- a/lib/Dist/Zilla/Role/MutableFile.pm +++ b/lib/Dist/Zilla/Role/MutableFile.pm @@ -3,11 +3,12 @@ package Dist::Zilla::Role::MutableFile; use Moose::Role; +use Moose::Util::TypeConstraints; + use Dist::Zilla::Dialect; use namespace::autoclean; -use Moose::Util::TypeConstraints; use MooseX::SetOnce; =head1 DESCRIPTION @@ -45,24 +46,21 @@ has _content => ( predicate => 'has_content', ); -sub content { - my $self = shift; - if ( ! @_ ) { +sub content ($self, @rest) { + if ( ! @rest ) { # if we have it or we're tasked to provide it, return it (possibly lazily # generated from a builder); otherwise, get it from the encoded_content if ( $self->has_content || $self->_content_source eq 'content' ) { return $self->_content; - } - else { + } else { return $self->_content($self->_decode($self->encoded_content)); } - } - else { + } else { my ($pkg, $line) = $self->_caller_of('content'); $self->_content_source('content'); $self->_push_added_by(sprintf("content set by %s (%s line %s)", $self->_caller_plugin_name, $pkg, $line)); $self->clear_encoded_content; - return $self->_content(@_); + return $self->_content(@rest); } } @@ -79,9 +77,8 @@ has _encoded_content => ( predicate => 'has_encoded_content', ); -sub encoded_content { - my $self = shift; - if ( ! @_ ) { +sub encoded_content ($self, @rest) { + if ( ! @rest ) { # if we have it or we're tasked to provide it, return it (possibly lazily # generated from a builder); otherwise, get it from the content if ($self->has_encoded_content || $self->_content_source eq 'encoded_content') { @@ -95,7 +92,7 @@ sub encoded_content { $self->_content_source('encoded_content'); $self->_push_added_by(sprintf("encoded_content set by %s (%s line %s)", $self->_caller_plugin_name, $pkg, $line)); $self->clear_content; - $self->_encoded_content(@_); + $self->_encoded_content(@rest); } has _content_source => ( @@ -105,8 +102,7 @@ has _content_source => ( builder => '_build_content_source', ); -sub _set_added_by { - my ($self, $value) = @_; +sub _set_added_by ($self, $value) { return $self->_push_added_by(sprintf("%s added by %s", $self->_content_source, $value)); }; diff --git a/lib/Dist/Zilla/Role/PPI.pm b/lib/Dist/Zilla/Role/PPI.pm index 3610bef46..43857e0d1 100644 --- a/lib/Dist/Zilla/Role/PPI.pm +++ b/lib/Dist/Zilla/Role/PPI.pm @@ -27,9 +27,7 @@ document for the same file, this avoids reparsing it. my %CACHE; -sub ppi_document_for_file { - my ($self, $file) = @_; - +sub ppi_document_for_file ($self, $file) { my $encoded_content = $file->encoded_content; # We cache on the MD5 checksum to detect if the document has been modified @@ -58,9 +56,7 @@ It also updates the internal PPI document cache with the new document. =cut -sub save_ppi_document_to_file { - my ($self, $document, $file) = @_; - +sub save_ppi_document_to_file ($self, $document, $file) { my $new_content = $document->serialize; $file->content($new_content); @@ -79,9 +75,7 @@ sigil must be included). =cut -sub document_assigns_to_variable { - my ($self, $document, $variable) = @_; - +sub document_assigns_to_variable ($self, $document, $variable) { my $package_stmts = $document->find('PPI::Statement::Package'); my @namespaces = map { $_->namespace } $package_stmts->@*; diff --git a/lib/Dist/Zilla/Role/Plugin.pm b/lib/Dist/Zilla/Role/Plugin.pm index 84f5d54c5..f13396b8e 100644 --- a/lib/Dist/Zilla/Role/Plugin.pm +++ b/lib/Dist/Zilla/Role/Plugin.pm @@ -4,12 +4,13 @@ package Dist::Zilla::Role::Plugin; use Moose::Role; with 'Dist::Zilla::Role::ConfigDumper'; +use Moose::Util::TypeConstraints 'class_type'; + use Dist::Zilla::Dialect; use namespace::autoclean; use Params::Util qw(_HASHLIKE); -use Moose::Util::TypeConstraints 'class_type'; =head1 DESCRIPTION @@ -53,9 +54,9 @@ has logger => ( is => 'ro', lazy => 1, handles => [ qw(log log_debug log_fatal) ], - default => sub { - $_[0]->zilla->chrome->logger->proxy({ - proxy_prefix => '[' . $_[0]->plugin_name . '] ', + default => sub ($self, @) { + $self->zilla->chrome->logger->proxy({ + proxy_prefix => '[' . $self->plugin_name . '] ', }); }, ); @@ -65,9 +66,7 @@ has logger => ( sub mvp_multivalue_args {}; sub mvp_aliases { return {} }; -sub plugin_from_config { - my ($class, $name, $arg, $section) = @_; - +sub plugin_from_config ($class, $name, $arg, $section) { my $self = $class->new({ %$arg, plugin_name => $name, @@ -75,9 +74,7 @@ sub plugin_from_config { }); } -sub register_component { - my ($class, $name, $arg, $section) = @_; - +sub register_component ($class, $name, $arg, $section) { my $self = $class->plugin_from_config($name, $arg, $section); my $version = $self->VERSION || 0; diff --git a/lib/Dist/Zilla/Role/PluginBundle.pm b/lib/Dist/Zilla/Role/PluginBundle.pm index 225abffeb..a1dd073d2 100644 --- a/lib/Dist/Zilla/Role/PluginBundle.pm +++ b/lib/Dist/Zilla/Role/PluginBundle.pm @@ -16,8 +16,7 @@ configure the bundle. =cut -sub register_component { - my ($class, $name, $arg, $self) = @_; +sub register_component ($class, $name, $arg, $self) { # ... we should register a placeholder so MetaConfig can tell us about the # pluginbundle that was loaded } diff --git a/lib/Dist/Zilla/Role/PluginBundle/Easy.pm b/lib/Dist/Zilla/Role/PluginBundle/Easy.pm index 327c2dbfd..e5bbc3827 100644 --- a/lib/Dist/Zilla/Role/PluginBundle/Easy.pm +++ b/lib/Dist/Zilla/Role/PluginBundle/Easy.pm @@ -99,9 +99,7 @@ has plugins => ( }, ); -sub bundle_config { - my ($class, $section) = @_; - +sub bundle_config ($class, $section) { my $self = $class->new($section); $self->configure; @@ -128,9 +126,7 @@ The plugins are added to the config in the order given. =cut -sub add_plugins { - my ($self, @plugin_specs) = @_; - +sub add_plugins ($self, @plugin_specs) { my $prefix = $self->name . '/'; my $plugins = $self->_plugins; @@ -164,9 +160,7 @@ you omit C<%bundle_config>, an empty hashref will be supplied. =cut -sub add_bundle { - my ($self, $bundle, $payload) = @_; - +sub add_bundle ($self, $bundle, $payload) { my $package = _bundle_class($bundle); $payload ||= {}; @@ -200,14 +194,12 @@ key does not exist in C, then it is omitted from the result. =cut -sub config_slice { - my $self = shift; - +sub config_slice ($self, @rest) { my $payload = $self->payload; my %arg; - foreach my $arg (@_) { + foreach my $arg (@rest) { if (ref $arg) { while (my ($in, $out) = each %$arg) { $arg{$out} = $payload->{$in} if exists $payload->{$in}; diff --git a/lib/Dist/Zilla/Role/PrereqScanner.pm b/lib/Dist/Zilla/Role/PrereqScanner.pm index e0189e0ba..c05609f68 100644 --- a/lib/Dist/Zilla/Role/PrereqScanner.pm +++ b/lib/Dist/Zilla/Role/PrereqScanner.pm @@ -25,8 +25,6 @@ with( use Dist::Zilla::Dialect; -use MooseX::Types; - =attr finder This is the name of a L @@ -64,23 +62,19 @@ has skips => ( default => sub { [] }, ); -around mvp_multivalue_args => sub { - my ($orig, $self) = @_; +around mvp_multivalue_args => sub ($orig, $self) { ($self->$orig, 'skips') }; -around mvp_aliases => sub { - my ($orig, $self) = @_; +around mvp_aliases => sub ($orig, $self) { my $aliases = $self->$orig; - $aliases->{skip} = 'skips'; + $aliases->{skip} = 'skips'; return $aliases }; requires 'scan_file_reqs'; -sub scan_prereqs { - my $self = shift; - +sub scan_prereqs ($self) { require CPAN::Meta::Requirements; require List::Util; List::Util->VERSION(1.45); # uniq diff --git a/lib/Dist/Zilla/Role/Stash.pm b/lib/Dist/Zilla/Role/Stash.pm index fd221cb63..e6944c0fd 100644 --- a/lib/Dist/Zilla/Role/Stash.pm +++ b/lib/Dist/Zilla/Role/Stash.pm @@ -7,9 +7,7 @@ use Dist::Zilla::Dialect; use namespace::autoclean; -sub register_component { - my ($class, $name, $arg, $section) = @_; - +sub register_component ($class, $name, $arg, $section) { # $self->log_debug([ 'online, %s v%s', $self->meta->name, $version ]); my $entry = $class->stash_from_config($name, $arg, $section); @@ -18,9 +16,7 @@ sub register_component { return; } -sub stash_from_config { - my ($class, $name, $arg, $section) = @_; - +sub stash_from_config ($class, $name, $arg, $section) { my $self = $class->new($arg); return $self; } diff --git a/lib/Dist/Zilla/Role/TestRunner.pm b/lib/Dist/Zilla/Role/TestRunner.pm index 9715e754e..5a513705f 100644 --- a/lib/Dist/Zilla/Role/TestRunner.pm +++ b/lib/Dist/Zilla/Role/TestRunner.pm @@ -38,8 +38,7 @@ has default_jobs => ( default => 1, ); -around dump_config => sub { - my ($orig, $self) = @_; +around dump_config => sub ($orig, $self) { my $config = $self->$orig; $config->{'' . __PACKAGE__} = { default_jobs => $self->default_jobs }; diff --git a/lib/Dist/Zilla/Role/TextTemplate.pm b/lib/Dist/Zilla/Role/TextTemplate.pm index 13c99ff54..672a136e7 100644 --- a/lib/Dist/Zilla/Role/TextTemplate.pm +++ b/lib/Dist/Zilla/Role/TextTemplate.pm @@ -46,9 +46,7 @@ C routine. =cut -sub fill_in_string { - my ($self, $string, $stash, $arg) = @_; - +sub fill_in_string ($self, $string, $stash = {}, $arg = {}) { $self->log_fatal("Cannot use undef as a template string") unless defined $string; diff --git a/lib/Dist/Zilla/Tester.pm b/lib/Dist/Zilla/Tester.pm index ddd2e1566..8f788db90 100644 --- a/lib/Dist/Zilla/Tester.pm +++ b/lib/Dist/Zilla/Tester.pm @@ -27,9 +27,7 @@ use Sub::Exporter -setup => { groups => [ default => [ qw(Builder Minter) ] ], }; -sub from_config { - my ($self, @arg) = @_; - +sub from_config ($self, @arg) { # The only thing using a local time zone should be NextRelease. Normally it # defaults to "local," but since some users won't have an automatically # determinable time zone, we'll switch to not-local times for testing. @@ -49,6 +47,8 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } use Moose::Role; + use Dist::Zilla::Dialect; + has tempdir_root => ( is => 'rw', isa => 'Str|Undef', writer => '_set_tempdir_root', @@ -60,15 +60,12 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } ); sub DEMOLISH {} - around DEMOLISH => sub { - my $orig = shift; - my $self = shift; - + around DEMOLISH => sub ($orig, $self, @rest) { # File::Temp deletes the directory when it goes out of scope $self->_clear_tempdir_obj; rmdir $self->tempdir_root if $self->tempdir_root; - return $self->$orig(@_); + return $self->$orig(@rest); }; has tempdir => ( @@ -77,32 +74,25 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } init_arg => undef, ); - sub clear_log_events { - my ($self) = @_; + sub clear_log_events ($self) { $self->chrome->logger->clear_events; } - sub log_events { - my ($self) = @_; + sub log_events ($self) { $self->chrome->logger->events; } - sub log_messages { - my ($self) = @_; + sub log_messages ($self) { [ map {; $_->{message} } $self->chrome->logger->events->@* ]; } - sub slurp_file { - my ($self, $filename) = @_; - + sub slurp_file ($self, $filename) { Dist::Zilla::Path::path( $self->tempdir->child($filename) )->slurp_utf8; } - sub slurp_file_raw { - my ($self, $filename) = @_; - + sub slurp_file_raw ($self, $filename) { Dist::Zilla::Path::path( $self->tempdir->child($filename) )->slurp_raw; @@ -120,6 +110,8 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } extends 'Dist::Zilla::Dist::Builder'; with 'Dist::Zilla::Tester::_Role'; + use Dist::Zilla::Dialect; + use File::Copy::Recursive 0.41 qw(dircopy); use Dist::Zilla::Path; @@ -128,9 +120,7 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } return @$Log_Events; } - around from_config => sub { - my ($orig, $self, $arg, $tester_arg) = @_; - + around from_config => sub ($orig, $self, $arg = {}, $tester_arg = {}) { confess "dist_root required for from_config" unless $arg->{dist_root}; my $source = $arg->{dist_root}; @@ -204,9 +194,7 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } return $zilla; }; - around build_in => sub { - my ($orig, $self, $target) = @_; - + around build_in => sub ($orig, $self, $target = undef) { $target ||= do { my $target = path($self->tempdir)->child('build'); $target->mkpath; @@ -216,9 +204,7 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } return $self->$orig($target); }; - around ['test', 'release'] => sub { - my ($orig, $self) = @_; - + around ['test', 'release'] => sub ($orig, $self) { return $self->$orig; }; @@ -250,6 +236,8 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } extends 'Dist::Zilla::Dist::Minter'; with 'Dist::Zilla::Tester::_Role'; + use Dist::Zilla::Dialect; + use File::Copy::Recursive 0.41 qw(dircopy); use Dist::Zilla::Path; @@ -258,9 +246,7 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } return @$Log_Events; } - sub _mint_target_dir { - my ($self) = @_; - + sub _mint_target_dir ($self) { my $name = $self->name; my $dir = $self->tempdir->child('mint')->absolute; @@ -269,9 +255,7 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } return $dir; } - sub _setup_global_config { - my ($self, $dir, $arg) = @_; - + sub _setup_global_config ($self, $dir, $arg) { my $config_base = path($dir)->child('config'); my $stash_registry = {}; diff --git a/lib/Dist/Zilla/Util.pm b/lib/Dist/Zilla/Util.pm index 130fd7398..deaf0f3e0 100644 --- a/lib/Dist/Zilla/Util.pm +++ b/lib/Dist/Zilla/Util.pm @@ -21,15 +21,13 @@ use Encode (); bless {} => shift; } - sub handle_nonpod { - my ($self, $event) = @_; + sub handle_nonpod ($self, $event) { return if $self->{abstract}; return $self->{abstract} = $1 if $event->{content}=~ /^\s*#+\s*ABSTRACT:[ \t]*(\S.*)$/m; return; } - sub handle_event { - my ($self, $event) = @_; + sub handle_event ($self, $event) { return if $self->{abstract}; if ( ! $self->{in_name} diff --git a/lib/Dist/Zilla/Util/AuthorDeps.pm b/lib/Dist/Zilla/Util/AuthorDeps.pm index ff8172788..d736701a2 100644 --- a/lib/Dist/Zilla/Util/AuthorDeps.pm +++ b/lib/Dist/Zilla/Util/AuthorDeps.pm @@ -9,9 +9,7 @@ use Dist::Zilla::Util; use Path::Tiny; use List::Util 1.45 (); -sub format_author_deps { - my ($reqs, $versions) = @_; - +sub format_author_deps ($reqs, $versions) { my $formatted = ''; foreach my $rec (@$reqs) { my ($mod, $ver) = each %$rec; @@ -21,9 +19,7 @@ sub format_author_deps { return $formatted; } -sub extract_author_deps { - my ($root, $missing) = @_; - +sub extract_author_deps ($root, $missing) { my $ini = path($root, 'dist.ini'); die "dzil authordeps only works on dist.ini files, and you don't have one\n" diff --git a/lib/Test/DZil.pm b/lib/Test/DZil.pm index b5a3097be..24e13c9f1 100644 --- a/lib/Test/DZil.pm +++ b/lib/Test/DZil.pm @@ -62,9 +62,7 @@ do L. =cut -sub is_filelist { - my ($have, $want, $comment) = @_; - +sub is_filelist ($have, $want, $comment = undef) { my @want = @$want; my @have = map { my $str = (blessed $_ and $_->DOES('Dist::Zilla::Role::File')) @@ -85,9 +83,7 @@ C>. =cut -sub is_yaml { - my ($yaml, $want, $comment) = @_; - +sub is_yaml ($yaml, $want, $comment = undef) { my $have = YAML::Tiny->read_string($yaml) or die "Cannot decode YAML"; @@ -104,9 +100,7 @@ C>. =cut -sub is_json { - my ($json, $want, $comment) = @_; - +sub is_json ($json, $want, $comment = undef) { my $have = JSON::MaybeXS->new(ascii => 1)->decode($json) or die "Cannot decode JSON"; @@ -114,10 +108,7 @@ sub is_json { Test::Deep::cmp_deeply($have, $want, $comment); } -sub _build_ini_builder { - my ($starting_core) = @_; - $starting_core ||= {}; - +sub _build_ini_builder ($starting_core = {}) { sub { my (@arg) = @_; my $new_core = _HASH0($arg[0]) ? shift(@arg) : {}; diff --git a/t/lib/Dist/Zilla/Stash/Heap.pm b/t/lib/Dist/Zilla/Stash/Heap.pm index dd74b8234..756758189 100644 --- a/t/lib/Dist/Zilla/Stash/Heap.pm +++ b/t/lib/Dist/Zilla/Stash/Heap.pm @@ -9,14 +9,11 @@ has payload => ( required => 1, ); -sub value { - my ($self, $name) = @_; +sub value ($self, $name) { $self->payload->{ $name }; } -sub stash_from_config { - my ($class, $name, $arg, $section) = @_; - +sub stash_from_config ($class, $name, $arg, $section) { my $self = $class->new({ payload => $arg }); return $self; } From 6bbe36c5ad0fb47119311c9d06f7dcf3df1249e7 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Sat, 15 Dec 2018 18:16:18 -0800 Subject: [PATCH 18/20] v7 only supports perl 5.20+ --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a4a6a3318..5ee5fa25b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,6 @@ perl: - "5.24" - "5.22" - "5.20" - - "5.18" - - "5.16" - - "5.14" before_install: - git clone git://github.com/travis-perl/helpers ~/travis-perl-helpers - source ~/travis-perl-helpers/init From 2f836ca309ce1ef9ceda5f8bde7ab90d659ad83e Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Thu, 30 Jan 2014 21:48:12 -0800 Subject: [PATCH 19/20] dump configs in all plugins that have one --- Changes | 1 + corpus/dist/AuthorDeps/dist.ini | 2 ++ corpus/dist/AutoPrereqs/dist.ini | 2 ++ corpus/dist/DZ-NonAscii/dist.ini | 1 + corpus/dist/DZ1/dist.ini | 1 + lib/Dist/Zilla/Plugin/AutoPrereqs.pm | 15 +++++++++++++++ lib/Dist/Zilla/Plugin/AutoVersion.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/CPANFile.pm | 11 +++++++++++ lib/Dist/Zilla/Plugin/Encoding.pm | 14 ++++++++++++++ lib/Dist/Zilla/Plugin/ExecDir.pm | 12 ++++++++++++ lib/Dist/Zilla/Plugin/FakeRelease.pm | 11 +++++++++++ lib/Dist/Zilla/Plugin/FileFinder/ByName.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/FileFinder/Filter.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/FinderCode.pm | 11 +++++++++++ lib/Dist/Zilla/Plugin/GenerateFile.pm | 14 ++++++++++++++ lib/Dist/Zilla/Plugin/License.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/MakeMaker.pm | 14 ++++++++++++++ lib/Dist/Zilla/Plugin/ManifestSkip.pm | 11 +++++++++++ lib/Dist/Zilla/Plugin/MetaJSON.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/MetaNoIndex.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/MetaResources.pm | 11 +++++++++++ lib/Dist/Zilla/Plugin/MetaYAML.pm | 11 +++++++++++ lib/Dist/Zilla/Plugin/ModuleBuild.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/ModuleShareDirs.pm | 12 ++++++++++++ lib/Dist/Zilla/Plugin/NextRelease.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/PkgVersion.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/PodVersion.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/PruneCruft.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/PruneFiles.pm | 13 +++++++++++++ lib/Dist/Zilla/Plugin/ShareDir.pm | 12 ++++++++++++ lib/Dist/Zilla/Role/Plugin.pm | 11 +++++++++++ lib/Dist/Zilla/Role/PrereqScanner.pm | 14 ++++++++++++++ t/commands/authordeps.t | 2 +- 33 files changed, 348 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 19aab512e..62006a4d2 100644 --- a/Changes +++ b/Changes @@ -24,6 +24,7 @@ Revision history for {{$dist->name}} release test (thanks, Karen Etheridge) - all builds now result in a .build/latest symlink (thanks again, Karen) + - more plugins add their config to metadata when [MetaConfig] is used 6.012 2018-04-21 10:20:21+02:00 Europe/Oslo - revert addition of Archive::Tar::Wrapper as a mandatory prereq (in diff --git a/corpus/dist/AuthorDeps/dist.ini b/corpus/dist/AuthorDeps/dist.ini index 7a5abf8ef..1e05044a0 100644 --- a/corpus/dist/AuthorDeps/dist.ini +++ b/corpus/dist/AuthorDeps/dist.ini @@ -25,3 +25,5 @@ skip = ^DZPA::Skip :version = 5.0 encoding = bytes filename = t/data.bin + +[MetaConfig] diff --git a/corpus/dist/AutoPrereqs/dist.ini b/corpus/dist/AutoPrereqs/dist.ini index 34e0f681e..47208bcd2 100644 --- a/corpus/dist/AutoPrereqs/dist.ini +++ b/corpus/dist/AutoPrereqs/dist.ini @@ -25,3 +25,5 @@ Archive::Tar::Wrapper = 0.15 [Prereqs / RuntimeSuggests] PPI::XS = 1.23 + +[MetaConfig] diff --git a/corpus/dist/DZ-NonAscii/dist.ini b/corpus/dist/DZ-NonAscii/dist.ini index 46e0c934a..e7c4ce5c7 100644 --- a/corpus/dist/DZ-NonAscii/dist.ini +++ b/corpus/dist/DZ-NonAscii/dist.ini @@ -8,3 +8,4 @@ copyright_holder = ภูมิพลอดุลยเดช [@Classic] [MetaJSON] [NextRelease] +[MetaConfig] diff --git a/corpus/dist/DZ1/dist.ini b/corpus/dist/DZ1/dist.ini index 1215b7e23..1ed1b5fe5 100644 --- a/corpus/dist/DZ1/dist.ini +++ b/corpus/dist/DZ1/dist.ini @@ -5,3 +5,4 @@ license = Perl_5 copyright_holder = E. Xavier Ample [@Classic] +[MetaConfig] diff --git a/lib/Dist/Zilla/Plugin/AutoPrereqs.pm b/lib/Dist/Zilla/Plugin/AutoPrereqs.pm index a8b66fd47..70bd1d156 100644 --- a/lib/Dist/Zilla/Plugin/AutoPrereqs.pm +++ b/lib/Dist/Zilla/Plugin/AutoPrereqs.pm @@ -140,6 +140,21 @@ sub scan_file_reqs ($self, $file) { return $self->_scanner->scan_ppi_document($self->ppi_document_for_file($file)) } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = +{ + (map { $_ => [ sort @{ $self->$_ } ] } qw(extra_scanners)), + (map { $_ => $self->$_ } qw(type)), + ($self->has_scanners ? (scanners => $self->scanners) : ()), + }; + + return $config; +}; + sub register_prereqs ($self) { my $type = $self->type; diff --git a/lib/Dist/Zilla/Plugin/AutoVersion.pm b/lib/Dist/Zilla/Plugin/AutoVersion.pm index 29d224cdd..3e08da935 100644 --- a/lib/Dist/Zilla/Plugin/AutoVersion.pm +++ b/lib/Dist/Zilla/Plugin/AutoVersion.pm @@ -66,6 +66,19 @@ has format => ( . q<{{$ENV{DEV} ? (sprintf '_%03u', $ENV{DEV}) : ''}}> ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => $self->$_ } qw(major format time_zone), + }; + + return $config; +}; + sub provide_version ($self) { if (exists $ENV{V}) { $self->log_debug([ 'providing version %s', $ENV{V} ]); diff --git a/lib/Dist/Zilla/Plugin/CPANFile.pm b/lib/Dist/Zilla/Plugin/CPANFile.pm index 58339ed67..4d0c930f8 100644 --- a/lib/Dist/Zilla/Plugin/CPANFile.pm +++ b/lib/Dist/Zilla/Plugin/CPANFile.pm @@ -53,6 +53,17 @@ sub _hunkify_hunky_hunk_hunks ($self, $indent, $type, $req) { return $str; } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { filename => $self->filename }; + + return $config; +}; + sub gather_files ($self) { my $zilla = $self->zilla; diff --git a/lib/Dist/Zilla/Plugin/Encoding.pm b/lib/Dist/Zilla/Plugin/Encoding.pm index 38ec2335e..80d13df2f 100644 --- a/lib/Dist/Zilla/Plugin/Encoding.pm +++ b/lib/Dist/Zilla/Plugin/Encoding.pm @@ -80,6 +80,20 @@ has ignore => ( default => sub { [] }, ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + encoding => $self->encoding, + map { $_ => [ sort @{ $self->$_ } ] } qw(filenames matches), + }; + + return $config; +}; + sub set_file_encodings ($self) { # never match (at least the filename characters) my $matches_regex = qr/\000/; diff --git a/lib/Dist/Zilla/Plugin/ExecDir.pm b/lib/Dist/Zilla/Plugin/ExecDir.pm index b796281ba..4b47a46f6 100644 --- a/lib/Dist/Zilla/Plugin/ExecDir.pm +++ b/lib/Dist/Zilla/Plugin/ExecDir.pm @@ -25,5 +25,17 @@ has dir => ( ); with 'Dist::Zilla::Role::ExecFiles'; + +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { dir => $self->dir }; + + return $config; +}; + __PACKAGE__->meta->make_immutable; 1; diff --git a/lib/Dist/Zilla/Plugin/FakeRelease.pm b/lib/Dist/Zilla/Plugin/FakeRelease.pm index 4014b3475..2276e5442 100644 --- a/lib/Dist/Zilla/Plugin/FakeRelease.pm +++ b/lib/Dist/Zilla/Plugin/FakeRelease.pm @@ -17,6 +17,17 @@ has user => ( sub cpanid { shift->user } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { user => $self->user }; + + return $config; +}; + sub release ($self, $) { for my $env ( 'DIST_ZILLA_FAKERELEASE_FAIL', # old diff --git a/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm b/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm index afabd121e..8ebb4c78f 100644 --- a/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm +++ b/lib/Dist/Zilla/Plugin/FileFinder/ByName.pm @@ -105,6 +105,19 @@ my sub _join_re ($list) { qr/$re/ } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => [ sort @{ $self->$_ } ] } qw(dirs files matches skips), + }; + + return $config; +}; + sub find_files ($self) { my $skip = _join_re($self->skips); my $dir = _join_re([ map { qr!^\Q$_/! } $self->dirs->@* ]); diff --git a/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm b/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm index 09b346bbe..09c9a0c34 100644 --- a/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm +++ b/lib/Dist/Zilla/Plugin/FileFinder/Filter.pm @@ -62,6 +62,19 @@ sub mvp_aliases { +{ qw( sub mvp_multivalue_args { qw(skips) } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => [ sort @{ $self->$_ } ] } qw(finder skips), + }; + + return $config; +}; + sub find_files ($self) { my $files = $self->found_files; diff --git a/lib/Dist/Zilla/Plugin/FinderCode.pm b/lib/Dist/Zilla/Plugin/FinderCode.pm index dd8e53167..3b25f49ee 100644 --- a/lib/Dist/Zilla/Plugin/FinderCode.pm +++ b/lib/Dist/Zilla/Plugin/FinderCode.pm @@ -22,6 +22,17 @@ has style => ( required => 1, ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { style => $self->style }; + + return $config; +}; + sub find_files ($self) { my $method = '_find_via_' . $self->style; diff --git a/lib/Dist/Zilla/Plugin/GenerateFile.pm b/lib/Dist/Zilla/Plugin/GenerateFile.pm index c3af8a54f..7895d63d5 100644 --- a/lib/Dist/Zilla/Plugin/GenerateFile.pm +++ b/lib/Dist/Zilla/Plugin/GenerateFile.pm @@ -105,6 +105,20 @@ has name_is_template => ( default => 0, ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + filename => $self->filename, + map { $_ => $self->$_ ? 1 : 0 } qw(content_is_template name_is_template), + }; + + return $config; +}; + sub gather_files ($self, $arg = {}) { my $file = Dist::Zilla::File::InMemory->new({ name => $self->_filename, diff --git a/lib/Dist/Zilla/Plugin/License.pm b/lib/Dist/Zilla/Plugin/License.pm index 17e8b6bd8..e2be96aab 100644 --- a/lib/Dist/Zilla/Plugin/License.pm +++ b/lib/Dist/Zilla/Plugin/License.pm @@ -28,6 +28,19 @@ has filename => ( default => 'LICENSE', ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + filename => $self->filename, + }; + + return $config; +}; + sub gather_files ($self) { my $file = Dist::Zilla::File::InMemory->new({ name => $self->filename, diff --git a/lib/Dist/Zilla/Plugin/MakeMaker.pm b/lib/Dist/Zilla/Plugin/MakeMaker.pm index d9a0365f3..ee32e814b 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker.pm @@ -92,6 +92,20 @@ with qw( Dist::Zilla::Role::TextTemplate ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + make_path => $self->make_path, + # default_jobs is dumped by TestRunner + }; + + return $config; +}; + my $template = q!# This file was automatically generated by {{ $generated_by }}. use strict; use warnings; diff --git a/lib/Dist/Zilla/Plugin/ManifestSkip.pm b/lib/Dist/Zilla/Plugin/ManifestSkip.pm index d67ec6d59..40683b822 100644 --- a/lib/Dist/Zilla/Plugin/ManifestSkip.pm +++ b/lib/Dist/Zilla/Plugin/ManifestSkip.pm @@ -35,6 +35,17 @@ Other modules: L. has skipfile => (is => 'ro', required => 1, default => 'MANIFEST.SKIP'); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { skipfile => $self->skipfile }; + + return $config; +}; + sub prune_files ($self) { my $files = $self->zilla->files; diff --git a/lib/Dist/Zilla/Plugin/MetaJSON.pm b/lib/Dist/Zilla/Plugin/MetaJSON.pm index 78739acd9..ec51bbc79 100644 --- a/lib/Dist/Zilla/Plugin/MetaJSON.pm +++ b/lib/Dist/Zilla/Plugin/MetaJSON.pm @@ -51,6 +51,19 @@ has version => ( default => '2', ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => $self->$_ } qw(filename version), + }; + + return $config; +}; + sub gather_files ($self) { my $zilla = $self->zilla; diff --git a/lib/Dist/Zilla/Plugin/MetaNoIndex.pm b/lib/Dist/Zilla/Plugin/MetaNoIndex.pm index 6712df430..a06d71ee1 100644 --- a/lib/Dist/Zilla/Plugin/MetaNoIndex.pm +++ b/lib/Dist/Zilla/Plugin/MetaNoIndex.pm @@ -94,6 +94,19 @@ for my $attr (keys %ATTR_ALIAS) { ); } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => [ sort @{ $self->$_ } ] } qw(directories files packages namespaces), + }; + + return $config; +}; + =method metadata Returns a reference to a hash containing the distribution's no_index metadata. diff --git a/lib/Dist/Zilla/Plugin/MetaResources.pm b/lib/Dist/Zilla/Plugin/MetaResources.pm index 42c61cc4b..7d391a163 100644 --- a/lib/Dist/Zilla/Plugin/MetaResources.pm +++ b/lib/Dist/Zilla/Plugin/MetaResources.pm @@ -63,6 +63,17 @@ around BUILDARGS => sub ($orig, $class, @rest) { }; }; +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { resources => $self->resources }; + + return $config; +}; + sub metadata ($self) { return { resources => $self->resources }; } diff --git a/lib/Dist/Zilla/Plugin/MetaYAML.pm b/lib/Dist/Zilla/Plugin/MetaYAML.pm index e0494400d..535544fcf 100644 --- a/lib/Dist/Zilla/Plugin/MetaYAML.pm +++ b/lib/Dist/Zilla/Plugin/MetaYAML.pm @@ -28,6 +28,17 @@ has filename => ( default => 'META.yml', ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { filename => $self->filename }; + + return $config; +}; + sub gather_files ($self) { require Dist::Zilla::File::FromCode; require YAML::Tiny; diff --git a/lib/Dist/Zilla/Plugin/ModuleBuild.pm b/lib/Dist/Zilla/Plugin/ModuleBuild.pm index 3d1486bf3..bc6197bbd 100644 --- a/lib/Dist/Zilla/Plugin/ModuleBuild.pm +++ b/lib/Dist/Zilla/Plugin/ModuleBuild.pm @@ -126,6 +126,19 @@ sub _add_build_elements { return '$build->add_build_element($_) for qw(' . join(' ', @elems) . ');'; } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => $self->$_ } qw(mb_version mb_class mb_lib), + }; + + return $config; +}; + sub register_prereqs ($self) { $self->zilla->register_prereqs( { phase => 'configure' }, diff --git a/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm b/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm index ac07d26f2..9f3047992 100644 --- a/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm +++ b/lib/Dist/Zilla/Plugin/ModuleShareDirs.pm @@ -59,5 +59,17 @@ around BUILDARGS => sub ($orig, $class, @rest) { }; with 'Dist::Zilla::Role::ShareDir'; + +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { module_map => $self->_module_map }; + + return $config; +}; + __PACKAGE__->meta->make_immutable; 1; diff --git a/lib/Dist/Zilla/Plugin/NextRelease.pm b/lib/Dist/Zilla/Plugin/NextRelease.pm index 20ca11ef2..a5103e153 100644 --- a/lib/Dist/Zilla/Plugin/NextRelease.pm +++ b/lib/Dist/Zilla/Plugin/NextRelease.pm @@ -107,6 +107,19 @@ sub section_header { return _format_version($self->format, $self); } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => $self->$_ } qw(time_zone format filename update_filename user_stash), + }; + + return $config; +}; + has _original_changes_content => ( is => 'rw', isa => 'Str', diff --git a/lib/Dist/Zilla/Plugin/PkgVersion.pm b/lib/Dist/Zilla/Plugin/PkgVersion.pm index 918175fa7..66e219a0d 100644 --- a/lib/Dist/Zilla/Plugin/PkgVersion.pm +++ b/lib/Dist/Zilla/Plugin/PkgVersion.pm @@ -110,6 +110,19 @@ sub BUILD ($self, @) { } } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => $self->$_ ? 1 : 0 } qw(die_on_existing_version die_on_line_insertion), + }; + + return $config; +}; + sub munge_files ($self) { $self->munge_file($_) for $self->found_files->@*; } diff --git a/lib/Dist/Zilla/Plugin/PodVersion.pm b/lib/Dist/Zilla/Plugin/PodVersion.pm index f16631b4f..36bcb30fa 100644 --- a/lib/Dist/Zilla/Plugin/PodVersion.pm +++ b/lib/Dist/Zilla/Plugin/PodVersion.pm @@ -27,6 +27,19 @@ section). =cut +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + finder => [ sort @{ $self->finder } ], + }; + + return $config; +}; + sub munge_files ($self) { $self->munge_file($_) for $self->found_files->@*; } diff --git a/lib/Dist/Zilla/Plugin/PruneCruft.pm b/lib/Dist/Zilla/Plugin/PruneCruft.pm index f5b1aa4ae..1041fafe2 100644 --- a/lib/Dist/Zilla/Plugin/PruneCruft.pm +++ b/lib/Dist/Zilla/Plugin/PruneCruft.pm @@ -84,6 +84,19 @@ sub exclude_file ($self, $file) { return; } +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + except => [ sort @{ $self->except } ], + }; + + return $config; +}; + sub prune_files ($self) { # Copy list (break reference) so we can mutate. for my $file ((), $self->zilla->files->@*) { diff --git a/lib/Dist/Zilla/Plugin/PruneFiles.pm b/lib/Dist/Zilla/Plugin/PruneFiles.pm index f6ed7f187..7c0d03531 100644 --- a/lib/Dist/Zilla/Plugin/PruneFiles.pm +++ b/lib/Dist/Zilla/Plugin/PruneFiles.pm @@ -57,6 +57,19 @@ has matches => ( default => sub { [] }, ); +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + map { $_ => [ sort @{ $self->$_ } ] } qw(filenames matches), + }; + + return $config; +}; + sub prune_files ($self) { # never match (at least the filename characters) my $matches_regex = qr/\000/; diff --git a/lib/Dist/Zilla/Plugin/ShareDir.pm b/lib/Dist/Zilla/Plugin/ShareDir.pm index 9436100ae..063f28aa7 100644 --- a/lib/Dist/Zilla/Plugin/ShareDir.pm +++ b/lib/Dist/Zilla/Plugin/ShareDir.pm @@ -37,5 +37,17 @@ sub share_dir_map ($self) { } with 'Dist::Zilla::Role::ShareDir'; + +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { dir => $self->dir }; + + return $config; +}; + __PACKAGE__->meta->make_immutable; 1; diff --git a/lib/Dist/Zilla/Role/Plugin.pm b/lib/Dist/Zilla/Role/Plugin.pm index f13396b8e..d3a2c732e 100644 --- a/lib/Dist/Zilla/Role/Plugin.pm +++ b/lib/Dist/Zilla/Role/Plugin.pm @@ -86,4 +86,15 @@ sub register_component ($class, $name, $arg, $section) { return; } +around dump_config => sub { + my ($orig, $self) = @_; + my $config = $self->$orig; + + $config->{'' . __PACKAGE__} = { + version => $self->VERSION, + }; + + return $config; +}; + 1; diff --git a/lib/Dist/Zilla/Role/PrereqScanner.pm b/lib/Dist/Zilla/Role/PrereqScanner.pm index c05609f68..c3dcb8199 100644 --- a/lib/Dist/Zilla/Role/PrereqScanner.pm +++ b/lib/Dist/Zilla/Role/PrereqScanner.pm @@ -172,6 +172,20 @@ sub scan_prereqs ($self) { return \%reqs_by_phase } +requires 'dump_config'; # via Dist::Zilla::Role::Plugin +around dump_config => sub { + my $orig = shift; + my $self = shift; + + my $config = $self->$orig; + + $config->{+__PACKAGE__} = { + (map { $_ => [ sort @{ $self->$_ // [] } ] } qw(finder test_finder configure_finder skips)), + }; + + return $config; +}; + 1; __END__ diff --git a/t/commands/authordeps.t b/t/commands/authordeps.t index eb46dca6b..33c78b6d8 100644 --- a/t/commands/authordeps.t +++ b/t/commands/authordeps.t @@ -21,7 +21,7 @@ cmp_deeply( +{ 'Foo::Bar' => '1.23' }, +{ 'Dist::Zilla' => '5.001' }, ( map { +{"Dist::Zilla::Plugin::$_" => '5.0'} } qw ), - ( map { +{"Dist::Zilla::Plugin::$_" => 0} } qw ), + ( map { +{"Dist::Zilla::Plugin::$_" => 0} } qw ), +{ 'Software::License::Perl_5' => '0' }, ], "authordeps in corpus/dist/AuthorDeps" From 39e085655a2b458f308e16f96f626bde45cf1937 Mon Sep 17 00:00:00 2001 From: Karen Etheridge Date: Fri, 31 Jan 2014 19:37:59 -0800 Subject: [PATCH 20/20] more tests if you want em --- t/plugins/autoprereqs.t | 2 ++ t/plugins/autoversion.t | 1 + t/plugins/confirmrelease.t | 2 +- t/plugins/extratests.t | 2 +- t/plugins/fakerelease.t | 7 ++++--- t/plugins/ffbyname.t | 8 ++++++-- t/plugins/filefinders.t | 1 + t/plugins/generatefile.t | 2 ++ 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/t/plugins/autoprereqs.t b/t/plugins/autoprereqs.t index 3f5977036..1287bbeec 100644 --- a/t/plugins/autoprereqs.t +++ b/t/plugins/autoprereqs.t @@ -63,6 +63,7 @@ $tzil = Builder->from_config( qw(GatherDir ExecDir), [ AutoPrereqs => { skip => '^DZPA::Skip', configure_finder => ':IncModules' } ], + [ MetaConfig => ], ), 'source/inc/DZPA.pm' => "use DZPA::NotInDist;\n use DZPA::Configure;\n", }, @@ -178,6 +179,7 @@ $tzil = Builder->from_config( 'source/dist.ini' => simple_ini( qw(GatherDir ExecDir), [ AutoPrereqs => { scanner => 'Perl5', extra_scanner => 'Aliased' } ], + [ MetaConfig => ], ), 'source/lib/DZPA/Aliased.pm' => "use aliased 'Long::Class::Name';\n", }, diff --git a/t/plugins/autoversion.t b/t/plugins/autoversion.t index a4e4c6d90..bd252d48b 100644 --- a/t/plugins/autoversion.t +++ b/t/plugins/autoversion.t @@ -16,6 +16,7 @@ delete $ENV{V}; { version => undef }, 'GatherDir', [ AutoVersion => { major => 6, format => '{{$major}}.{{$^T}}' } ], + [ MetaConfig => ], ), }, }, diff --git a/t/plugins/confirmrelease.t b/t/plugins/confirmrelease.t index 5338de101..25290696f 100644 --- a/t/plugins/confirmrelease.t +++ b/t/plugins/confirmrelease.t @@ -11,7 +11,7 @@ sub new_tzil { { add_files => { 'source/dist.ini' => - simple_ini(qw(GatherDir ConfirmRelease FakeRelease)), + simple_ini(qw(GatherDir ConfirmRelease FakeRelease MetaConfig)), }, }, ); diff --git a/t/plugins/extratests.t b/t/plugins/extratests.t index cd64aedd3..442d5f9de 100644 --- a/t/plugins/extratests.t +++ b/t/plugins/extratests.t @@ -27,7 +27,7 @@ my $tzil = Builder->from_config( { dist_root => 'corpus/dist/DZT' }, { add_files => { - 'source/dist.ini' => simple_ini(qw), + 'source/dist.ini' => simple_ini(qw), (map {; "source/xt/$_/huffer.t" => sprintf($generic_test, $_) } @xt_types, qw(blort)) }, diff --git a/t/plugins/fakerelease.t b/t/plugins/fakerelease.t index 7f0912c3f..1c07ba20a 100644 --- a/t/plugins/fakerelease.t +++ b/t/plugins/fakerelease.t @@ -10,7 +10,7 @@ use Test::Fatal qw(exception); { dist_root => 'corpus/dist/DZT' }, { add_files => { - 'source/dist.ini' => simple_ini(qw(GatherDir FakeRelease)), + 'source/dist.ini' => simple_ini(qw(GatherDir FakeRelease MetaConfig)), }, }, ); @@ -32,7 +32,8 @@ use Test::Fatal qw(exception); [ '@Filter' => { bundle => '@FakeClassic', remove => 'ConfirmRelease', - } ] + } ], + 'MetaConfig', ), }, }, @@ -52,7 +53,7 @@ use Test::Fatal qw(exception); { dist_root => 'corpus/dist/DZT' }, { add_files => { - 'source/dist.ini' => simple_ini(qw(GatherDir FakeRelease)), + 'source/dist.ini' => simple_ini(qw(GatherDir FakeRelease MetaConfig)), }, }, ); diff --git a/t/plugins/ffbyname.t b/t/plugins/ffbyname.t index 4bf9118ec..4be639aa2 100644 --- a/t/plugins/ffbyname.t +++ b/t/plugins/ffbyname.t @@ -77,7 +77,8 @@ sub make_tzil { #--------------------------------------------------------------------- make_tzil([ 'FileFinder::ByName' => {qw(dir corpus skip archives)}], - [ 'FileFinder::Filter' => {qw(finder FileFinder::ByName skip DZT)}]); + [ 'FileFinder::Filter' => {qw(finder FileFinder::ByName skip DZT)}], + [ 'MetaConfig']); is_found('FileFinder::ByName' => [qw( corpus/DZT/README @@ -105,6 +106,7 @@ make_tzil( { finder => [qw(InBin AllPerl Plugins Synopsis)] }], [ 'FileFinder::Filter' => NoPluginM => { finder => 'AllPerl', skip => 'Plugin/M' }], + [ 'MetaConfig'], ); is_found(InBin => [qw( @@ -176,7 +178,9 @@ is_found(NoPluginM => [qw( #--------------------------------------------------------------------- make_tzil([ 'FileFinder::ByName' => 'Everything' ], [ 'FileFinder::ByName' => 'EverythingButPerl' => - {skip => [qw( \.t$ (?i)\.p[lm]$ )]} ]); + {skip => [qw( \.t$ (?i)\.p[lm]$ )]} ], + [ 'MetaConfig'], +); is_found(Everything => [ map { $_->name } @dist_files ]); diff --git a/t/plugins/filefinders.t b/t/plugins/filefinders.t index 20ff79899..8b31d03c0 100644 --- a/t/plugins/filefinders.t +++ b/t/plugins/filefinders.t @@ -34,6 +34,7 @@ my $tzil = Builder->from_config( [ ExecDir => ], [ ShareDir => ], 'Manifest', + 'MetaConfig', ), (map {; "source/xt${_}more.t" => $generic_test } qw(/author/ /smoke/ /release/ /)), diff --git a/t/plugins/generatefile.t b/t/plugins/generatefile.t index ec55177e9..1c7d2002a 100644 --- a/t/plugins/generatefile.t +++ b/t/plugins/generatefile.t @@ -30,6 +30,7 @@ my $tzil = Builder->from_config( ], } ], + 'MetaConfig', ) }, }, @@ -96,6 +97,7 @@ $tzil = Builder->from_config( ], } ], + 'MetaConfig', ) }, },