Fri Aug 30 20:11:35 2013: Request 88297 was acted upon.
Transaction: Ticket created by NGLENN
       Queue: PAR-Packer
     Subject: -M crashes pp if option contains backslashes
   Broken in: 1.014
    Severity: (no value)
       Owner: Nobody
  Requestors: ngl...@cpan.org
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=88297 >


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).

--- /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);
     }

Reply via email to