Subject: | [PATCH] Enforce strict and warnings in scripts/pod2usage.PL |
Also prefer using a 3 args open and avoid bareword filehandle
You can view the changes from:
https://github.com/atoomic/Pod-Usage/pull/3/files
You can view a CI workflow with these changes on top of v1.70 from:
https://github.com/atoomic/Pod-Usage/actions/runs/213894625
Subject: | 0001-Enforce-strict-and-warnings-in-scripts-pod2usage.PL.patch |
From b780b5b7b5f746c39ccde73476515eb89cba4c2a Mon Sep 17 00:00:00 2001
From: Nicolas R <nicolas@atoomic.org>
Date: Tue, 18 Aug 2020 10:09:03 -0600
Subject: [PATCH] Enforce strict and warnings in scripts/pod2usage.PL
Also prefer using a 3 args open and avoid bareword filehandle.
---
scripts/pod2usage.PL | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/scripts/pod2usage.PL b/scripts/pod2usage.PL
index a51df22..adb5325 100644
--- a/scripts/pod2usage.PL
+++ b/scripts/pod2usage.PL
@@ -1,5 +1,7 @@
#!/usr/local/bin/perl
+use strict;
+use warnings;
use Config;
use File::Basename qw(&basename &dirname);
use Cwd;
@@ -13,19 +15,19 @@ use Cwd;
# This forces PL files to create target in same directory as PL file.
# This is so that make depend always knows where to find PL derivatives.
-$origdir = cwd;
+my $origdir = cwd;
chdir(dirname($0));
-$file = basename($0, '.PL');
+my $file = basename($0, '.PL');
$file .= '.com' if $^O eq 'VMS';
-open OUT,">$file" or die "Can't create $file: $!";
+open my $OUT, '>', $file or die "Can't create $file: $!";
print "Extracting $file (with variable substitutions)\n";
# In this section, perl variables will be expanded during extraction.
# You can use $Config{...} to use Configure variables.
-print OUT <<"!GROK!THIS!";
+print $OUT <<"!GROK!THIS!";
$Config{'startperl'}
eval 'exec perl -S \$0 "\$@"'
if 0;
@@ -33,7 +35,7 @@ $Config{'startperl'}
# In the following, perl variables are not expanded during extraction.
-print OUT <<'!NO!SUBS!';
+print $OUT <<'!NO!SUBS!';
#############################################################################
# pod2usage -- command to print usage messages from embedded pod docs
@@ -195,7 +197,7 @@ pod2usage(\%usage);
!NO!SUBS!
-close OUT or die "Can't close $file: $!";
+close $OUT or die "Can't close $file: $!";
chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
chdir $origdir;
--
2.24.3 (Apple Git-128)