in reply to Build 1 zip from file and string with IO::Compress::Zip
Note that I set the permissions in ExtAttr - the default does not appear to be implemented (I got 000 without it), and it is not a string as your code supplies it.#!/usr/bin/perl use strict; use warnings; use IO::Compress::Zip qw(zip $ZipError :constants); my $z; $z = new IO::Compress::Zip './k.zip', name => 'from_filename.t', AutoClose => 1, BinModeIn => 1 or die "IO::Compress::Zip(1) failed: $ZipError\n"; open (my $fh, '<', './a.txt') or die "Unable to open a.txt: $!"; while (<$fh>) { $z->print ($_) } close $fh; my $string = ss(); $z->newStream( Name => 'from_ram.t', ExtAttr => 0666 << 16) or die "newStream failed: $ZipError\n"; $z->print ($string); close $z; sub ss { return <<END; a b c END }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Build 1 zip from file and string with IO::Compress::Zip
by mattk1 (Acolyte) on Mar 29, 2010 at 20:00 UTC | |
by pmqs (Friar) on Mar 31, 2010 at 19:22 UTC | |
|
Re^2: Build 1 zip from file and string with IO::Compress::Zip
by pmqs (Friar) on Mar 31, 2010 at 19:23 UTC |