#!./miniperl -w
+use strict;
+use vars qw(%Config $Config_SH_expanded);
# commonly used names to put first (and hence lookup fastest)
my %Common = map {($_,$_)}
# 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},
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.
push(@non_v, "#$_"); # not a name='value' line
next;
}
- $quote = $2;
+ my $quote = $2;
if ($in_v) {
$val .= $_;
}
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.
if ($Opts{glossary}) {
open(GLOS, "<$Glossary") or die "Can't open $Glossary: $!";
}
-%seen = ();
-$text = 0;
+my %seen = ();
+my $text = 0;
$/ = '';
sub process {