From 2d3b05f1a7a329086c50d1e777c8bad1e91d27db Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Mon, 23 Apr 2018 00:50:54 +0200 Subject: [PATCH] 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/AuthorDeps.pm | 8 +- lib/Test/DZil.pm | 17 +-- t/lib/Dist/Zilla/Stash/Heap.pm | 7 +- 98 files changed, 376 insertions(+), 843 deletions(-) diff --git a/lib/Dist/Zilla.pm b/lib/Dist/Zilla.pm index 6d5bb143e..cfcd3e6e5 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 = {}; @@ -690,8 +671,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; @@ -708,9 +688,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; @@ -737,9 +715,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); @@ -749,9 +725,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->@*) { @@ -775,9 +749,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); @@ -814,13 +786,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; @@ -850,9 +821,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 a9480c28f..128d46117 100644 --- a/lib/Dist/Zilla/App/Command/authordeps.pm +++ b/lib/Dist/Zilla/App/Command/authordeps.pm @@ -34,9 +34,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 8ab1f9af1..02f71d97c 100644 --- a/lib/Dist/Zilla/App/Command/release.pm +++ b/lib/Dist/Zilla/App/Command/release.pm @@ -48,9 +48,7 @@ sub opt_spec { [ 'jobs|j=i' => 'number of parallel test jobs to run' ], } -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 fd99bff14..7e7e432e4 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 083dce6b5..5ea8b401f 100644 --- a/lib/Dist/Zilla/Plugin/CPANFile.pm +++ b/lib/Dist/Zilla/Plugin/CPANFile.pm @@ -68,9 +68,7 @@ has comment => ( } ); -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); @@ -80,9 +78,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 4d9bda904..a8a12e607 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 dcc57b473..f733da7ff 100644 --- a/lib/Dist/Zilla/Plugin/PodCoverageTests.pm +++ b/lib/Dist/Zilla/Plugin/PodCoverageTests.pm @@ -39,9 +39,7 @@ One can run the release tests by invoking C. # 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 00f8d2b4b..d4d63ef69 100644 --- a/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm +++ b/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm @@ -30,12 +30,9 @@ One can run the release tests by invoking C. =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', @@ -45,7 +42,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 397855baf..91231a2fa 100644 --- a/lib/Dist/Zilla/Role/TestRunner.pm +++ b/lib/Dist/Zilla/Role/TestRunner.pm @@ -41,8 +41,7 @@ has default_jobs => ( }, ); -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 099312d1f..a64f2aad3 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) { # Sometimes, we can't get a local time zone. When that happens, we're just # going to pretend to be in UTC. We don't do this during actual runtime # because the user can fix their own environment, but we'll let them do @@ -223,9 +211,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; }; @@ -257,6 +243,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; @@ -265,9 +253,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; @@ -276,9 +262,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/AuthorDeps.pm b/lib/Dist/Zilla/Util/AuthorDeps.pm index bb2f695c8..c5ee5b249 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; }