22
33use strict;
44use warnings;
5- use autodie qw( :all ) ;
65
76use 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
7473sub _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
99100main(shift );
0 commit comments