diff options
Diffstat (limited to 'configpm')
-rwxr-xr-x | configpm | 32 |
1 files changed, 22 insertions, 10 deletions
@@ -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 { |