| 1 | # This is XSConfig from CPAN that uses XSLoader | ||
| 2 | |||
| 3 | # for a description of the variables, please have a look at the | ||
| 4 | # Porting/Glossary file, or use the url: | ||
| 5 | # http://perl5.git.perl.org/perl.git/blob/HEAD:/Porting/Glossary | ||
| 6 | |||
| 7 | package | ||
| 8 | Config; | ||
| 9 | use strict; | ||
| 10 | use warnings; | ||
| 11 | our (%Config, $VERSION); | ||
| 12 | |||
| 13 | $VERSION = '6.26'; | ||
| 14 | |||
| 15 | # Skip @Config::EXPORT because it only contains %Config, which we special | ||
| 16 | # case below as it's not a function. @Config::EXPORT won't change in the | ||
| 17 | # lifetime of Perl 5. | ||
| 18 | my %Export_Cache = (myconfig => 1, config_sh => 1, config_vars => 1, | ||
| 19 | config_re => 1, compile_date => 1, local_patches => 1, | ||
| 20 | bincompat_options => 1, non_bincompat_options => 1, | ||
| 21 | header_files => 1); | ||
| 22 | |||
| 23 | @Config::EXPORT = qw(%Config); | ||
| 24 | @Config::EXPORT_OK = keys %Export_Cache; | ||
| 25 | |||
| 26 | # Need to stub all the functions to make code such as print Config::config_sh | ||
| 27 | # keep working | ||
| 28 | |||
| 29 | sub bincompat_options; | ||
| 30 | sub compile_date; | ||
| 31 | sub config_re; | ||
| 32 | sub config_sh; | ||
| 33 | sub config_vars; | ||
| 34 | sub header_files; | ||
| 35 | sub local_patches; | ||
| 36 | sub myconfig; | ||
| 37 | sub non_bincompat_options; | ||
| 38 | |||
| 39 | # Define our own import method to avoid pulling in the full Exporter: | ||
| 40 | sub import { | ||
| 41 | shift; | ||
| 42 | @_ = @Config::EXPORT unless @_; | ||
| 43 | |||
| 44 | my @funcs = grep $_ ne '%Config', @_; | ||
| 45 | my $export_Config = @funcs < @_ ? 1 : 0; | ||
| 46 | |||
| 47 | no strict 'refs'; | ||
| 48 | my $callpkg = caller(0); | ||
| 49 | foreach my $func (@funcs) { | ||
| 50 | die qq{"$func" is not exported by the Config module\n} | ||
| 51 | unless $Export_Cache{$func}; | ||
| 52 | *{$callpkg.'::'.$func} = \&{$func}; | ||
| 53 | } | ||
| 54 | |||
| 55 | *{"$callpkg\::Config"} = \%Config if $export_Config; | ||
| 56 | return; | ||
| 57 | } | ||
| 58 | |||
| 59 | sub DESTROY { } | ||
| 60 | |||
| 61 | if (defined &DynaLoader::boot_DynaLoader) { | ||
| 62 | require XSLoader; | ||
| 63 | XSLoader::load(__PACKAGE__, $VERSION); | ||
| 64 | tie %Config, 'Config'; | ||
| 65 | } else { | ||
| 66 | no warnings 'redefine'; | ||
| 67 | %Config:: = (); | ||
| 68 | undef &{$_} for qw(import DESTROY AUTOLOAD); | ||
| 69 | require 'Config_mini.pl'; | ||
| 70 | } | ||
| 71 | |||
| 72 | sub AUTOLOAD { | ||
| 73 | require 'Config_xs_heavy.pl' if defined &DynaLoader::boot_DynaLoader; | ||
| 74 | |||
| 75 | goto \&launcher unless $Config::AUTOLOAD =~ /launcher$/; | ||
| 76 | die "&Config::AUTOLOAD failed on $Config::AUTOLOAD"; | ||
| 77 | } |