r3580 - in /packages/libpar-perl/trunk: ./ debian/ lib/ lib/PAR/ lib/PAR/Filter/ t/

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Sat Sep 2 17:51:25 UTC 2006


Author: gregoa-guest
Date: Sat Sep  2 17:51:24 2006
New Revision: 3580

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3580
Log:
* New upstream release.
* Set debhelper compatibility level to 5.
* Add libinline-perl to build dependencies.

Added:
    packages/libpar-perl/trunk/t/40-par-hashref.t
      - copied unchanged from r3579, packages/libpar-perl/branches/upstream/current/t/40-par-hashref.t
    packages/libpar-perl/trunk/t/Hello.pm
      - copied unchanged from r3579, packages/libpar-perl/branches/upstream/current/t/Hello.pm
Modified:
    packages/libpar-perl/trunk/ChangeLog
    packages/libpar-perl/trunk/MANIFEST
    packages/libpar-perl/trunk/META.yml
    packages/libpar-perl/trunk/Makefile.PL
    packages/libpar-perl/trunk/SIGNATURE
    packages/libpar-perl/trunk/debian/changelog
    packages/libpar-perl/trunk/debian/compat
    packages/libpar-perl/trunk/debian/control
    packages/libpar-perl/trunk/lib/PAR.pm
    packages/libpar-perl/trunk/lib/PAR/Filter/PatchContent.pm
    packages/libpar-perl/trunk/lib/PAR/Heavy.pm
    packages/libpar-perl/trunk/lib/PAR/Packer.pm
    packages/libpar-perl/trunk/t/30-current_exec.t

Modified: packages/libpar-perl/trunk/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/ChangeLog?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/ChangeLog (original)
+++ packages/libpar-perl/trunk/ChangeLog Sat Sep  2 17:51:24 2006
@@ -1,3 +1,47 @@
+
+[Changes for 0.952 - Aug 22, 2006]
+
+* New features
+	- Added the "install" option to the PAR loading syntax.
+	  If specified, the contents of the PAR distribution are
+	  permanently installed.
+	  This requires PAR::Repository::Client 0.04.
+
+* Bug fixes, etc.
+	- Fixed broken META.yml in 0.951.
+
+[Changes for 0.951 - Aug 12, 2006]
+(This includes any changes up to 0.950.)
+
+* New features
+
+    - Introduced new PAR loading syntax and semantics:
+      use PAR { file => 'path/to/par/or/URL' };
+      ==> equivalent to "use PAR 'path/to/par/or/URL';"
+    - Introduced the 'fallback' option: (default = 0)
+      use PAR { file => 'foo.par', fallback => 1 };
+      ==> Loads modules from the PAR file only if loading
+          them from @INC did not succeed.
+    - Introduced the 'run' option which executes a script
+      in a PAR archive just like
+      perl -MPAR foo.par script.pl
+    - If PAR::Repository::Client is installed, you can add a
+      repository of .par distributions to your library search path
+      as follows:
+      use PAR { repository => 'http://foo' };
+    - Of course, 'run' also works with repositories:
+      use PAR { repository => 'http://foo', run => 'my_app' };
+      (This searches the repository for any distributions that have a
+      my_app script.)
+    --> For details on repositories, have a look at the
+        PAR::Repository::Client module.
+
+- Bug fixes, etc.
+
+    - Commented a couple of the routines in PAR.pm. (Yay!)
+    - New test script for the new fallback loading feature.
+    - Fixed a bug in the Spreadsheet::ParseExcel handling in
+      PatchContent.pm.
 
 [Changes for 0.942 - Jul 22, 2006]
 

Modified: packages/libpar-perl/trunk/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/MANIFEST?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/MANIFEST (original)
+++ packages/libpar-perl/trunk/MANIFEST Sat Sep  2 17:51:24 2006
@@ -70,6 +70,8 @@
 t/1-basic.t
 t/2-pp.t
 t/30-current_exec.t
+t/40-par-hashref.t
 t/hello.par
+t/Hello.pm
 t/test-proc
 TODO

