This patch preemptively extracts the contents of the .zip file and not
unshift &find_par on @INC.  This is necessary to, for instance, use
POSIX on Unix platforms.  I think it would also address my older issues,
but that's moot.

A minor debugging fix is also added below.

It also adds a dependancy in myldr/Makefile.PL that should theoretically
cause make to update the parl executable more often, but it still
doesn't remake thinks properly here when I edit lib/PAR.pm and type
"make".

- Barrie

diff -aur PAR.orig/lib/PAR.pm PAR/lib/PAR.pm
--- PAR.orig/lib/PAR.pm 2004-01-26 00:22:18.000000000 -0500
+++ PAR/lib/PAR.pm      2004-01-30 22:45:43.000000000 -0500
@@ -165,6 +165,8 @@
 my $arch = $Config{archname};
 my ($par_temp, $progname);
 
+my $preemptive_extraction_mode = 1;
+
 sub import {
     my $class = shift;
 
@@ -186,7 +188,8 @@
     return if $PAR::__import;
     local $PAR::__import = 1;
 
-    unshift @INC, \&find_par unless grep { $_ eq \&find_par } @INC;
+    unshift @INC, \&find_par
+        unless $preemptive_extraction_mode || grep { $_ eq \&find_par } @INC;
 
     require PAR::Heavy;
     PAR::Heavy::_init_dynaloader();
@@ -196,6 +199,19 @@
         push @PAR_INC, unpar($0, undef, undef, 1);
 
         my $zip = $LibCache{$0};
+        if ( $preemptive_extraction_mode ) {
+            my $preemptive_lib_dir = $par_temp;
+            $zip->extractTree( "", "$preemptive_lib_dir/" );
+            unshift @INC,
+                map File::Spec->catdir( $preemptive_lib_dir, @$_ ),
+                    [ "lib" ],
+                    [ "arch" ],
+                    [ $arch ],
+                    [ $ver ],
+                    [ $ver, $arch ],
+                    [];
+        }
+
         my $member = $zip->memberNamed("script/main.pl")
                   || $zip->memberNamed("main.pl");
 
@@ -292,6 +308,7 @@
 my %escapes;
 sub unpar {
     my ($par, $file, $member_only, $allow_other_ext) = @_;
+
     my $zip = $LibCache{$par};
     my @rv = $par;
 
Only in PAR/lib: .PAR.pm.swp
Only in PAR: Makefile.old
Only in PAR/myldr: Makefile.old
diff -aur PAR.orig/myldr/Makefile.PL PAR/myldr/Makefile.PL
--- PAR.orig/myldr/Makefile.PL  2004-01-07 10:58:31.000000000 -0500
+++ PAR/myldr/Makefile.PL       2004-01-30 21:56:29.000000000 -0500
@@ -150,7 +150,7 @@
 $par_exe: \$(OBJECTS) my_par_pl$o
        \$(LD) \$(OBJECTS) \$(PERL_LDFLAGS) $out$par_exe_link
 
-my_par_pl.c:
+my_par_pl.c: $par_pl
        \$(PERL) $f2c $par_pl \$@ load_me_2 $long_literal
 
 $parl_exe: $par
Only in PAR/myldr: static.c.orig
diff -aur PAR.orig/script/par.pl PAR/script/par.pl
--- PAR.orig/script/par.pl      2004-01-25 11:10:44.000000000 -0500
+++ PAR/script/par.pl   2004-01-30 22:03:27.000000000 -0500
@@ -247,6 +247,7 @@
             $PAR::Heavy::ModuleCache{$fullname} = {
                 buf => $buf,
                 crc => $crc,
+                name => $fullname,
             };
         }
         read _FH, $buf, 4;
@@ -477,7 +478,10 @@
 
             next unless defined $name and not $written{$name}++;
             next if !ref($file) and $file =~ /\.\Q$lib_ext\E$/;
-            outs(qq(Packing "$file"...));
+            outs( join "",
+                qq(Packing "), ref $file ? $file->{name} : $file,
+                qq("...)
+            );
 
             my $content;
             if (ref($file)) {

Reply via email to