in reply to Multi file stream with IO::Compress::Zip

I havent used this interface, but it looks like the syntax you need is :
# Possibly, need to set binmode... $zip->newStream(name=>"SomeFileName.txt" ); # in a loop .. write data using: $zip->write $data, $length, $offset; # Then finally $zip->close; # Or do newStream for some other file name..

        "You're only given one little spark of madness. You mustn't lose it."         - Robin Williams

Replies are listed 'Best First'.
Re^2: Multi file stream with IO::Compress::Zip
by Rodster001 (Pilgrim) on Sep 17, 2014 at 05:06 UTC
    What I couldn't figure out is how to specify a new (change of) filename. But see my update above, I went with a different module and it does what I need.

      If a streamed Zip file with multiple members is what you need then Archive::Zip::SimpleZip is probably the best way to go.

      I see in your code you've used '-' to force streaming. You can explicitly request streaming to a file/buffer by specifying the Stream option, as shown below. If writing to STDOUT is what you need, then you don't need to explicitly set it.

      ## Explicitly ask for Stream is set to 1 my $z = new Archive::Zip::SimpleZip "somefile.zip, Stream => 1 or print STDERR "Cannot create zip file: $SimpleZipError\n";

      FYI - I wrote Archive::Zip::SimpleZip because the interface I provided in IO::Compress::Zip to create a Zip file with multiple members is not the easiest to use. Archive::Zip::SimpleZip is just a wrapper around IO::Compress::Zip to make this use-case as easy as possible.

        I am using Archive::Zip::SimpleZip and it works exactly as needed. Thanks for your work, it's great!