Skip to content

Commit 260f787

Browse files
rrajkeenan
andcommitted
Eliminate 'use autodie' from files touched by Perl core build process
Restore explicit checking for success of system calls as in version 5 of podlators. This is needed because podlators is bundled into the Perl core distribution where it is handled in the build process at a point where some of autodie's prerequisites are not yet built. See discussion in #32 and Perl/perl5#22395. Co-authored-by: James E Keenan <[email protected]>
1 parent b553df3 commit 260f787

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

Makefile.PL

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# SPDX-License-Identifier: GPL-1.0-or-later OR Artistic-1.0-Perl
1414

1515
use 5.012;
16-
use autodie;
1716
use warnings;
1817

1918
use Config;
@@ -27,14 +26,14 @@ use File::Spec;
2726
# Returns: Distribution version as a string
2827
sub dist_version {
2928
my ($path) = @_;
30-
open(my $fh, '<', $path);
29+
open(my $fh, '<', $path) or die "$0: cannot open $path: $!\n";
3130
while (defined(my $line = <$fh>)) {
3231
if ($line =~ m{ \A package \s+ \S+ \s+ (v[\d.]+) }xms) {
33-
close($fh);
32+
close($fh) or die "$0: cannot close $path: $!\n";
3433
return $1;
3534
}
3635
}
37-
close($fh);
36+
close($fh) or die "$0: cannot close $path: $!\n";
3837
die "$0: cannot find version in lib/Pod/Man.pm\n";
3938
}
4039

scripts/pod2man.PL

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# Perl core.
66

77
use 5.012;
8-
use autodie;
98
use warnings;
109

1110
use Config qw(%Config);
@@ -20,14 +19,14 @@ use File::Basename qw(basename dirname);
2019

2120
# This forces PL files to create target in same directory as PL file.
2221
# This is so that make depend always knows where to find PL derivatives.
23-
chdir(dirname($0));
22+
chdir(dirname($0)) or die "Cannot change directories: $!\n";
2423
my $file = basename($0, '.PL');
2524
if ($^O eq 'VMS') {
2625
$file .= '.com';
2726
}
2827

2928
# Create the generated script.
30-
open(my $out, '>', $file);
29+
open(my $out, '>', $file) or die "Cannot create $file: $!\n";
3130
print "Extracting $file (with variable substitutions)\n"
3231
or die "$0: cannot write to stdout: $!\n";
3332

@@ -560,8 +559,8 @@ Perl core distribution as of 5.6.0.
560559
SCRIPT_BODY
561560

562561
# Finish the generation of the script.
563-
close($out);
564-
chmod(0755, $file);
562+
close($out) or die "Cannot close $file: $!\n";
563+
chmod(0755, $file) or die "Cannot reset permissions for $file: $!\n";
565564
if ($Config{'eunicefix'} ne q{:}) {
566565
exec("$Config{'eunicefix'} $file");
567566
}

0 commit comments

Comments
 (0)