X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Flib_pm.PL;h=fabdbd0a7d94146a3b01de0306abb5a9a5a35102;hb=eb60b0e7b57f22da325f4de3b9eed4515e564eef;hp=c12570828f73424049bc7ff43e68c989b1b50311;hpb=70f874d356673520bbd323840a6b04820b0f042c;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/lib_pm.PL b/lib/lib_pm.PL index c125708..fabdbd0 100644 --- a/lib/lib_pm.PL +++ b/lib/lib_pm.PL @@ -6,7 +6,7 @@ use Cwd; my $origdir = cwd; chdir dirname($0); my $file = basename($0, '.PL'); -$file =~ s!_(pm)$!.$1!i; +$file =~ s/_(pm)$/.$1/i; my $useConfig; my $Config_archname; @@ -31,14 +31,15 @@ else { open my $fh, '<', $lib_file or die "Could not open file '$lib_file' for reading: $!"; my $ConfigRegex = qr/(?:use|require)\s+Config(?:\s+|;)/; + my $found_config = 0; while (defined($_ = <$fh>)) { # crude heuristics to check that we were using Config if (/^\s*$ConfigRegex/ || /^\s*eval.*$ConfigRegex/) { - $expand_config_vars = 0; + $found_config = 1; last; } } - $expand_config_vars = 1; + $expand_config_vars = $found_config ? 0 : 1; HERE $expand_config_vars = 0 if $@; } @@ -51,7 +52,7 @@ if ($expand_config_vars) { reverse split / /, $Config{inc_version_list}; $Config_inc_version_list = @Config_inc_version_list ? - qq(@Config_inc_version_list) : q(()); + qq(qw(@Config_inc_version_list)) : q(()); } else { $useConfig = 'use Config;'; $Config_archname = q($Config{archname}); @@ -85,7 +86,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.57'; +our $VERSION = '0.62'; my $Is_MacOS = $^O eq 'MacOS'; my $Mac_FS; if ($Is_MacOS) { @@ -222,11 +223,17 @@ For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is added to @INC in front of $dir. +lib.pm also checks if directories called $dir/$version and $dir/$version/$archname +exist and adds these directories to @INC. The current value of C<$archname> can be found with this command: perl -V:archname +The corresponding command to get the current value of C<$version> is: + + perl -V:version + To avoid memory leaks, all trailing duplicate entries in @INC are removed.