CC: | garfieldnate [...] gmail.com |
Subject: | -M crashes pp if option contains backslashes |
Doing `pp -M path\to\my\Lib.pm` causes a failure: Can't call method "desiredCompressionMethod" on an undefined value at C:/[my path]/PAR/Packer.pm line 1139.
The problem is that Archive::Zip stores members with Unixy names, but Packer.pm was keeping the name with backslashes in it. Then when it called $zip->member($in), the member with the given name didn't exist. I'm including a patch to fix this (generated with diff -u Packer.pm PackerNew.pm > file).
Subject: | Packer.pm.patch |
--- /var/tmp/.diff790528876 2013-08-31 04:06:21.000000000 +0400
+++ /var/tmp/.diff1747176174 2013-08-31 04:06:21.000000000 +0400
@@ -1135,7 +1135,10 @@
$oldsize += length($str);
$self->_vprint(1, "... adding <string> as $in");
- $zip->addString($str => $in)->unixFileAttributes(0644);
+ my $member = $zip->addString($str => $in);
+ $member->unixFileAttributes(0644);
+ # Archive::Zip might have renamed member to something more Unixy
+ $in = $member->fileName;
$zip->memberNamed($in)->desiredCompressionMethod($method);
$zip->memberNamed($in)->desiredCompressionLevel($level);
}