Skip to content

Commit 55233e7

Browse files
committed
Do not use autodie in script
This reduced the dependencies. See #359.
1 parent 1ceabb0 commit 55233e7

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

Changes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
pkillarjun. GitHub #357.
1010
* Updated `cmake_minimum_required` to a version range to quiet deprecation
1111
warnings on new CMake versions. Reported by gmou3. GitHub #359.
12+
* The script for generating man pages no longer uses `autodie`. This
13+
eliminates the dependency on `IPC::System::Simple`. Reported by gmou3.
14+
GitHub #359.
1215

1316
## 1.11.0 - 2024-08-21
1417

dev-bin/make-man-pages.pl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
use strict;
44
use warnings;
5-
use autodie qw( :all );
65

76
use FindBin qw( $Bin );
87

@@ -41,7 +40,7 @@ sub _make_man {
4140

4241
my $input = "$Bin/../doc/$name.md";
4342
my $man_dir = "$target/man/man$section";
44-
mkpath($man_dir);
43+
mkpath($man_dir) or die "Failed to create directory $man_dir: $!";
4544
my $output = "$man_dir/$name.$section";
4645

4746
if ( $translator eq 'pandoc' ) {
@@ -54,7 +53,7 @@ sub _make_man {
5453
'-M', "section:$section",
5554
$input,
5655
'-o', $output,
57-
);
56+
) == 0 or die "Failed to run pandoc: $!";
5857
_pandoc_postprocess($output);
5958
}
6059
elsif ( $translator eq 'lowdown' ) {
@@ -67,18 +66,20 @@ sub _make_man {
6766
'-M', "section:$section",
6867
$input,
6968
'-o', $output,
70-
);
69+
) == 0 or die "Failed to run lowdown: $!";
7170
}
7271
}
7372

7473
sub _make_lib_man_links {
7574
my $target = shift;
7675

77-
my $header = read_file("$Bin/../include/maxminddb.h");
76+
my $header = read_file("$Bin/../include/maxminddb.h")
77+
or die "Failed to read header file: $!";
7878
for my $proto ( $header =~ /^ *extern.+?(MMDB_\w+)\(/gsm ) {
79-
open my $fh, '>', "$target/man/man3/$proto.3";
79+
open my $fh, '>', "$target/man/man3/$proto.3"
80+
or die "Failed to open file: $!";
8081
print {$fh} ".so man3/libmaxminddb.3\n";
81-
close $fh;
82+
close $fh or die "Failed to close file: $!";
8283
}
8384
}
8485

@@ -92,8 +93,8 @@ sub _pandoc_postprocess {
9293
s/^\.IP\n\.nf/.IP "" 4\n.nf/gm;
9394
s/(Automatically generated by Pandoc)(.+)$/$1/m;
9495
},
95-
$file
96-
);
96+
$file,
97+
) or die "Failed to edit file: $!";
9798
}
9899

99100
main(shift);

0 commit comments

Comments
 (0)