Subject: | PPM can't handle zip files |
Hi Murray,
There's an excellent and fairly extensive PPM repository at
http://trouchelle.com/ppm/ . Unfortunately the binaries there are in
zip format (instead of the more usual tar.gz format). That's not a
problem with the versions of PPM that ship with recent ActiveState
builds, but the version of PPM here on CPAN (2.1.8) cannot handle the
zip format.
The following patch addresses that failing. (I've used this patched
version of PPM to install both zip and tar.gz, but I can't claim that
my testing has been exhaustive. I'm running MinGW-built perl 5.8.8)
--- PPM.pm_orig Mon Nov 6 16:06:32 2006
+++ PPM.pm Sat Aug 11 20:54:15 2007
@@ -26,6 +26,7 @@
use PPM::XML::PPMConfig;
use XML::Parser;
use Archive::Tar;
+use Archive::Zip;
use strict;
@@ -351,15 +352,26 @@
$cwd .= "/" if $cwd =~ /[a-z]:$/i;
chdir($install_dir);
- my $tar;
- if ($basename =~ /\.gz$/i) {
- $tar = Archive::Tar->new($basename,1);
+ my ($tarzip, $have_zip);
+ if ($basename =~ /\.zip$/i) {
+ $have_zip = 1;
+ $tarzip = Archive::Zip->new($basename);
+ $tarzip->extractTree();
+ }
+ elsif ($basename =~ /\.gz$/i) {
+ $tarzip = Archive::Tar->new($basename,1);
+ }
+ else {
+ $tarzip = Archive::Tar->new($basename,0);
+ }
+
+ if ($have_zip) {
+ $basename =~ /(.*).zip/i;
}
else {
- $tar = Archive::Tar->new($basename,0);
+ $tarzip->extract($tarzip->list_files);
+ $basename =~ /(.*).tar/i;
}
- $tar->extract($tar->list_files);
- $basename =~ /(.*).tar/i;
chdir($1);
RelocPerl('.') if ($Config{'osname'} ne 'MSWin32');
Cheers,
Rob