summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.Merijn Brand <perl5@tux.freedom.nl>2023-04-28 17:47:07 +0200
committerH.Merijn Brand <perl5@tux.freedom.nl>2023-04-28 17:47:07 +0200
commit201e363d2990fb2e2a8c4754fe56a8b9de86ee17 (patch)
treed68f650ce592e104ba7aa2a689fe095ea2319667
parentcf6a78b99ae365b7c2f2d81e895b4e297dbb61eb (diff)
downloadperl-201e363d2990fb2e2a8c4754fe56a8b9de86ee17.tar.gz
Add a verbose option
-rwxr-xr-xPorting/checkcfgvar.pl30
1 files changed, 14 insertions, 16 deletions
diff --git a/Porting/checkcfgvar.pl b/Porting/checkcfgvar.pl
index fb80b6fb0c..69004a7293 100755
--- a/Porting/checkcfgvar.pl
+++ b/Porting/checkcfgvar.pl
@@ -7,34 +7,29 @@
#
# VMS is probably not handled properly here, due to their own
# rather elaborate DCL scripting.
-#
use strict;
use warnings;
use autodie;
-sub usage
-{
+sub usage {
my $err = shift and select STDERR;
print "usage: $0 [--list] [--regen] [--default=value]\n";
exit $err;
} # usage
-use Getopt::Long;
-my $opt_l = 0;
-my $opt_r = 0;
-my $default;
-my $tap = 0;
-my $test;
+use Getopt::Long qw(:config bundling);
GetOptions (
- "help|?" => sub { usage (0); },
- "l|list!" => \$opt_l,
- "regen" => \$opt_r,
- "default=s" => \$default,
- "tap" => \$tap,
+ "help|?" => sub { usage (0); },
+ "l|list!" => \(my $opt_l = 0),
+ "regen" => \(my $opt_r = 0),
+ "default=s" => \ my $default,
+ "tap" => \(my $tap = 0),
+ "v|verbose:1" => \(my $opt_v = 0),
) or usage (1);
$default and $default =~ s/^'(.*)'$/$1/; # Will be quoted on generation
+my $test;
require './regen/regen_lib.pl' if $opt_r;
@@ -61,6 +56,7 @@ my @CFG = (
my @MASTER_CFG;
{
my %seen;
+ $opt_v and warn "Reading $MASTER_CFG ...\n";
open my $fh, '<', $MASTER_CFG;
while (<$fh>) {
while (/[^\\]\$([a-z]\w+)/g) {
@@ -76,6 +72,7 @@ my @MASTER_CFG;
my %MANIFEST;
{
+ $opt_v and warn "Reading MANIFEST ...\n";
open my $fh, '<', 'MANIFEST';
while (<$fh>) {
$MANIFEST{$1}++ if /^(.+?)\t/;
@@ -87,14 +84,15 @@ printf "1..%d\n", 2 * @CFG if $tap;
for my $cfg (sort @CFG) {
unless (exists $MANIFEST{$cfg}) {
- print STDERR "[skipping not-expected '$cfg']\n";
+ warn "[skipping not-expected '$cfg']\n";
next;
}
my %cfg;
my $section = 0;
my @lines;
- open my $fh, '<', $cfg;
+ $opt_v and warn "Reading $cfg ...\n";
+ open my $fh, '<', $cfg or die "$cfg: $!\n";
if ($cfg eq 'configure.com') {
++$cfg{startperl}; # Cheat.