in reply to Re^2: Getting IO::Compress::Zip to include directory entries (on Windows)
in thread Getting IO::Compress::Zip to include directory entries (on Windows)

what I'm trying to do is include the directory entry itself

In the docs it says filenames only

If $input is an array reference, each element in the array must be a filename. The input data will be read from each file in turn. The complete array will be walked to ensure that it only contains valid filenames before any data is compressed.
poj
  • Comment on Re^3: Getting IO::Compress::Zip to include directory entries (on Windows)

Replies are listed 'Best First'.
Re^4: Getting IO::Compress::Zip to include directory entries (on Windows)
by pmqs (Friar) on Feb 03, 2016 at 13:10 UTC

    IO::Compress::Zip cannot write directories (without jumping through a lot of hoops) by design.

    I do have another module, called Archive::Zip::SimpleZip (it actually uses IO::Compress::Zip under the hood), that can create directories.

    Here is a example of how to use it

    use strict ; use warnings; use Archive::Zip::SimpleZip; my @dirs = ("WEB-INF"); my $zip = Archive::Zip::SimpleZip->new("test.zip"); $zip->add($_) for @dirs; $zip->close();

    and here is what the commandline unzip this about the zip file

    $ unzip -l test.zip Archive: test.zip Length Date Time Name --------- ---------- ----- ---- 0 02-03-2016 12:58 WEB-INF/ --------- ------- 0 1 file