Skip to content

Commit aa4b50c

Browse files
atoomickhwilliamson
authored andcommittedMar 19, 2020
modernize mkppport with signatures
1 parent 3d7d42a commit aa4b50c

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed
 

‎mkppport

+8-12
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use File::Compare qw( compare );
77
use File::Copy qw( copy );
88
use File::Basename qw( dirname );
99

10-
sub iterdirs(&);
10+
use feature 'signatures';
11+
no warnings 'experimental::signatures';
1112

1213
my $rootdir = dirname($0);
1314

@@ -37,15 +38,14 @@ unless (@destdirs) {
3738

3839
# Remove all installed ppport.h files
3940
if ($opt{clean}) {
40-
iterdirs {
41-
my($dir, $fulldir) = @_;
41+
iterdirs( sub ($dir, $fulldir) {
4242
my $dest = File::Spec->catfile($fulldir, 'ppport.h');
4343
if (-f $dest) {
4444
print "removing ppport.h for $dir\n";
4545
unlink $dest or warn "WARNING: could not remove $dest: $!\n";
4646
1 while unlink $dest; # remove any remaining versions
4747
}
48-
};
48+
} );
4949
exit 0;
5050
}
5151

@@ -83,8 +83,7 @@ unless (-e 'ppport.h') {
8383
}
8484

8585
# Now install the created ppport.h into extension directories
86-
iterdirs {
87-
my($dir, $fulldir) = @_;
86+
iterdirs( sub ($dir, $fulldir) {
8887
my $dest = File::Spec->catfile($fulldir, 'ppport.h');
8988
if (compare('ppport.h', $dest)) {
9089
print "installing ppport.h for $dir\n";
@@ -93,17 +92,15 @@ iterdirs {
9392
else {
9493
print "ppport.h in $dir is up-to-date\n";
9594
}
96-
};
95+
} );
9796

9897
exit 0;
9998

10099
#---------------------------------------
101100
# Iterate through extension directories
102101
#---------------------------------------
103-
sub iterdirs(&)
102+
sub iterdirs($code)
104103
{
105-
my $code = shift;
106-
107104
for my $dir (@destdirs) {
108105
my $fulldir = File::Spec->catdir($absroot, $dir);
109106
if (-d $fulldir) {
@@ -118,9 +115,8 @@ sub iterdirs(&)
118115
#----------------------------------------
119116
# Read the list of extension directories
120117
#----------------------------------------
121-
sub readlist
118+
sub readlist($list)
122119
{
123-
my $list = shift;
124120
my @dirs;
125121
open LIST, $list or die "$list: $!\n";
126122
while (<LIST>) {

0 commit comments

Comments
 (0)
Please sign in to comment.