Skip to content

Commit f5750bb

Browse files
committed
use new features
1 parent a4b66ca commit f5750bb

File tree

4 files changed

+26
-35
lines changed

4 files changed

+26
-35
lines changed

lib/Dist/Zilla/Plugin/FFI.pm

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
package Dist::Zilla::Plugin::FFI {
1+
use strict;
2+
use warnings;
3+
use 5.020;
4+
use true;
25

3-
use strict;
4-
use warnings;
5-
use 5.020;
6+
package Dist::Zilla::Plugin::FFI {
67

78
# ABSTRACT: FFI related Dist::Zilla plugins
89

@@ -31,6 +32,4 @@ Add L<FFI::CheckLib> checks into your C<Makefile.PL>.
3132
3233
=cut
3334

34-
}
35-
36-
1;
35+
}

lib/Dist/Zilla/Plugin/FFI/Build.pm

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
use 5.020;
2+
use true;
3+
14
package Dist::Zilla::Plugin::FFI::Build {
25

3-
use 5.020;
46
use Moose;
7+
use experimental qw( signatures );
58
use List::Util qw( first );
69

710
# ABSTRACT: Add FFI::Build to your Makefile.PL
@@ -125,9 +128,8 @@ EOF2
125128
isa => 'Maybe[Str]',
126129
);
127130

128-
sub munge_files
131+
sub munge_files ($self)
129132
{
130-
my($self) = @_;
131133
my $file = first { $_->name eq 'Makefile.PL' } @{ $self->zilla->files };
132134
$self->log_fatal("unable to find Makefile.PL")
133135
unless $file;
@@ -139,8 +141,7 @@ EOF2
139141
$file->content($content);
140142
}
141143

142-
sub register_prereqs {
143-
my ($self) = @_;
144+
sub register_prereqs ($self) {
144145
$self->zilla->register_prereqs( +{
145146
phase => 'configure',
146147
type => 'requires',
@@ -170,17 +171,14 @@ EOF2
170171

171172
}
172173

173-
sub metadata
174+
sub metadata ($self)
174175
{
175-
my($self) = @_;
176176
my %meta = ( dynamic_config => 1 );
177177
\%meta;
178178
}
179179

180-
sub prune_files
180+
sub prune_files ($self)
181181
{
182-
my($self) = @_;
183-
184182
my $lang = $self->lang;
185183

186184
foreach my $file ((), @{ $self->zilla->files })
@@ -203,6 +201,4 @@ EOF2
203201
}
204202

205203
__PACKAGE__->meta->make_immutable;
206-
}
207-
208-
1;
204+
}

lib/Dist/Zilla/Plugin/FFI/CheckLib.pm

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
package Dist::Zilla::Plugin::FFI::CheckLib {
1+
use 5.020;
2+
use true;
23

3-
use strict;
4-
use warnings;
5-
use 5.020;
4+
package Dist::Zilla::Plugin::FFI::CheckLib {
65

76
# ABSTRACT: FFI::CheckLib alternative to Dist::Zilla::Plugin::CheckLib
87

98
use Moose;
9+
use experimental qw( signatures );
10+
1011
with
1112
'Dist::Zilla::Role::FileMunger',
1213
'Dist::Zilla::Role::InstallTool',
@@ -52,8 +53,7 @@ package Dist::Zilla::Plugin::FFI::CheckLib {
5253
$config
5354
};
5455

55-
sub register_prereqs {
56-
my ($self) = @_;
56+
sub register_prereqs ($self) {
5757
$self->zilla->register_prereqs( +{
5858
phase => 'configure',
5959
type => 'requires',
@@ -63,9 +63,7 @@ package Dist::Zilla::Plugin::FFI::CheckLib {
6363
}
6464

6565
my %files;
66-
sub munge_files {
67-
my ($self) = @_;
68-
66+
sub munge_files ($self) {
6967
my @mfpl = grep
7068
{; $_->name eq 'Makefile.PL' or $_->name eq 'Build.PL' }
7169
@{ $self->zilla->files };
@@ -79,9 +77,7 @@ package Dist::Zilla::Plugin::FFI::CheckLib {
7977
()
8078
}
8179

82-
sub setup_installer {
83-
my ($self) = @_;
84-
80+
sub setup_installer ($self) {
8581
my @mfpl = grep
8682
{; $_->name eq 'Makefile.PL' or $_->name eq 'Build.PL' }
8783
@{ $self->zilla->files };
@@ -103,9 +99,7 @@ package Dist::Zilla::Plugin::FFI::CheckLib {
10399
()
104100
}
105101

106-
sub _munge_file {
107-
my ($self, $file) = @_;
108-
102+
sub _munge_file ($self, $file) {
109103
my $orig_content = $file->content;
110104
$self->log_fatal('could not find position in ' . $file->name . ' to modify!')
111105
unless $orig_content =~ m/use strict;\nuse warnings;\n\n/g;

t/00_diag.t

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ $modules{$_} = $_ for qw(
2323
Path::Tiny
2424
Test2::V0
2525
Test::DZil
26+
experimental
2627
namespace::autoclean
28+
true
2729
);
2830

2931

0 commit comments

Comments
 (0)