From 58ad6eca281855145f6ca90c94a1f2312ff4278b Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 28 May 2022 12:36:03 -0400 Subject: [PATCH 1/4] WIP: turn on signatures --- lib/Dist/Zilla.pm | 54 +++++++++++++---------------------------------- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/lib/Dist/Zilla.pm b/lib/Dist/Zilla.pm index a8a5c8f30..c06ca18a1 100644 --- a/lib/Dist/Zilla.pm +++ b/lib/Dist/Zilla.pm @@ -87,9 +87,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); @@ -104,9 +102,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) }) { @@ -157,9 +153,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,8 +184,7 @@ has _release_status_from_env => ( builder => '_build_release_status_from_env', ); -sub _build_release_status_from_env { - my ($self) = @_; +sub _build_release_status_from_env ($self) { return $ENV{RELEASE_STATUS} if $ENV{RELEASE_STATUS}; return $ENV{TRIAL} ? 'testing' : ''; } @@ -328,9 +321,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; @@ -498,8 +489,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) { @@ -549,9 +539,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 @@ -587,9 +576,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 = {}; @@ -655,8 +642,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; @@ -673,9 +659,7 @@ dash is 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 } ]; @@ -693,9 +677,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); @@ -705,9 +687,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 }) { @@ -731,9 +711,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); @@ -806,9 +784,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 }; } From e9179b360856b4659309678d168217eb075b4187 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sat, 28 May 2022 13:31:47 -0400 Subject: [PATCH 2/4] use subroutine signatures! First, I used a small program (included below) to automatically convert existing subroutines, which use @_, to use signatures. This will not have been comprehensive. Some use "shift" to get signatures. Also, the program will not upgrade anonymous subroutines. And there are probably other shortfalls. Then, I ran the tests repeatedly and corrected errors that were exposed, most of which were related to arguments that were optional but had been (of course) converted to mandatory arguments. This may well affect some plugins downstream, so we'll want to do a bunch of testing before deciding this is a good idea! #!/bin/env perl use v5.36.0; my $fn = $ARGV[0]; my @output; { open my $fh, '<', $fn; my @input = <$fh>; LINE: while (my $line = shift @input) { if ($line =~ /^sub (\S+) \{$/) { my $sub = $1; my $next = shift @input; if ($next && $next =~ /^\s*my (\([^)]+\)) = \@_;$/) { my $sig = $1; my $new_line = "sub $sub $sig {\n"; warn $new_line; push @output, $new_line; while (@input && $input[0] !~ /\S/) { shift @input; } next LINE; } unshift @input, $next; } push @output, $line; } } open my $fh, '>', $fn; print {$fh} @output; close $fh; --- lib/Dist/Zilla/App.pm | 15 ++-- 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 | 4 +- 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 | 4 +- lib/Dist/Zilla/App/Command/test.pm | 4 +- lib/Dist/Zilla/App/Tester.pm | 5 +- lib/Dist/Zilla/Chrome/Term.pm | 13 ++-- lib/Dist/Zilla/Chrome/Test.pm | 5 +- lib/Dist/Zilla/Dist/Builder.pm | 69 +++++-------------- lib/Dist/Zilla/Dist/Minter.pm | 15 ++-- lib/Dist/Zilla/File/FromCode.pm | 18 ++--- lib/Dist/Zilla/File/OnDisk.pm | 3 +- lib/Dist/Zilla/MVP/Assembler.pm | 3 +- 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/Path.pm | 11 +-- lib/Dist/Zilla/Plugin/AutoPrereqs.pm | 3 +- 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/FinderCode.pm | 12 +--- lib/Dist/Zilla/Plugin/GatherDir.pm | 8 +-- lib/Dist/Zilla/Plugin/GatherDir/Template.pm | 4 +- lib/Dist/Zilla/Plugin/GatherFile.pm | 8 +-- lib/Dist/Zilla/Plugin/GenerateFile.pm | 4 +- lib/Dist/Zilla/Plugin/InlineFiles.pm | 4 +- lib/Dist/Zilla/Plugin/License.pm | 4 +- lib/Dist/Zilla/Plugin/MakeMaker.pm | 26 ++----- lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm | 4 +- 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 | 4 +- lib/Dist/Zilla/Plugin/MetaResources.pm | 4 +- lib/Dist/Zilla/Plugin/MetaTests.pm | 4 +- lib/Dist/Zilla/Plugin/MetaYAML.pm | 4 +- lib/Dist/Zilla/Plugin/ModuleBuild.pm | 22 ++---- lib/Dist/Zilla/Plugin/ModuleShareDirs.pm | 6 +- lib/Dist/Zilla/Plugin/NextRelease.pm | 15 ++-- lib/Dist/Zilla/Plugin/PkgDist.pm | 12 +--- lib/Dist/Zilla/Plugin/PkgVersion.pm | 19 ++--- lib/Dist/Zilla/Plugin/PodCoverageTests.pm | 4 +- lib/Dist/Zilla/Plugin/PodSyntaxTests.pm | 4 +- lib/Dist/Zilla/Plugin/PodVersion.pm | 12 +--- lib/Dist/Zilla/Plugin/Prereqs.pm | 4 +- lib/Dist/Zilla/Plugin/PruneCruft.pm | 11 +-- lib/Dist/Zilla/Plugin/PruneFiles.pm | 4 +- lib/Dist/Zilla/Plugin/Readme.pm | 4 +- lib/Dist/Zilla/Plugin/RemovePrereqs.pm | 4 +- 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 | 8 +-- lib/Dist/Zilla/PluginBundle/Basic.pm | 4 +- lib/Dist/Zilla/PluginBundle/Classic.pm | 4 +- lib/Dist/Zilla/PluginBundle/Filter.pm | 3 +- lib/Dist/Zilla/Role/BuildPL.pm | 4 +- lib/Dist/Zilla/Role/ExecFiles.pm | 4 +- lib/Dist/Zilla/Role/File.pm | 16 ++--- lib/Dist/Zilla/Role/FileInjector.pm | 3 +- lib/Dist/Zilla/Role/FileMunger.pm | 4 +- .../Zilla/Role/MintingProfile/ShareDir.pm | 4 +- lib/Dist/Zilla/Role/MutableFile.pm | 3 +- lib/Dist/Zilla/Role/PPI.pm | 12 +--- lib/Dist/Zilla/Role/Plugin.pm | 8 +-- lib/Dist/Zilla/Role/PluginBundle.pm | 3 +- lib/Dist/Zilla/Role/PluginBundle/Easy.pm | 12 +--- lib/Dist/Zilla/Role/Stash.pm | 8 +-- lib/Dist/Zilla/Role/TextTemplate.pm | 4 +- lib/Dist/Zilla/Stash/User.pm | 3 +- lib/Dist/Zilla/Tester.pm | 8 +-- lib/Dist/Zilla/Util.pm | 7 +- lib/Dist/Zilla/Util/AuthorDeps.pm | 8 +-- lib/Test/DZil.pm | 17 ++--- t/file.t | 4 +- 88 files changed, 183 insertions(+), 501 deletions(-) diff --git a/lib/Dist/Zilla/App.pm b/lib/Dist/Zilla/App.pm index bb7cc8aca..7d0051b43 100644 --- a/lib/Dist/Zilla/App.pm +++ b/lib/Dist/Zilla/App.pm @@ -12,9 +12,7 @@ use namespace::autoclean; $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/add.pm b/lib/Dist/Zilla/App/Command/add.pm index e2c4a243e..248fd113f 100644 --- a/lib/Dist/Zilla/App/Command/add.pm +++ b/lib/Dist/Zilla/App/Command/add.pm @@ -33,9 +33,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; @@ -46,9 +44,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 198613302..5e079f6ef 100644 --- a/lib/Dist/Zilla/App/Command/authordeps.pm +++ b/lib/Dist/Zilla/App/Command/authordeps.pm @@ -32,9 +32,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 72c735cdc..eab124840 100644 --- a/lib/Dist/Zilla/App/Command/build.pm +++ b/lib/Dist/Zilla/App/Command/build.pm @@ -86,9 +86,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 6e0dbdcfe..46c1729dd 100644 --- a/lib/Dist/Zilla/App/Command/clean.pm +++ b/lib/Dist/Zilla/App/Command/clean.pm @@ -30,9 +30,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 eb4f06be3..9246989ec 100644 --- a/lib/Dist/Zilla/App/Command/install.pm +++ b/lib/Dist/Zilla/App/Command/install.pm @@ -43,9 +43,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 f261f8059..3b499ce6a 100644 --- a/lib/Dist/Zilla/App/Command/listdeps.pm +++ b/lib/Dist/Zilla/App/Command/listdeps.pm @@ -80,9 +80,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) }; @@ -96,8 +94,7 @@ sub prereqs { my @phases = qw/configure build test runtime develop/; my @relationships = qw/requires recommends suggests/; -sub filter_core { - my ($prereqs, $core_version) = @_; +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; @@ -113,9 +110,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; @@ -149,9 +144,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 e991046dc..9a079110a 100644 --- a/lib/Dist/Zilla/App/Command/new.pm +++ b/lib/Dist/Zilla/App/Command/new.pm @@ -53,9 +53,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; @@ -71,9 +69,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 bd171aa58..28429fe9b 100644 --- a/lib/Dist/Zilla/App/Command/nop.pm +++ b/lib/Dist/Zilla/App/Command/nop.pm @@ -24,9 +24,7 @@ sub description { "It is sometimes useful for diagnostic purposes." } -sub execute { - my ($self, $opt, $arg) = @_; - +sub execute ($self, $opt, $arg) { $self->zilla; } diff --git a/lib/Dist/Zilla/App/Command/release.pm b/lib/Dist/Zilla/App/Command/release.pm index 45cc06041..9b67829b2 100644 --- a/lib/Dist/Zilla/App/Command/release.pm +++ b/lib/Dist/Zilla/App/Command/release.pm @@ -46,9 +46,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 f2c0b02d2..81fecbbd1 100644 --- a/lib/Dist/Zilla/App/Command/run.pm +++ b/lib/Dist/Zilla/App/Command/run.pm @@ -54,9 +54,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 a6938cfdc..cda413c27 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 bb20b31bf..578d745ac 100644 --- a/lib/Dist/Zilla/App/Command/smoke.pm +++ b/lib/Dist/Zilla/App/Command/smoke.pm @@ -54,9 +54,7 @@ This will run the test suite with AUTHOR_TESTING=1 sub abstract { 'smoke your dist' } -sub execute { - my ($self, $opt, $arg) = @_; - +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; diff --git a/lib/Dist/Zilla/App/Command/test.pm b/lib/Dist/Zilla/App/Command/test.pm index 0ad91530e..d02a7aa7f 100644 --- a/lib/Dist/Zilla/App/Command/test.pm +++ b/lib/Dist/Zilla/App/Command/test.pm @@ -65,9 +65,7 @@ Equivalent to --release --automated --extended --author sub abstract { 'test your dist' } -sub execute { - my ($self, $opt, $arg) = @_; - +sub execute ($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; diff --git a/lib/Dist/Zilla/App/Tester.pm b/lib/Dist/Zilla/App/Tester.pm index 5af4b202f..6541f1593 100644 --- a/lib/Dist/Zilla/App/Tester.pm +++ b/lib/Dist/Zilla/App/Tester.pm @@ -23,10 +23,7 @@ use namespace::autoclean -except => 'import'; 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); diff --git a/lib/Dist/Zilla/Chrome/Term.pm b/lib/Dist/Zilla/Chrome/Term.pm index a6dac15ef..d4978b96e 100644 --- a/lib/Dist/Zilla/Chrome/Term.pm +++ b/lib/Dist/Zilla/Chrome/Term.pm @@ -19,9 +19,7 @@ terminal environment. It's the default chrome used by L. =cut -sub _str_color { - my ($str) = @_; - +sub _str_color ($str) { state %color_for; # I know, I know, this is ludicrous, but guess what? It's my Sunday and I @@ -111,8 +109,7 @@ has term_enc => ( }, ); -sub prompt_str { - my ($self, $prompt, $arg) = @_; +sub prompt_str ($self, $prompt, $arg) { $arg ||= {}; my $default = $arg->{default}; my $check = $arg->{check}; @@ -152,8 +149,7 @@ sub prompt_str { return $input; } -sub prompt_yn { - my ($self, $prompt, $arg) = @_; +sub prompt_yn ($self, $prompt, $arg) { $arg ||= {}; my $default = $arg->{default}; @@ -180,8 +176,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 d8907e48e..7987ab627 100644 --- a/lib/Dist/Zilla/Chrome/Test.pm +++ b/lib/Dist/Zilla/Chrome/Test.pm @@ -51,10 +51,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; diff --git a/lib/Dist/Zilla/Dist/Builder.pm b/lib/Dist/Zilla/Dist/Builder.pm index b1fc4e80c..07ae5290d 100644 --- a/lib/Dist/Zilla/Dist/Builder.pm +++ b/lib/Dist/Zilla/Dist/Builder.pm @@ -34,8 +34,7 @@ Valid arguments are: =cut -sub from_config { - my ($class, $arg) = @_; +sub from_config ($class, $arg) { $arg ||= {}; my $root = path($arg->{dist_root} || '.'); @@ -54,8 +53,7 @@ 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({ @@ -227,9 +225,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,8 +250,7 @@ sub _build_share_dir_map { } -sub _load_config { - my ($class, $arg) = @_; +sub _load_config ($class, $arg) { $arg ||= {}; my $config_class = @@ -335,9 +330,7 @@ for the preposition! sub build { $_[0]->build_in } -sub build_in { - my ($self, $root) = @_; - +sub build_in ($self, $root) { $self->log_fatal("tried to build with a minter") if $self->isa('Dist::Zilla::Dist::Minter'); @@ -413,9 +406,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)); @@ -434,8 +425,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, '-', @@ -452,8 +442,7 @@ This method will return the filename, without the format extension =cut -sub archive_basename { - my ($self) = @_; +sub archive_basename ($self) { return join q{}, $self->dist_basename, ( $self->is_trial && $self->version !~ /_/ ? '-TRIAL' : '' ), @@ -471,8 +460,7 @@ might not exist. =cut -sub archive_filename { - my ($self) = @_; +sub archive_filename ($self) { return join q{}, $self->archive_basename, '.tar.gz'; } @@ -485,9 +473,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 $basedir = path($self->dist_basename); @@ -514,9 +500,7 @@ sub build_archive { return $file; } -sub _build_archive { - my ($self, $built_in, $basedir) = @_; - +sub _build_archive ($self, $built_in, $basedir) { $self->log("building archive with Archive::Tar; install Archive::Tar::Wrapper 0.15 or newer for improved speed"); require Archive::Tar; @@ -546,9 +530,7 @@ sub _build_archive { return $archive; } -sub _build_archive_with_wrapper { - my ($self, $built_in, $basedir) = @_; - +sub _build_archive_with_wrapper ($self, $built_in, $basedir) { $self->log("building archive with Archive::Tar::Wrapper"); my $archive = Archive::Tar::Wrapper->new; @@ -569,9 +551,7 @@ sub _build_archive_with_wrapper { return $archive; } -sub _prep_build_root { - my ($self, $build_root) = @_; - +sub _prep_build_root ($self, $build_root) { $build_root = path($build_root || $self->dist_basename); $build_root->mkpath unless -d $build_root; @@ -636,9 +616,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) { @@ -713,8 +691,7 @@ Valid arguments are: =cut -sub install { - my ($self, $arg) = @_; +sub install ($self, $arg) { $arg ||= {}; my ($target, $latest) = $self->ensure_built_in_tmpdir; @@ -762,9 +739,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) }; @@ -794,9 +769,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) }; @@ -818,9 +791,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) { $self->log_fatal("you can't build without any BuildRunner plugins") unless ($arg and exists $arg->{build} and ! $arg->{build}) or @{ $self->plugins_with(-BuildRunner) }; @@ -868,9 +839,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 dded2582f..4c19442e3 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,8 +24,7 @@ sub _setup_default_plugins { } } -sub _new_from_profile { - my ($class, $profile_data, $arg) = @_; +sub _new_from_profile ($class, $profile_data, $arg) { $arg ||= {}; my $config_class = @@ -83,9 +80,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 +88,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 dbf3151f2..7af59c3a3 100644 --- a/lib/Dist/Zilla/File/FromCode.pm +++ b/lib/Dist/Zilla/File/FromCode.pm @@ -54,8 +54,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'; } @@ -63,11 +62,7 @@ sub _build_encoding { =cut -sub content { - my ($self) = @_; - - confess("cannot set content of a FromCode file") if @_ > 1; - +sub content ($self) { my $code = $self->code; my $result = $self->$code; @@ -83,11 +78,7 @@ sub content { =cut -sub encoded_content { - my ($self) = @_; - - confess( "cannot set encoded_content of a FromCode file" ) if @_ > 1; - +sub encoded_content ($self) { my $code = $self->code; my $result = $self->$code; @@ -99,8 +90,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 926c0ad3f..633bc80c2 100644 --- a/lib/Dist/Zilla/File/OnDisk.pm +++ b/lib/Dist/Zilla/File/OnDisk.pm @@ -30,8 +30,7 @@ after 'BUILD' => sub { $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 a7f39c502..cec5ef5fe 100644 --- a/lib/Dist/Zilla/MVP/Assembler.pm +++ b/lib/Dist/Zilla/MVP/Assembler.pm @@ -53,8 +53,7 @@ sub expand_package { 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'; diff --git a/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm b/lib/Dist/Zilla/MVP/Assembler/GlobalConfig.pm index a9eb7e9e9..1e982a541 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 6c544911a..aefb67dbf 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 2ae5e6b64..8c2c44847 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/Path.pm b/lib/Dist/Zilla/Path.pm index 8fa473494..7256e137f 100644 --- a/lib/Dist/Zilla/Path.pm +++ b/lib/Dist/Zilla/Path.pm @@ -14,9 +14,7 @@ use Sub::Exporter -setup => { use namespace::autoclean -except => 'import'; -sub path { - my ($thing, @rest) = @_; - +sub path ($thing, @rest) { if (@rest == 0 && blessed $thing) { return $thing if $thing->isa(__PACKAGE__); @@ -29,9 +27,7 @@ sub path { my %warned; -sub file { - my ($self, @file) = @_; - +sub file ($self, @file) { my ($package, $pmfile, $line) = caller; my $key = join qq{\0}, $pmfile, $line; @@ -43,8 +39,7 @@ sub file { Path::Class::dir($self)->file(@file); } -sub subdir { - my ($self, @subdir) = @_; +sub subdir ($self, @subdir) { Carp::carp("->subdir called on a Dist::Zilla::Path object; this will cease to work in Dist::Zilla v7; downstream code should be updated to use Path::Tiny API, not Path::Class"); require Path::Class; Path::Class::dir($self)->subdir(@subdir); diff --git a/lib/Dist/Zilla/Plugin/AutoPrereqs.pm b/lib/Dist/Zilla/Plugin/AutoPrereqs.pm index a89b354d9..1e8282bab 100644 --- a/lib/Dist/Zilla/Plugin/AutoPrereqs.pm +++ b/lib/Dist/Zilla/Plugin/AutoPrereqs.pm @@ -137,8 +137,7 @@ 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)) } diff --git a/lib/Dist/Zilla/Plugin/AutoVersion.pm b/lib/Dist/Zilla/Plugin/AutoVersion.pm index c265be032..a0df854c7 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 e4c58742f..eb4754052 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, $arg = {}) { 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 6101b5db9..f3c0ff5cf 100644 --- a/lib/Dist/Zilla/Plugin/ConfirmRelease.pm +++ b/lib/Dist/Zilla/Plugin/ConfirmRelease.pm @@ -8,9 +8,7 @@ use Dist::Zilla::Pragmas; 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 4878a88fe..a8797e452 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, $arg = {}) { my $zilla = $self->zilla; my $postlude = ''; diff --git a/lib/Dist/Zilla/Plugin/Encoding.pm b/lib/Dist/Zilla/Plugin/Encoding.pm index f7a8bce68..bad530a49 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 0d9ff7101..6bff61c3e 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/FinderCode.pm b/lib/Dist/Zilla/Plugin/FinderCode.pm index 7c2893107..a858399d0 100644 --- a/lib/Dist/Zilla/Plugin/FinderCode.pm +++ b/lib/Dist/Zilla/Plugin/FinderCode.pm @@ -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 90353e613..afdefab89 100644 --- a/lib/Dist/Zilla/Plugin/GatherDir.pm +++ b/lib/Dist/Zilla/Plugin/GatherDir.pm @@ -170,9 +170,7 @@ around dump_config => sub { return $config; }; -sub gather_files { - my ($self) = @_; - +sub gather_files ($self, $arg = {}) { my $exclude_regex = qr/\000/; $exclude_regex = qr/(?:$exclude_regex)|$_/ for @{ $self->exclude_match }; @@ -233,9 +231,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 d994c8280..5b1b53a0b 100644 --- a/lib/Dist/Zilla/Plugin/GatherDir/Template.pm +++ b/lib/Dist/Zilla/Plugin/GatherDir/Template.pm @@ -66,9 +66,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!"); diff --git a/lib/Dist/Zilla/Plugin/GatherFile.pm b/lib/Dist/Zilla/Plugin/GatherFile.pm index ad79c2cdd..159c70066 100644 --- a/lib/Dist/Zilla/Plugin/GatherFile.pm +++ b/lib/Dist/Zilla/Plugin/GatherFile.pm @@ -94,9 +94,7 @@ around dump_config => sub { return $config; }; -sub gather_files { - my ($self) = @_; - +sub gather_files ($self, $arg = {}) { my $repo_root = $self->zilla->root; my $root = "" . $self->root; $root =~ s{^~([\\/])}{ Dist::Zilla::Util->homedir . $1 }e; @@ -122,9 +120,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 0cc646e8e..f0bf8ac51 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, diff --git a/lib/Dist/Zilla/Plugin/InlineFiles.pm b/lib/Dist/Zilla/Plugin/InlineFiles.pm index 54af5ea39..d69bd072e 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, $arg = {}) { 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 39e618e89..16071173c 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, $arg = {}) { 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 102e7e4f0..5a8d9ce08 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker.pm @@ -117,9 +117,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 +131,7 @@ sub register_prereqs { ); } -sub gather_files { - my ($self) = @_; - +sub gather_files ($self, $arg = {}) { require Dist::Zilla::File::InMemory; my $file = Dist::Zilla::File::InMemory->new({ @@ -147,9 +143,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 +174,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 } @@ -257,8 +249,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); @@ -275,8 +266,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 ); @@ -297,9 +287,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 cf0d23280..f73b0c364 100644 --- a/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm +++ b/lib/Dist/Zilla/Plugin/MakeMaker/Runner.pm @@ -38,9 +38,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 9add7a23d..e71bef794 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, $arg = {}) { 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 1833ceb71..63f2e3daa 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 ce36d9744..050865cbb 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 97dc46bf7..d112e0232 100644 --- a/lib/Dist/Zilla/Plugin/MetaJSON.pm +++ b/lib/Dist/Zilla/Plugin/MetaJSON.pm @@ -51,9 +51,7 @@ has version => ( default => '2', ); -sub gather_files { - my ($self, $arg) = @_; - +sub gather_files ($self, $arg = {}) { my $zilla = $self->zilla; require JSON::MaybeXS; diff --git a/lib/Dist/Zilla/Plugin/MetaResources.pm b/lib/Dist/Zilla/Plugin/MetaResources.pm index f3a468bae..3aea976be 100644 --- a/lib/Dist/Zilla/Plugin/MetaResources.pm +++ b/lib/Dist/Zilla/Plugin/MetaResources.pm @@ -66,9 +66,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 f52497b7f..b7ca20612 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 becd64a32..310dbf3bd 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, $arg = {}) { require Dist::Zilla::File::FromCode; require YAML::Tiny; require CPAN::Meta::Converter; diff --git a/lib/Dist/Zilla/Plugin/ModuleBuild.pm b/lib/Dist/Zilla/Plugin/ModuleBuild.pm index d379081d1..caee162aa 100644 --- a/lib/Dist/Zilla/Plugin/ModuleBuild.pm +++ b/lib/Dist/Zilla/Plugin/ModuleBuild.pm @@ -103,8 +103,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 +113,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 +127,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 +139,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') }; @@ -189,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, $arg = {}) { require Dist::Zilla::File::InMemory; my $file = Dist::Zilla::File::InMemory->new({ @@ -203,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 2992044c0..4df8ed93b 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,8 +37,7 @@ 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; diff --git a/lib/Dist/Zilla/Plugin/NextRelease.pm b/lib/Dist/Zilla/Plugin/NextRelease.pm index 187751197..07bb7f07b 100644 --- a/lib/Dist/Zilla/Plugin/NextRelease.pm +++ b/lib/Dist/Zilla/Plugin/NextRelease.pm @@ -86,9 +86,7 @@ has _user_stash_obj => ( default => sub { $_[0]->zilla->stash_named( $_[0]->user_stash ) }, ); -sub _user_info { - my ($self, $field) = @_; - +sub _user_info ($self, $field) { my $stash = $self->_user_stash_obj; $self->log_fatal([ @@ -99,9 +97,7 @@ sub _user_info { return $value; } -sub section_header { - my ($self) = @_; - +sub section_header ($self) { return _format_version($self->format, $self); } @@ -111,9 +107,7 @@ has _original_changes_content => ( init_arg => undef, ); -sub munge_files { - my ($self) = @_; - +sub munge_files ($self) { my ($file) = grep { $_->name eq $self->filename } @{ $self->zilla->files }; $self->log_fatal([ 'failed to find %s in the distribution', $self->filename ]) if not $file; @@ -134,8 +128,7 @@ sub munge_files { } # new release is part of distribution history, let's record that. -sub after_release { - my ($self) = @_; +sub after_release ($self, $arg = {}) { my $filename = $self->filename; my ($gathered_file) = grep { $_->name eq $filename } @{ $self->zilla->files }; $self->log_fatal("failed to find $filename in the distribution") if not $gathered_file; diff --git a/lib/Dist/Zilla/Plugin/PkgDist.pm b/lib/Dist/Zilla/Plugin/PkgDist.pm index 226256e9c..44dee1b90 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 8ad8534f6..17760a120 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 _version_assignment { - my ($self, $package, $version) = @_; - +sub _version_assignment ($self, $package, $version) { # the \x20 hack is here so that when we scan *this* document we don't find # an assignment to version; it shouldn't be needed, but it's been annoying # enough in the past that I'm keeping it here until tests are better @@ -179,9 +172,7 @@ sub _version_assignment { : $perl; } -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 235fd34c5..02176e6f6 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 4e087225d..c369f7c3b 100644 --- a/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm +++ b/lib/Dist/Zilla/Plugin/PodSyntaxTests.pm @@ -33,9 +33,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/PodVersion.pm b/lib/Dist/Zilla/Plugin/PodVersion.pm index 1b6c4a2dd..f5b2806c6 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 96ea12036..0c4ca5b88 100644 --- a/lib/Dist/Zilla/Plugin/Prereqs.pm +++ b/lib/Dist/Zilla/Plugin/Prereqs.pm @@ -173,9 +173,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 fcb058c42..b6a445d2c 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 2fdfa0ca9..67ef9481e 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 87500d291..8389185a2 100644 --- a/lib/Dist/Zilla/Plugin/Readme.pm +++ b/lib/Dist/Zilla/Plugin/Readme.pm @@ -23,9 +23,7 @@ has _file_obj => ( is => 'rw', isa => role_type('Dist::Zilla::Role::File'), ); -sub gather_files { - my ($self, $arg) = @_; - +sub gather_files ($self, $arg = {}) { require Dist::Zilla::File::InMemory; my $template = q| diff --git a/lib/Dist/Zilla/Plugin/RemovePrereqs.pm b/lib/Dist/Zilla/Plugin/RemovePrereqs.pm index 92ae8217c..feed9f37b 100644 --- a/lib/Dist/Zilla/Plugin/RemovePrereqs.pm +++ b/lib/Dist/Zilla/Plugin/RemovePrereqs.pm @@ -58,9 +58,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 4ea3d05a4..fc5b8f450 100644 --- a/lib/Dist/Zilla/Plugin/ShareDir.pm +++ b/lib/Dist/Zilla/Plugin/ShareDir.pm @@ -24,9 +24,7 @@ has dir => ( default => 'share', ); -sub find_files { - my ($self) = @_; - +sub find_files ($self) { my $dir = $self->dir; my $files = [ grep { index($_->name, "$dir/") == 0 } @@ -34,8 +32,7 @@ sub find_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 406cf7860..d5a60fb2a 100644 --- a/lib/Dist/Zilla/Plugin/TemplateModule.pm +++ b/lib/Dist/Zilla/Plugin/TemplateModule.pm @@ -68,9 +68,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 fac2e24f2..3058fe330 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 c1e3f67ec..e081adb07 100644 --- a/lib/Dist/Zilla/Plugin/UploadToCPAN.pm +++ b/lib/Dist/Zilla/Plugin/UploadToCPAN.pm @@ -78,9 +78,7 @@ has _credentials_stash_obj => ( default => sub { $_[0]->zilla->stash_named( $_[0]->credentials_stash ) }, ); -sub _credential { - my ($self, $name) = @_; - +sub _credential ($self, $name) { return unless my $stash = $self->_credentials_stash_obj; return $stash->$name; } @@ -297,9 +295,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 28a555e2f..20fd7375c 100644 --- a/lib/Dist/Zilla/PluginBundle/Basic.pm +++ b/lib/Dist/Zilla/PluginBundle/Basic.pm @@ -8,9 +8,7 @@ use Dist::Zilla::Pragmas; 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 f2e87a6c7..6c74bab16 100644 --- a/lib/Dist/Zilla/PluginBundle/Classic.pm +++ b/lib/Dist/Zilla/PluginBundle/Classic.pm @@ -8,9 +8,7 @@ use Dist::Zilla::Pragmas; use namespace::autoclean; -sub configure { - my ($self) = @_; - +sub configure ($self) { $self->add_plugins(qw( GatherDir PruneCruft diff --git a/lib/Dist/Zilla/PluginBundle/Filter.pm b/lib/Dist/Zilla/PluginBundle/Filter.pm index ee645d60a..8a01685dc 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/Role/BuildPL.pm b/lib/Dist/Zilla/Role/BuildPL.pm index 1552f9113..1b0765a41 100644 --- a/lib/Dist/Zilla/Role/BuildPL.pm +++ b/lib/Dist/Zilla/Role/BuildPL.pm @@ -34,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 c581549f4..e3eac31c2 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; my $files = [ grep { index($_->name, "$dir/") == 0 } diff --git a/lib/Dist/Zilla/Role/File.pm b/lib/Dist/Zilla/Role/File.pm index 2e1acad07..5644da28d 100644 --- a/lib/Dist/Zilla/Role/File.pm +++ b/lib/Dist/Zilla/Role/File.pm @@ -61,9 +61,7 @@ around name => sub { return $self->$orig(@_); }; -sub _caller_of { - my ($self, $function) = @_; - +sub _caller_of ($self, $function) { for (my $level = 1; $level < 50; ++$level) { my @frame = caller($level); @@ -115,13 +113,11 @@ C will be an error. =cut -sub is_bytes { - my ($self) = @_; +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 ) { return $text; # XXX hope you were right that it really was bytes @@ -135,8 +131,7 @@ sub _encode { } } -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 +160,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/FileInjector.pm b/lib/Dist/Zilla/Role/FileInjector.pm index eba632e76..dae35221b 100644 --- a/lib/Dist/Zilla/Role/FileInjector.pm +++ b/lib/Dist/Zilla/Role/FileInjector.pm @@ -22,8 +22,7 @@ as it does so. =cut -sub add_file { - my ($self, $file) = @_; +sub add_file ($self, $file) { my ($pkg, undef, $line) = caller; $file->_set_added_by( diff --git a/lib/Dist/Zilla/Role/FileMunger.pm b/lib/Dist/Zilla/Role/FileMunger.pm index ddf6ad805..162250aa2 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/ShareDir.pm b/lib/Dist/Zilla/Role/MintingProfile/ShareDir.pm index 43d7bbaba..78e6f42ae 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 43aeb7524..3adc7eaaf 100644 --- a/lib/Dist/Zilla/Role/MutableFile.pm +++ b/lib/Dist/Zilla/Role/MutableFile.pm @@ -105,8 +105,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 e54b43bcd..dc26cb2e0 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 b97e0ca2c..b5f2c5c11 100644 --- a/lib/Dist/Zilla/Role/Plugin.pm +++ b/lib/Dist/Zilla/Role/Plugin.pm @@ -65,9 +65,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 +73,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 dfb2db771..36518628f 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 60b49a297..170f85987 100644 --- a/lib/Dist/Zilla/Role/PluginBundle/Easy.pm +++ b/lib/Dist/Zilla/Role/PluginBundle/Easy.pm @@ -95,9 +95,7 @@ has plugins => ( default => sub { [] }, ); -sub bundle_config { - my ($class, $section) = @_; - +sub bundle_config ($class, $section) { my $self = $class->new($section); $self->configure; @@ -124,9 +122,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; @@ -160,9 +156,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 ||= {}; diff --git a/lib/Dist/Zilla/Role/Stash.pm b/lib/Dist/Zilla/Role/Stash.pm index b7d6fbc0c..60fbfda28 100644 --- a/lib/Dist/Zilla/Role/Stash.pm +++ b/lib/Dist/Zilla/Role/Stash.pm @@ -7,9 +7,7 @@ use Dist::Zilla::Pragmas; 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/TextTemplate.pm b/lib/Dist/Zilla/Role/TextTemplate.pm index 1366a0d63..54f407bf3 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/Stash/User.pm b/lib/Dist/Zilla/Stash/User.pm index e5b8e5a11..b1ce4e82a 100644 --- a/lib/Dist/Zilla/Stash/User.pm +++ b/lib/Dist/Zilla/Stash/User.pm @@ -19,8 +19,7 @@ has email => ( required => 1, ); -sub authors { - my ($self) = @_; +sub authors ($self) { return [ sprintf "%s <%s>", $self->name, $self->email ]; } diff --git a/lib/Dist/Zilla/Tester.pm b/lib/Dist/Zilla/Tester.pm index 4f2b18f67..aa2a097e7 100644 --- a/lib/Dist/Zilla/Tester.pm +++ b/lib/Dist/Zilla/Tester.pm @@ -25,9 +25,7 @@ use Sub::Exporter -setup => { use namespace::autoclean -except => 'import'; -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. @@ -226,13 +224,13 @@ sub minter { 'Dist::Zilla::Tester::_Minter' } }; around ['test', 'release'] => sub { - my ($orig, $self) = @_; + my ($orig, $self, @rest) = @_; # XXX: We *must eliminate* the need for this! It's only here because right # now building a dist with (root <> cwd) doesn't work. -- rjbs, 2010-03-08 my $wd = File::pushd::pushd($self->root); - return $self->$orig; + return $self->$orig(@rest); }; no Moose; diff --git a/lib/Dist/Zilla/Util.pm b/lib/Dist/Zilla/Util.pm index 9db07cdff..4e2ce6879 100644 --- a/lib/Dist/Zilla/Util.pm +++ b/lib/Dist/Zilla/Util.pm @@ -86,8 +86,7 @@ C<=head1> section called "NAME" or a comment beginning with C. =cut -sub abstract_from_file { - my ($self, $file) = @_; +sub abstract_from_file ($self, $file) { my $e = Dist::Zilla::Util::PEA->_new; $e->parse_string_document($file->content); @@ -140,9 +139,7 @@ sub _global_config_root { return Dist::Zilla::Path::path($homedir)->child('.dzil'); } -sub _assert_loaded_class_version_ok { - my ($self, $pkg, $version) = @_; - +sub _assert_loaded_class_version_ok ($self, $pkg, $version) { require CPAN::Meta::Requirements; my $req = CPAN::Meta::Requirements->from_string_hash({ $pkg => $version, diff --git a/lib/Dist/Zilla/Util/AuthorDeps.pm b/lib/Dist/Zilla/Util/AuthorDeps.pm index 4aa0ad7a0..c75a5eca6 100644 --- a/lib/Dist/Zilla/Util/AuthorDeps.pm +++ b/lib/Dist/Zilla/Util/AuthorDeps.pm @@ -9,9 +9,7 @@ use List::Util 1.45 (); use namespace::autoclean; -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 6a3707b94..935de31d9 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) { 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) { 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) { 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/file.t b/t/file.t index 5947903ef..52a423da9 100644 --- a/t/file.t +++ b/t/file.t @@ -175,12 +175,12 @@ subtest "FromCode" => sub { new_file(\$obj, $class, code => sub { $sample }); like( exception { $obj->content($sample) }, - qr/cannot set content/, + qr/Too many arguments/, "changing content should throw error" ); like( exception { $obj->encoded_content($encoded_sample) }, - qr/cannot set encoded_content/, + qr/Too many arguments/, "changing encoded_content should throw error" ); }; From d797ec463f397846ffb00601ea0d5343267e179d Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sun, 29 May 2022 15:00:02 -0400 Subject: [PATCH 3/4] update changelog --- Changes | 1 + 1 file changed, 1 insertion(+) diff --git a/Changes b/Changes index fd6044d39..7bd90c5d7 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for {{$dist->name}} {{$NEXT}} + - use subroutine signatures throughout 6.025 2022-05-28 11:55:35-04:00 America/New_York - eliminate use of multidimensional array emulation From 0784fe1e52c38246f9887354278ec47899dc7076 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sun, 29 May 2022 16:00:23 -0400 Subject: [PATCH 4/4] v6.026 - use subroutine signatures throughout --- Changes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Changes b/Changes index 7bd90c5d7..6d2dbbc47 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ Revision history for {{$dist->name}} {{$NEXT}} + +6.026 2022-05-29 15:06:05-04:00 America/New_York (TRIAL RELEASE) - use subroutine signatures throughout 6.025 2022-05-28 11:55:35-04:00 America/New_York