mattk1 has asked for the wisdom of the Perl Monks concerning the following question:
The file from_ram does exist, but I have to set chmod 666 to extract it. The other file does not exist. What do I have to do, to get both in one zip with permissions set to 0666? http://search.cpan.org/~pmqs/IO-Compress-2.025/lib/IO/Compress/Zip.pm#Constructor_Options says If you are running a Unix derivative this value defaults to 0666 << 16 But it is set to$ unzip k.zip Archive: k.zip warning [k.zip]: 186 extra bytes at beginning or within zipfile (attempting to process anyway) inflating: from_ram.t
even I set it explicit. I'am working with Kubuntu 9.10, perl, v5.10.0, IO::Compress::Zip::VERSION 2.024---------- 1 user user 7 2010-03-29 08:44 from_ram.t
I can open the zip per double click in konqueror without error. But I also see only the one file. A look in the bytecode of the zip shows both filenames. It goes without saying, that I have checked each zip command separate.$ file -ik k.zip k.zip: application/zip; charset=binary
I know Archive::Zip, but it is no core module, and this one is core and seems to do what I need, if I use it right.#!/usr/bin/perl use strict; use warnings; use IO::Compress::Zip qw(zip $ZipError :constants) ; use diagnostics; my $zip; zip './a.txt' => \$zip, name => 'from_filename.t', AutoClose => 1, BinModeIn => 1 or die "zip failed: $ZipError\n"; my $string = ss(); zip \$string => \$zip, name => 'from_ram.t', ExtAttr => '0666', Append => 1 or die "zip failed: $ZipError\n"; open my $fh, '>','./k.zip' or die "$!"; print $fh $zip; close($fh); sub ss { return <<END; a b c END }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Build 1 zip from file and string with IO::Compress::Zip
by cdarke (Prior) on Mar 29, 2010 at 13:26 UTC | |
by mattk1 (Acolyte) on Mar 29, 2010 at 20:00 UTC | |
by pmqs (Friar) on Mar 31, 2010 at 19:22 UTC | |
by pmqs (Friar) on Mar 31, 2010 at 19:23 UTC | |
|
Re: Build 1 zip from file and string with IO::Compress::Zip
by bart (Canon) on Mar 30, 2010 at 09:12 UTC | |
|
Re: Build 1 zip from file and string with IO::Compress::Zip
by 7stud (Deacon) on Mar 29, 2010 at 13:00 UTC |