Modified: packages/libpar-perl/trunk/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/META.yml?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/META.yml (original)
+++ packages/libpar-perl/trunk/META.yml Sat Sep  2 17:51:24 2006
@@ -1,7 +1,7 @@
 abstract: Perl Archive Tookit
 author: Audrey Tang <cpan at audreyt.org>
 distribution_type: module
-generated_by: Module::Install version 0.63
+generated_by: Module::Install version 0.630
 license: perl
 name: PAR
 no_index: 
@@ -9,6 +9,32 @@
     - contrib
     - inc
     - t
+provides: 
+  App::Packer::PAR: 
+    file: lib/App/Packer/PAR.pm
+    version: 0.91
+  PAR: 
+    file: lib/PAR.pm
+    version: 0.952
+  PAR::Filter: 
+    file: lib/PAR/Filter.pm
+    version: 0.02
+  PAR::Filter::Bleach: 
+    file: lib/PAR/Filter/Bleach.pm
+  PAR::Filter::Bytecode: 
+    file: lib/PAR/Filter/Bytecode.pm
+  PAR::Filter::Obfuscate: 
+    file: lib/PAR/Filter/Obfuscate.pm
+  PAR::Filter::PatchContent: 
+    file: lib/PAR/Filter/PatchContent.pm
+  PAR::Filter::PodStrip: 
+    file: lib/PAR/Filter/PodStrip.pm
+  PAR::Heavy: 
+    file: lib/PAR/Heavy.pm
+    version: 0.09
+  PAR::Packer: 
+    file: lib/PAR/Packer.pm
+    version: 0.12
 recommends: 
   Digest: Module::Signature
 requires: 
@@ -17,6 +43,6 @@
   File::Temp: 0.05
   Getopt::ArgvFile: 1.07
   Module::ScanDeps: 0.62
-  PAR::Dist: 0.13
+  PAR::Dist: 0.15
   perl: 5.6.0
-version: 0.942
+version: 0.952

Modified: packages/libpar-perl/trunk/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/Makefile.PL?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/Makefile.PL (original)
+++ packages/libpar-perl/trunk/Makefile.PL Sat Sep  2 17:51:24 2006
@@ -11,7 +11,7 @@
 requires    'Compress::Zlib'    => ($^O eq 'MSWin32') ? 1.16 : 1.30;
 requires    'Archive::Zip'      => 1.00;
 requires    'Module::ScanDeps'  => 0.62;
