diff options
author | Steffen Mueller <wyp3rlx02@sneakemail.com> | 2008-05-27 15:50:05 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2008-06-01 10:41:27 +0000 |
commit | 70f874d356673520bbd323840a6b04820b0f042c (patch) | |
tree | 899a9bb734b85d9050e2b356bea6b42d6e39cecd /lib/lib_pm.PL | |
parent | a1c7933fc4afc4f7f4567549e87fe45a8994370f (diff) | |
download | perl-70f874d356673520bbd323840a6b04820b0f042c.tar.gz |
Re: recent 'lib.pm' change => dual-life lib.pm
Message-ID: <483BF56D.2020803@sneakemail.com>
p4raw-id: //depot/perl@33973
Diffstat (limited to 'lib/lib_pm.PL')
-rw-r--r-- | lib/lib_pm.PL | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/lib/lib_pm.PL b/lib/lib_pm.PL index bb2f7ccfcd..c12570828f 100644 --- a/lib/lib_pm.PL +++ b/lib/lib_pm.PL @@ -13,10 +13,37 @@ my $Config_archname; my $Config_version; my $Config_inc_version_list; -# Expand the variables only if explicitly requested because -# otherwise relocating Perl becomes much harder. +# Expand the variables only if explicitly requested +# or if a previously installed lib.pm does this, too +# because otherwise relocating Perl becomes much harder. +my $expand_config_vars = 0; if ($ENV{PERL_BUILD_EXPAND_CONFIG_VARS}) { + $expand_config_vars = 1; +} +elsif (exists $ENV{PERL_BUILD_EXPAND_CONFIG_VARS}) { + $expand_config_vars = 0; +} +else { + eval <<'HERE'; + require lib; + my $lib_file = $INC{"lib.pm"}; + open my $fh, '<', $lib_file + or die "Could not open file '$lib_file' for reading: $!"; + my $ConfigRegex = qr/(?:use|require)\s+Config(?:\s+|;)/; + while (defined($_ = <$fh>)) { + # crude heuristics to check that we were using Config + if (/^\s*$ConfigRegex/ || /^\s*eval.*$ConfigRegex/) { + $expand_config_vars = 0; + last; + } + } + $expand_config_vars = 1; +HERE + $expand_config_vars = 0 if $@; +} + +if ($expand_config_vars) { $useConfig = ''; $Config_archname = qq('$Config{archname}'); $Config_version = qq('$Config{version}'); @@ -58,7 +85,7 @@ my \@inc_version_list = $Config_inc_version_list; print OUT <<'!NO!SUBS!'; our @ORIG_INC = @INC; # take a handy copy of 'original' value -our $VERSION = '0.56'; +our $VERSION = '0.57'; my $Is_MacOS = $^O eq 'MacOS'; my $Mac_FS; if ($Is_MacOS) { @@ -244,14 +271,40 @@ paths, as it does now for Mac OS (where Unix-style or Mac-style paths work, and Unix-style paths are converted properly to Mac-style paths before being added to @INC). +If you try to add a file to @INC as follows: + + use lib 'this_is_a_file.txt'; + +C<lib> will warn about this. The sole exceptions are files with the +C<.par> extension which are intended to be used as libraries. + =head1 SEE ALSO FindBin - optional module which deals with paths relative to the source file. +PAR - optional module which can treat C<.par> files as Perl libraries. + =head1 AUTHOR Tim Bunce, 2nd June 1995. +C<lib> is maintained by the perl5-porters. Please direct +any questions to the canonical mailing list. Anything that +is applicable to the CPAN release can be sent to its maintainer, +though. + +Maintainer: The Perl5-Porters <perl5-porters@perl.org> + +Maintainer of the CPAN release: Steffen Mueller <smueller@cpan.org> + +=head1 COPYRIGHT AND LICENSE + +This package has been part of the perl core since perl 5.001. +It has been released separately to CPAN so older installations +can benefit from bug fixes. + +This package has the same copyright and license as the perl core. + =cut !NO!SUBS! |