I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2009-07-20 21:49:06-07 by hessu75
Archive-Zip fails to create new directories
Hello/FYI

I have problems with extractMemberWithoutPaths and with extractTree when extracting archive with relative paths. It seems that the syntax for mkpath in Member.pm and DirectoryMember.pm is causing the problem. Or the problem is in my Perl installation, or something...

If I run something like below pasted code, the creation of new folders with relative paths will fail with error /1/ from mkpath. I managed to get extractMemberWithoutPaths to work with absolute paths but not with relative paths. For extractTree, I was not able to figure out proper syntax to get it to work with absolute or relative paths.

If I change Member.pm and DirectoryMemeber.pm like the creation of new folders seem to work with relative paths on Windows XP SP3 with latest patches. Perl version and modules below.

Did not really understand what I did, just got the idea from here.

# /1/ perl die isa.pm:60 - Can't call method "can" without a package or object reference at D:/Apps +/Perl/site/lib/UNIVERSAL/isa.pm line 60. # # mkpath( dirname($name) ); --> mkpath( dirname($name), { verbose => 0,}); # mkpath( $name, 0, $attribs ); --> mkpath( $name, { verbose => 0, mode => $attribs,} ); # ################################################################################ use strict; use warnings; use Archive::Zip qw(:ERROR_CODES :CONSTANTS); extract_archive(); # The example below contains archive1.zip that contains file1.txt and # archive2.zip. The archive2.zip contains folder 'tool' that contains # few subfolders and files inside them. The archive1.zip is supposed # to be extracted on temp folder called 'folder' to process the # archive2.zip in there. sub extract_archive{ my $l_zip1 = Archive::Zip->new(); my $l_zip2 = Archive::Zip->new(); my $l_status = 0; my $l_path = q{}; $l_path = '.' . '\\' . 'folder1' . '\\'; if( ($l_status = $l_zip1->read('D:\Work\Programming\Perl\tool\trunk\archive1.zip') ) == AZ_OK ) { $l_zip1->extractMemberWithoutPaths("file1.txt", '.\folder\file1.txt'); $l_zip1->extractMemberWithoutPaths("archive2.zip", '.\folder\archive2.zip'); if( ($l_status = $l_zip2->read('.\folder\archive2.zip') ) == AZ_OK ) { $l_zip2->extractTree("tool", '.\folder\tool'); } } return; } ################################################################################ # # Archive-Zip version 1.30 # File-Path version 2.0702 # # D:\Work\Programming\Perl\NEHA\trunk>perl -version # # This is perl, v5.8.9 built for MSWin32-x86-multi-thread # (with 12 registered patches, see perl -V for more detail) # # Copyright 1987-2008, Larry Wall # # Binary build 826 [290470] provided by ActiveState http://www.ActiveState.com # Built May 24 2009 09:21:05
Direct Responses: Write a response