-requires    'PAR::Dist'         => 0.13;
+requires    'PAR::Dist'         => 0.15;
 requires    'Getopt::ArgvFile'  => 1.07;
 
 if ($^O eq 'MSWin32') {

Modified: packages/libpar-perl/trunk/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/SIGNATURE?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/SIGNATURE (original)
+++ packages/libpar-perl/trunk/SIGNATURE Sat Sep  2 17:51:24 2006
@@ -15,11 +15,11 @@
 Hash: SHA1
 
 SHA1 5e4dcc7292860e3e2077bfce25626b46f967ff3b AUTHORS
-SHA1 5bf2138d1d1c210114e3e6e2631a637145acd93b ChangeLog
-SHA1 58f6e546be4afb200bddc491144978ab184a8fa9 MANIFEST
+SHA1 e37cfe8b14201708bcefe61ea5f7317c93ade249 ChangeLog
+SHA1 10e4c432207c72f22f07dab86e1264c51a162c69 MANIFEST
 SHA1 a425969945e62fcc7783784916d552d370b94951 MANIFEST.SKIP
-SHA1 7ea657d24f7b0c83473a28dbb40eccdc2465c06b META.yml
-SHA1 2ce63207f867c681e023f6ee9bc47420d864e58f Makefile.PL
+SHA1 205aadf5805867aa91605a62a191334f4f0db7c7 META.yml
+SHA1 e262db1fdcdb98368893557de2575c162a2ba246 Makefile.PL
 SHA1 44d54db39e89f38c714e334a3174d51d4a12b6d9 README
 SHA1 aa8cd09fa1945de92b01d77b979b4c8769f148c2 TODO
 SHA1 5b59e5c9ef0fc0773ba431c3c171722cb677eda9 contrib/automated_pp_test/automated_pp_test.pl
@@ -54,16 +54,16 @@
 SHA1 a9037004a2c3096d77169a16da95743eeb813539 inc/Test/Builder/Module.pm
 SHA1 07c750f370de7a44ee7b0ed9ec30a7e89c24c9b9 inc/Test/More.pm
 SHA1 f2e051c0866a1e186ef57fe4360651fac64d858d lib/App/Packer/PAR.pm
-SHA1 19ae583abbea851ba17b922b202dab6182291031 lib/PAR.pm
+SHA1 28a8c30c00026dd5ee9153ec4c0887153b5e4b50 lib/PAR.pm
 SHA1 3670831693b92311c425039cbacffe829fbb887e lib/PAR/FAQ.pod
 SHA1 b236006a3343ad736a4d5352dc1e017627c6f8b8 lib/PAR/Filter.pm
 SHA1 caeff2887611bb028f49ecc16f91be3e2005f952 lib/PAR/Filter/Bleach.pm
 SHA1 22fe366553e51dd33226a70f15b939213b9b91a9 lib/PAR/Filter/Bytecode.pm
 SHA1 3d05249a79d9534ea8565b984ea9dd23a86f7d2e lib/PAR/Filter/Obfuscate.pm
-SHA1 2098e03071b7213226ee2df1fc2c8ba3779ca89a lib/PAR/Filter/PatchContent.pm
+SHA1 650fa094245de4f5b9ed03ae5257fb9b3d8ddba6 lib/PAR/Filter/PatchContent.pm
 SHA1 8a40b2673f73887cd05f2c66e08f01919f81db38 lib/PAR/Filter/PodStrip.pm
-SHA1 1ca28809a4d6863f8999ebb7527d48da8255b41e lib/PAR/Heavy.pm
-SHA1 fb179fa02b0cd0def2e1c8d50b557dcfa8c7a6ea lib/PAR/Packer.pm
+SHA1 e153f2a9808b2d1c78af6d4f065209b52be502ff lib/PAR/Heavy.pm
+SHA1 006bc27f51bc620b2bc73dae12f5641a81e0fd5d lib/PAR/Packer.pm
 SHA1 44d0f288e8c9a7362697b5d64c4272da16cfe0c9 lib/PAR/Tutorial.pod
 SHA1 5db6a8ce4db737a5873290321f5324994e53fd45 myldr/Makefile.PL
 SHA1 4cb31931bfa898bba56d645b574983930492ab18 myldr/env.c
@@ -85,13 +85,15 @@
 SHA1 8fa71d5726e8c6c0e484d6ccb20cc0bd83b669b6 script/tkpp
 SHA1 dc1c8eb9ff09172ea1df02257b68032695673e2e t/1-basic.t
 SHA1 3b8ab1207b358709716fc05aa5da339f630d44b6 t/2-pp.t
-SHA1 d2f72a5665ecac6b5fce3bbacca86a2a65040e24 t/30-current_exec.t
+SHA1 85d81927e4fa5621581c20c2481235a4f67343b7 t/30-current_exec.t
+SHA1 82548e8de5a8d7a451d33cfcdece13f613d0efc2 t/40-par-hashref.t
+SHA1 0ebe6181affc8afe78fad4446075d8f0ee420cfd t/Hello.pm
 SHA1 a0258484d56cc699190be4cd93a16d145a0e1d16 t/hello.par
 SHA1 0146f0bd0bac69300c4317accbe2d9c69e18fef7 t/test-proc
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.2.2 (GNU/Linux)
 
-iD8DBQFEwoNDZCuimE51gxcRAoqHAJ9HzMhPBFOlil7ad0hC6h1LxXr4uQCeNeWW
-p8ANbj36VR2c6SvmOZyj7hA=
-=xF/+
+iD8DBQFE6xD5ZCuimE51gxcRAjzxAJ9n9OrVx6JDdBmljuVFzwXbNSmFhgCghCQD
+4406L8QvsSI3JavXA4ueci4=
+=7iOu
 -----END PGP SIGNATURE-----

Modified: packages/libpar-perl/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/debian/changelog?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/debian/changelog (original)
+++ packages/libpar-perl/trunk/debian/changelog Sat Sep  2 17:51:24 2006
@@ -1,3 +1,11 @@
+libpar-perl (0.952-1) unstable; urgency=low
+
+  * New upstream release.
+  * Set debhelper compatibility level to 5.
+  * Add libinline-perl to build dependencies.
+
+ -- gregor herrmann <gregor+debian at comodo.priv.at>  Sat,  2 Sep 2006 19:45:59 +0200
+
 libpar-perl (0.942-1) unstable; urgency=low
 
   * New upstream release

Modified: packages/libpar-perl/trunk/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/debian/compat?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/debian/compat (original)
+++ packages/libpar-perl/trunk/debian/compat Sat Sep  2 17:51:24 2006
@@ -1,1 +1,1 @@
-4
+5

Modified: packages/libpar-perl/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/debian/control?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/debian/control (original)
+++ packages/libpar-perl/trunk/debian/control Sat Sep  2 17:51:24 2006
@@ -1,9 +1,9 @@
 Source: libpar-perl
 Section: perl
 Priority: optional
-Build-Depends: perl (>= 5.8.0-7), libperl-dev, debhelper (>= 4.0.2), libmodule-install-perl, libmodule-scandeps-perl (>= 0.62), libarchive-zip-perl, libpar-dist-perl (>= 0.13), libdigest-sha1-perl, libmodule-signature-perl, libgetopt-argvfile-perl (>= 1.07), gnupg
+Build-Depends: perl (>= 5.8.0-7), libperl-dev, debhelper (>= 5.0.0), libmodule-install-perl, libmodule-scandeps-perl (>= 0.62), libarchive-zip-perl, libpar-dist-perl (>= 0.13), libdigest-sha1-perl, libmodule-signature-perl, libgetopt-argvfile-perl (>= 1.07), gnupg, libinline-perl
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Florian Ragwitz <rafl at debian.org>, Krzysztof Krzyzaniak (eloy) <eloy at debian.org>
+Uploaders: Florian Ragwitz <rafl at debian.org>, Krzysztof Krzyzaniak (eloy) <eloy at debian.org>, gregor herrmann <gregor+debian at comodo.priv.at>
 Standards-Version: 3.7.2
 
 Package: libpar-perl

Modified: packages/libpar-perl/trunk/lib/PAR.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/lib/PAR.pm?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/lib/PAR.pm (original)
+++ packages/libpar-perl/trunk/lib/PAR.pm Sat Sep  2 17:51:24 2006
@@ -1,10 +1,11 @@
 package PAR;
-$PAR::VERSION = '0.942';
+$PAR::VERSION = '0.952';
 
 use 5.006;
 use strict;
 use warnings;
 use Config '%Config';
+use Carp qw/croak/;
 
 =head1 NAME
 
@@ -12,7 +13,7 @@
 
 =head1 VERSION
 
-This document describes version 0.942 of PAR, released July 22, 2006.
+This document describes version 0.952 of PAR, released August 22, 2006.
 
 =head1 SYNOPSIS
 
@@ -75,6 +76,47 @@
 
     use PAR '/home/foo/*.par';  # loads all PAR files in that directory
 
+Since version 0.950, you can also use a different syntax for loading
+F<.par> archives:
+
+    use PAR { file => 'foo.par' }, { file => 'otherfile.par' };
+
+Why? Because you can also do this:
+
+    use PAR { file => 'foo.par, fallback => 1 };
+    use Foo::Bar;
+
+Foo::Bar will be searched in the system libs first and loaded from F<foo.par>
+if it wasn't found!
+
+    use PAR { file => 'foo.par', run => 'myscript' };
+
+This will load F<foo.par> as usual and then execute the F<script/myscript>
+file from the archive. Note that your program will not regain control. When
+F<script/myscript> exits, so does your main program. To make this more useful,
+you can defer this to runtime: (otherwise equivalent)
+
+    require PAR;
+    PAR->import( { file => 'foo.par', run => 'myscript' };
+
+If you have L<PAR::Repository::Client> installed, you can do this:
+
+    use PAR { repository => 'http://foo/bar/' };
+    use Module; # not locally installed!
+
+And PAR will fetch any modules you don't have from the specified PAR
+repository. For details on how this works, have a look at the SEE ALSO
+section below. If you specify the C<install =E<gt> 1> option in the C<use PAR>
+line above, the distribution containing C<Module> will be permanently
+installed on your system. (C<use PAR { repository =E<gt> 'http://foo/bar', install =E<gt> 1 };>)
+
+Finally, you can combine the C<run> and C<repository>
+options to run an application directly from a repository! (And you can add
+the C<install> option, too.)
+
+  use PAR { repository => 'http://foo/bar/', run => 'my_app' };
+  # Will not reach this point as we executed my_app,
+
 =head1 DESCRIPTION
 
 This module lets you easily bundle a typical F<blib/> tree into a zip
@@ -165,7 +207,7 @@
 =item *
 
 I<USER> is the user name, or SYSTEM if none can be found.  On Win32, 
-this is C<$Win32::LoginName>.  On Unix, this is C<$ENV{USERNAME>> or 
+this is C<$Win32::LoginName>.  On Unix, this is C<$ENV{USERNAME}> or 
 C<$ENV{USER}>.
 
 =item *
@@ -186,10 +228,13 @@
 
 =cut
 
-use vars qw(@PAR_INC);  # explicitly stated PAR library files
-use vars qw(%PAR_INC);  # sets {$par}{$file} for require'd modules
-use vars qw(@LibCache %LibCache);       # I really miss pseudohash.
+use vars qw(@PAR_INC);              # explicitly stated PAR library files (prefered)
+use vars qw(@PAR_INC_LAST);         # explicitly stated PAR library files (fallback)
+use vars qw(%PAR_INC);              # sets {$par}{$file} for require'd modules
+use vars qw(@LibCache %LibCache);   # I really miss pseudohash.
 use vars qw($LastAccessedPAR $LastTempFile);
+use vars qw(@RepositoryObjects);    # If we have PAR::Repository::Client support, we
+                                    # put the ::Client objects in here.
 
 my $ver  = $Config{version};
 my $arch = $Config{archname};
@@ -201,6 +246,8 @@
 );
 my $par_temp;
 
+
+# called on "use PAR"
 sub import {
     my $class = shift;
 
@@ -210,26 +257,40 @@
     $progname = $ENV{PAR_PROGNAME} ||= $0;
     $is_insensitive_fs = (-s $progname and (-s lc($progname) || -1) == (-s uc($progname) || -1));
 
-    foreach my $par (@_) {
-        if ($par =~ /[?*{}\[\]]/) {
-            require File::Glob;
-            foreach my $matched (File::Glob::glob($par)) {
-                push @PAR_INC, unpar($matched, undef, undef, 1);
-            }
-            next;
-        }
-
-        push @PAR_INC, unpar($par, undef, undef, 1);
+    my @args = @_;
+    
+    # process args to use PAR 'foo.par', { opts }, ...;
+    foreach my $par (@args) {
+        if (ref($par) eq 'HASH') {
+            # we have been passed a hash reference
+            _import_hash_ref($par);
+        }
+        elsif ($par =~ /[?*{}\[\]]/) {
+           # implement globbing for PAR archives
+           require File::Glob;
+           foreach my $matched (File::Glob::glob($par)) {
+               push @PAR_INC, unpar($matched, undef, undef, 1);
+           }
+        }
+        else {
+            # ordinary string argument => file
+            push @PAR_INC, unpar($par, undef, undef, 1);
+        }
     }
 
     return if $PAR::__import;
     local $PAR::__import = 1;
 
-    unshift @INC, \&find_par unless grep { $_ eq \&find_par } @INC;
+    # Insert PAR hook in @INC.
+    unshift @INC, \&find_par   unless grep { $_ eq \&find_par }      @INC;
+    push @INC, \&find_par_last unless grep { $_ eq \&find_par_last } @INC;
 
     require PAR::Heavy;
     PAR::Heavy::_init_dynaloader();
 
+    # The following code is executed for the case where the
+    # running program is itself a PAR archive.
+    # ==> run script/main.pl
     if (unpar($progname)) {
         # XXX - handle META.yml here!
         push @PAR_INC, unpar($progname, undef, undef, 1);
@@ -260,10 +321,112 @@
     }
 }
 
+
+# import() helper for the "use PAR {...};" syntax.
+sub _import_hash_ref {
+    my $opt = shift;
+    # check for incompatible options:
+    if ( exists $opt->{repository} and exists $opt->{file} ) {
+        croak("Invalid PAR loading options. Cannot have a 'repository' and 'file' option at the same time.");
+    }
+    elsif (
+        exists $opt->{file}
+        and (exists $opt->{install} or exists $opt->{upgrade})
+    ) {
+        my $e = exists($opt->{install}) ? 'install' : 'upgrade';
+        croak("Invalid PAR loading options. Cannot combine 'file' and '$e' options.");
+    }
+    elsif ( not exists $opt->{repository} and not exists $opt->{file} ) {
+        croak("Invalid PAR loading options. Need at least one of 'file' or 'repository' options.");
+    }
+
+    # load from file
+    if (exists $opt->{file}) {
+        croak("Cannot load undefined PAR archive")
+          if not defined $opt->{file};
+
+        # for files, we default to loading from PAR archive first
+        my $fallback = $opt->{fallback};
+        $fallback = 0 if not defined $fallback;
+        
+        if (not $fallback) {
+            # load from this PAR arch preferably
+            push @PAR_INC, unpar($opt->{file}, undef, undef, 1);
+        }
+        else {
+            # load from this PAR arch as fallback
+            push @PAR_INC_LAST, unpar($opt->{file}, undef, undef, 1);
+        }
+        
+    }
+    else {
+        # Deal with repositories elsewhere
+        my $client = _import_repository($opt);
+        return() if not $client;
+
+        if (defined $opt->{run}) {
+            # run was specified
+            # run the specified script from the repository
+            $client->run_script( $opt->{run} );
+            return 1;
+        }
+        
+        return 1;
+    }
+
+    # run was specified
+    # run the specified script from inside the PAR file.
+    if (defined $opt->{run}) {
+        my $script = $opt->{run};
+        require PAR::Heavy;
+        PAR::Heavy::_init_dynaloader();
+        
+        # XXX - handle META.yml here!
+        _extract_inc($opt->{file}) unless $ENV{PAR_CLEAN};
+        
+        my $zip = $LibCache{$opt->{file}};
+        my $member = _first_member( $zip,
+            (($script !~ /^script\//) ? ("script/$script", "script/$script.pl") : ()),
+            $script,
+            "$script.pl",
+        );
+        
+        if (not defined $member) {
+            croak("Cannot run script '$script' from PAR file '$opt->{file}'. Script couldn't be found in PAR file.");
+        }
+        
+        _run_member($member);
+    }
+
+    return();
+}
+
+
+# This sub is invoked by _import_hash_ref if a {repository}
+# option is found
+# Returns the repository client object on success.
+sub _import_repository {
+    my $opt = shift;
+    my $url = $opt->{repository};
+
+    eval "require PAR::Repository::Client; 1;";
+    if ($@ or not PAR::Repository::Client->VERSION >= 0.04) {
+        croak "In order to use the 'use PAR { repository => 'url' };' syntax, you need to install the PAR::Repository::Client module (version 0.04 or later) from CPAN. This module does not seem to be installed as indicated by the following error message: $@";
+    }
+    my $obj = PAR::Repository::Client->new(
+        uri => $url,
+        auto_install => $opt->{install},
+    );
+
+    push @RepositoryObjects, $obj;
+    return $obj;
+}
+
 sub _first_member {
     my $zip = shift;
     my %names = map { ( $_->fileName => $_ ) } $zip->members;
-    my %lc_names = map { ( lc($_->fileName) => $_ ) } $zip->members;
+    my %lc_names;
+    %lc_names = map { ( lc($_->fileName) => $_ ) } $zip->members if $is_insensitive_fs;
     foreach my $name (@_) {
         return $names{$name} if $names{$name};
         return $lc_names{lc($name)} if $is_insensitive_fs and $lc_names{lc($name)};
@@ -328,15 +491,60 @@
         [ 'lib' ], [ 'arch' ], [ $arch ], [ $ver ], [ $ver, $arch ], [];
 }
 
+
+# This is the hook placed in @INC for loading PAR's
+# before any other stuff in @INC
 sub find_par {
-    my ($self, $file, $member_only) = @_;
+    return _find_par_internals(\@PAR_INC, @_);
+}
+
+# This is the hook placed in @INC for loading PAR's
+# AFTER any other stuff in @INC
+# It also deals with loading from repositories as a
+# fallback-fallback ;)
+sub find_par_last {
+    my @args = @_;
+    # Try the local PAR files first
+    my $rv = _find_par_internals(\@PAR_INC_LAST, @args);
+    return $rv if defined $rv;
+
+    # No repositories => return
+    return $rv if not @RepositoryObjects;
+
+    my $module = $args[1];
+    $module =~ s/\.pm$//;
+    $module =~ s/\//::/g;
+    foreach my $client (@RepositoryObjects) {
+        my $local_file = $client->get_module($module, 1);
+        if ($local_file) {
+            return _find_par_internals([$PAR_INC_LAST[-1]], @args);
+        }
+    }
+    return $rv;
+}
+
+
+# This is a conjunction of the early find_par and the late
+# find_par_last. It's called by PAR::Heavy for Dynaloader stuff.
+sub _find_par_any {
+    return _find_par_internals([@PAR_INC, @PAR_INC_LAST], @_);
+}
+
+
+
+# This routine implements loading modules from PARs
+# both for loading PARs preferably or as fallback.
+# To distinguish the cases, the first parameter should
+# be a reference to the corresponding @PAR_INC* array.
+sub _find_par_internals {
+    my ($INC_ARY, $self, $file, $member_only) = @_;
 
     my $scheme;
-    foreach (@PAR_INC ? @PAR_INC : @INC) {
+    foreach (@$INC_ARY ? @$INC_ARY : @INC) {
         my $path = $_;
         if ($[ < 5.008001) {
             # reassemble from "perl -Ischeme://path" autosplitting
-            $path = "$scheme:$path" if !@PAR_INC
+            $path = "$scheme:$path" if !@$INC_ARY
                 and $path and $path =~ m!//!
                 and $scheme and $scheme =~ /^\w+$/;
             $scheme = $path;
@@ -432,9 +640,9 @@
         require Archive::Zip;
         $zip = Archive::Zip->new;
 
-	my @file;
+    	my @file;
         if (!ref $par) {
-	    @file = $par;
+	        @file = $par;
 
             open my $fh, '<', $par;
             binmode($fh);
@@ -459,6 +667,49 @@
             next unless $content =~ /^PK\003\004/;
             push @rv, unpar(\$content, undef, undef, 1);
         }
+        
+        # extract all dlls from the .par to $ENV{PAR_TEMP}!
+        # XXX is this correct?
+        # Intended to fix problem with Alien::wxWidgets/Wx...
+        # for all zip members that end in .dll/.so (depending on platform)
+        foreach my $member ( $zip->membersMatching(
+            '\.'.quotemeta($Config{dlext}).'$'
+        ) ) {
+            next if $member->isDirectory or !$ENV{PAR_TEMP};
+            my $member_name = $member->fileName;
+            next unless $member_name =~ m{
+                    \/([^/]+)$
+                }x
+                or $member_name =~ m{
+                    ^([^/]+)$
+                };
+            my $extract_name = $1;
+            my $dest_name = File::Spec->catfile($ENV{PAR_TEMP}, $extract_name);
+            $member->extractToFileNamed($dest_name);
+        }
+
+        # Now push this path into usual library search paths
+        my $separator = $Config{path_sep};
+        my $tempdir = $ENV{PAR_TEMP};
+        foreach my $key (qw(
+            LD_LIBRARY_PATH
+            LIB_PATH
+            LIBRARY_PATH
+            PATH
+            DYLD_LIBRARY_PATH
+        )) {
+           if (defined $ENV{$key} and $ENV{$key} ne '') {
+               # Check whether it's already in the path. If so, don't
+               # append the PAR temp dir in order not to overflow the
+               # maximum length for ENV vars.
+               $ENV{$key} .= $separator . $tempdir
+                 unless grep { $_ eq $tempdir } split $separator, $ENV{$key};
+           }
+           else {
+               $ENV{$key} = $tempdir;
+           }
+       }
+    
     }
 
     $LastAccessedPAR = $zip;
@@ -608,13 +859,22 @@
     }
 }
 
+
 1;
 
 =head1 SEE ALSO
 
-L<PAR::Tutorial>, L<PAR::FAQ>
+The PAR homepage at L<http://par.perl.org>.
+
+L<PAR::Tutorial>, L<PAR::FAQ> (For a more
+current FAQ, refer to the homepage.)
 
 L<par.pl>, L<parl>, L<pp>
+
+L<PAR::Dist> for details on PAR distributions.
+
+L<PAR::Repository::Client> for details on accessing PAR repositories.
+L<PAR::Repository> for details on how to set up such a repository.
 
 L<Archive::Zip>, L<perlfunc/require>
 

Modified: packages/libpar-perl/trunk/lib/PAR/Filter/PatchContent.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/lib/PAR/Filter/PatchContent.pm?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/lib/PAR/Filter/PatchContent.pm (original)
+++ packages/libpar-perl/trunk/lib/PAR/Filter/PatchContent.pm Sat Sep  2 17:51:24 2006
@@ -30,7 +30,7 @@
     # Since it's not POD, POD parsers ignore it.
     # PAR::Filter::PodStrip only strips valid POD. Hence we remove it here.
     'Spreadsheet/ParseExcel.pm' => [
-        qr/^=cmmt\s+.*=cut\s*/sm =>
+        qr/^=cmmt\s+.*?^=cut\s*/sm =>
         '',
     ],
     'SQL/Parser.pm'      => [

Modified: packages/libpar-perl/trunk/lib/PAR/Heavy.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/lib/PAR/Heavy.pm?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/lib/PAR/Heavy.pm (original)
+++ packages/libpar-perl/trunk/lib/PAR/Heavy.pm Sat Sep  2 17:51:24 2006
@@ -82,7 +82,7 @@
     }
 
     my $member;
-    $member = PAR::find_par(undef, $file, 1) if defined &PAR::find_par;
+    $member = PAR::_find_par_any(undef, $file, 1) if defined &PAR::_find_par_any;
     return $bootstrap->(@args) unless $member;
 
     $FullCache{$file} = _dl_extract($member, $file);

Modified: packages/libpar-perl/trunk/lib/PAR/Packer.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/lib/PAR/Packer.pm?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/lib/PAR/Packer.pm (original)
+++ packages/libpar-perl/trunk/lib/PAR/Packer.pm Sat Sep  2 17:51:24 2006
@@ -1435,7 +1435,7 @@
                 || $zip->memberNamed("$file.pl")
                 || $zip->memberNamed("script/$file")
                 || $zip->memberNamed("script/$file.pl")
-        or die qq(mail.pl: Can't open perl script "$file": No such file or directory);
+        or die qq(main.pl: Can't open perl script "$file": No such file or directory);
 PAR::_run_member($member, 1);
 
 __MAIN__

Modified: packages/libpar-perl/trunk/t/30-current_exec.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libpar-perl/trunk/t/30-current_exec.t?rev=3580&op=diff
==============================================================================
--- packages/libpar-perl/trunk/t/30-current_exec.t (original)
+++ packages/libpar-perl/trunk/t/30-current_exec.t Sat Sep  2 17:51:24 2006
@@ -93,7 +93,7 @@
 #### Clean up
 unlink $EXEC;
 rmtree( [$TEMP] );
-mkpath( [$TEMP], 0, 0700 );
+#mkpath( [$TEMP], 0, 0700 );
 
 
 1;




More information about the Pkg-perl-cvs-commits mailing list