Steve Hay wrote:

>[Thinking out loud / talking to myself...]
>
>Steve Hay wrote:
>
>  
>
>>A straight out-of-the-box build of PAR-0.87 with perl-5.8.7 on Win32 
>>doesn't work.  It worked fine with perl-5.8.6.
>>
>>Simply running "parl.exe" should output a short usage message.  Under 
>>perl-5.8.6 it does, but under perl-5.8.7 I get the error:
>>
>>Can't locate Config_heavy.pl in @INC (@INC contains: CODE(0x8c7b60) .) 
>>at C:/perl5/lib/Config.pm line 66.
>>
>>    
>>
>OK, after building a debug version I've found the source of parl.exe.
>
>It seems that the installed C:\perl5\bin\parl.exe (>1MB in size) is 
>actually myldr\static.c, which extracts a bunch of files into a 
>temporary directory, one of which is also called parl.exe (but only 
>~50kB in size), and then runs that small parl.exe.  It is the small 
>parl.exe, whose source code is myldr\main.c, that emits the error.
>
>[...]
>
>So why can't the small parl.exe find .pl files under some 
>circumstances?  Is there anything in the magic coderef @INC stuff that 
>PAR uses that could be the cause?
>
I may have found the problem, but I'm not sure -- it seems so obvious 
that surely it would have come up before, and doesn't explain why PAR + 
perl-5.8.7 apparently works on other OS's...

I believe that the small parl.exe program is used to run the par.pl 
program.  This program extracts some core modules, including Config, and 
loads them with the coderef @INC thingy.  With the following patch in 
place, things become a bit clearer:

--- par.pl.orig 2005-01-30 17:20:00.000000000 +0000
+++ par.pl      2005-06-06 12:07:53.469034600 +0100
@@ -222,6 +222,7 @@
         read _FH, $buf, unpack("N", $buf);

         if (defined($ext) and $ext !~ /\.(?:pm|ix|al)$/i) {
+            print STDERR "Writing out tempfile '$fullname'\n";
             my ($out, $filename) = _tempfile($ext, $crc);
             if ($out) {
                 binmode($out);
@@ -233,6 +234,7 @@
             $PAR::Heavy::FullCache{$filename} = $fullname;
         }
         elsif ( $fullname =~ m|^/?shlib/| and defined $ENV{PAR_TEMP} ) {
+            print STDERR "Writing out shlib '$fullname'\n";
             # should be moved to _tempfile()
             my $filename = "$ENV{PAR_TEMP}/$basename$ext";
             outs("SHLIB: $filename\n");
@@ -242,6 +244,7 @@
             close $out;
         }
         else {
+            print STDERR "Adding '$fullname' to require_list\n";
             $require_list{$fullname} =
             $PAR::Heavy::ModuleCache{$fullname} = {
                 buf => $buf,

When I simply run "parl.exe" I get the following output (followed by the 
Config_heavy.pl error message):

Adding 'PAR.pm' to require_list
Adding 'PAR/Filter.pm' to require_list
Adding 'PAR/Filter/PodStrip.pm' to require_list
Adding 'PAR/Heavy.pm' to require_list
Adding 'AutoLoader.pm' to require_list
Adding 'Carp.pm' to require_list
Adding 'Carp/Heavy.pm' to require_list
Adding 'Config.pm' to require_list
Writing out tempfile 'Config_heavy.pl'
Adding 'Cwd.pm' to require_list
Adding 'DynaLoader.pm' to require_list
Adding 'Errno.pm' to require_list
Adding 'Exporter.pm' to require_list
Adding 'Exporter/Heavy.pm' to require_list
Adding 'Fcntl.pm' to require_list
Adding 'File/Basename.pm' to require_list
Adding 'File/Copy.pm' to require_list
Adding 'File/Find.pm' to require_list
Adding 'File/Glob.pm' to require_list
Adding 'File/Path.pm' to require_list
Adding 'File/Spec.pm' to require_list
Adding 'File/Spec/Unix.pm' to require_list
Adding 'File/Spec/Win32.pm' to require_list
Adding 'File/Temp.pm' to require_list
Adding 'IO.pm' to require_list
Adding 'IO/File.pm' to require_list
Adding 'IO/Handle.pm' to require_list
Adding 'IO/Seekable.pm' to require_list
Adding 'List/Util.pm' to require_list
Adding 'Scalar/Util.pm' to require_list
Adding 'SelectSaver.pm' to require_list
Adding 'Symbol.pm' to require_list
Adding 'Time/Local.pm' to require_list
Adding 'XSLoader.pm' to require_list
Writing out tempfile 'auto/Cwd/Cwd.dll'
Adding 'auto/DynaLoader/dl_findfile.al' to require_list
Writing out tempfile 'auto/Fcntl/Fcntl.dll'
Writing out tempfile 'auto/File/Glob/Glob.dll'
Writing out tempfile 'auto/IO/IO.dll'
Writing out tempfile 'auto/List/Util/Util.dll'
Adding 'base.pm' to require_list
Adding 'bytes.pm' to require_list
Adding 'constant.pm' to require_list
Adding 'integer.pm' to require_list
Adding 'lib.pm' to require_list
Adding 'overload.pm' to require_list
Adding 're.pm' to require_list
Adding 'strict.pm' to require_list
Adding 'vars.pm' to require_list
Adding 'warnings.pm' to require_list
Adding 'warnings/register.pm' to require_list
Adding 'Archive/Zip.pm' to require_list
Adding 'Compress/Zlib.pm' to require_list
Adding 'PAR/Dist.pm' to require_list
Writing out tempfile 'auto/Compress/Zlib/Zlib.dll'
Adding 'auto/Compress/Zlib/autosplit.ix' to require_list

I think the problem may be that Config_heavy.pl is written out as a 
tempfile and not added to %require_list.

As a result, the subsequent coderef @INC doesn't find the file because 
it checks for the file's existence in %require_list:

        my $filename = delete $require_list{$module} || do {
            my $key;
            foreach (keys %require_list) {
                next unless /\Q$module\E$/;
                $key = $_; last;
            }
            delete $require_list{$key} if defined($key);
        } or return;

Hence the attached patch, which treats .pl files the same way as .pm 
files, fixes things for me.  The full test suite still passes too.

I would be grateful if somebody could confirm whether or not this patch 
is OK, and if it is then apply it to the next version of PAR.

- Steve


------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are 
confidential and intended for the addressee(s) only.  If you have received this 
message in error or there are any problems, please notify the sender 
immediately.  The unauthorized use, disclosure, copying or alteration of this 
message is strictly forbidden.  Note that any views or opinions presented in 
this email are solely those of the author and do not necessarily represent 
those of Radan Computational Ltd.  The recipient(s) of this message should 
check it and any attached files for viruses: Radan Computational will accept no 
liability for any damage caused by any virus transmitted by this email.
--- par.pl.orig 2005-01-30 17:20:00.000000000 +0000
+++ par.pl      2005-06-06 12:13:41.244995000 +0100
@@ -221,7 +221,7 @@
         read _FH, $buf, 4;
         read _FH, $buf, unpack("N", $buf);
 
-        if (defined($ext) and $ext !~ /\.(?:pm|ix|al)$/i) {
+        if (defined($ext) and $ext !~ /\.(?:pm|pl|ix|al)$/i) {
             my ($out, $filename) = _tempfile($ext, $crc);
             if ($out) {
                 binmode($out);

Reply via email to