summaryrefslogtreecommitdiff
path: root/configpm
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2004-11-26 11:29:21 +0000
committerNicholas Clark <nick@ccl4.org>2004-11-26 11:29:21 +0000
commit2f4f46aded53c2e2c32bd47e9a9d227762d35452 (patch)
tree1ae50c183c0c7a162b696ef897c65452da4e652b /configpm
parent375b6f9c3cf61249fbff2151731131e9a0b72a6c (diff)
downloadperl-2f4f46aded53c2e2c32bd47e9a9d227762d35452.tar.gz
Make configpm and the generated Config.pm strict and warnings
clean. p4raw-id: //depot/perl@23544
Diffstat (limited to 'configpm')
-rwxr-xr-xconfigpm32
1 files changed, 22 insertions, 10 deletions
diff --git a/configpm b/configpm
index 061528ca27..87dba354ae 100755
--- a/configpm
+++ b/configpm
@@ -1,4 +1,6 @@
#!./miniperl -w
+use strict;
+use vars qw(%Config $Config_SH_expanded);
# commonly used names to put first (and hence lookup fastest)
my %Common = map {($_,$_)}
@@ -65,19 +67,25 @@ printf CONFIG <<'ENDOFBEG', ($myver) x 3;
# made to this file will be lost the next time perl is built.
package Config;
-@EXPORT = qw(%%Config);
-@EXPORT_OK = qw(myconfig config_sh config_vars config_re);
+use strict;
+# use warnings; Pulls in Carp
+# use vars pulls in Carp
+@Config::EXPORT = qw(%%Config);
+@Config::EXPORT_OK = qw(myconfig config_sh config_vars config_re);
-my %%Export_Cache = map {($_ => 1)} (@EXPORT, @EXPORT_OK);
+my %%Export_Cache = map {($_ => 1)} (@Config::EXPORT, @Config::EXPORT_OK);
+
+our %%Config;
# Define our own import method to avoid pulling in the full Exporter:
sub import {
my $pkg = shift;
- @_ = @EXPORT unless @_;
+ @_ = @Config::EXPORT unless @_;
my @funcs = grep $_ ne '%%Config', @_;
my $export_Config = @funcs < @_ ? 1 : 0;
+ no strict 'refs';
my $callpkg = caller(0);
foreach my $func (@funcs) {
die sprintf qq{"%%s" is not exported by the %%s module\n},
@@ -154,8 +162,10 @@ EOT
eval $fetch_string;
die if $@;
-open(CONFIG_SH, 'config.sh') || die "Can't open config.sh: $!";
-while (<CONFIG_SH>) {
+{
+ my ($name, $val);
+ open(CONFIG_SH, 'config.sh') || die "Can't open config.sh: $!";
+ while (<CONFIG_SH>) {
next if m:^#!/bin/sh:;
# Catch PERL_CONFIG_SH=true and PERL_VERSION=n line from Configure.
@@ -180,7 +190,7 @@ while (<CONFIG_SH>) {
push(@non_v, "#$_"); # not a name='value' line
next;
}
- $quote = $2;
+ my $quote = $2;
if ($in_v) {
$val .= $_;
}
@@ -202,8 +212,10 @@ while (<CONFIG_SH>) {
push(@v_fast, $line);
$v_fast{$name} = "'$name' => $quote$val$quote";
}
+ }
+ close CONFIG_SH;
}
-close CONFIG_SH;
+
# Calculation for the keys for byteorder
# This is somewhat grim, but I need to run fetch_string here.
@@ -550,8 +562,8 @@ ENDOFTAIL
if ($Opts{glossary}) {
open(GLOS, "<$Glossary") or die "Can't open $Glossary: $!";
}
-%seen = ();
-$text = 0;
+my %seen = ();
+my $text = 0;
$/ = '';
sub process {