X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=configpm;h=8c53dbb7249c707087ee036ac905a704075dd0d2;hb=1ce814815bde0566427417840f76f7f4c52ee977;hp=ac7f3aaec91d4b0bebd294ec90ed18c03ea25347;hpb=b233458bd1d5037ce4bbbb41fb513e1b68522a4d;p=p5sagit%2Fp5-mst-13.2.git diff --git a/configpm b/configpm index ac7f3aa..8c53dbb 100755 --- a/configpm +++ b/configpm @@ -1,15 +1,7 @@ #!./miniperl -w -# File::Spec? my $config_pm = $ARGV[0] || 'lib/Config.pm'; -my $src = '.'; -# File::Dirname? File::Spec? -if ($0 =~ m!^(?:(.+)/)configpm$!) { - $src = $1; - unshift @INC, "$1/lib"; -} -# File::Spec? -my $glossary = $ARGV[1] || "$src/Porting/Glossary"; +my $glossary = $ARGV[1] || 'Porting/Glossary'; @ARGV = "./config.sh"; # list names to put first (and hence lookup fastest) @@ -27,13 +19,25 @@ my $glossary = $ARGV[1] || "$src/Porting/Glossary"; open CONFIG, ">$config_pm" or die "Can't open $config_pm: $!\n"; $myver = $]; -print CONFIG <<"ENDOFBEG"; +print CONFIG <<'ENDOFBEG_NOQ', <<"ENDOFBEG"; package Config; use Exporter (); -\@ISA = (Exporter); -\@EXPORT = qw(%Config); -\@EXPORT_OK = qw(myconfig config_sh config_vars); +@EXPORT = qw(%Config); +@EXPORT_OK = qw(myconfig config_sh config_vars); + +# Define our own import method to avoid pulling in the full Exporter: +sub import { + my $pkg = shift; + @_ = @EXPORT unless @_; + my @func = grep {$_ ne '%Config'} @_; + local $Exporter::ExportLevel = 1; + Exporter::import('Config', @func) if @func; + return if @func == @_; + my $callpkg = caller(0); + *{"$callpkg\::Config"} = \%Config; +} +ENDOFBEG_NOQ \$] == $myver or die "Perl lib version ($myver) doesn't match executable version (\$])"; @@ -93,11 +97,7 @@ print CONFIG "\n", print CONFIG "my \$summary = <<'!END!';\n"; -# File::Spec? -my $myconfigdotSH = - $src eq "." ? "myconfig.SH" : "$src/myconfig.SH"; - -open(MYCONFIG,"<$myconfigdotSH") || die "open $myconfigdotSH failed: $!"; +open(MYCONFIG,") && !/^Summary of/; do { print CONFIG $_ } until !defined($_ = ) || /^\s*$/; close(MYCONFIG);