I am need to uncompress a CSV file that is compress in a Zip file. I have
been trying for several days to uncompess it with two modules with no luck.
The first module is Compress::Zlib. I had tried using the 'uncompress'
function but it is not working. The other module that I had tried using is
Archive::Zip. With this one I can open files "I think", but I cannot
look/print it's content.
Can someone provide me with some code examples other than the ones that come
with the modules. I am send some of the scripts that I have been working on.
Hopefully someone can point out the mistakes that I am making. Thanks in
Advance.
-Max
Code +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 #!/usr/bin/perl -w
2 use strict ;
3
4 use Compress::Zlib ;
5
6 my $x = inflateInit() or die "Cannot create a inflation stream\n" ;
7
8 my ($output, $status) ;
9
10 open (IN,"ind.zip") or die "cannot open File: $!";
11
12 while (<IN>) {
13 ($output, $status) = $x->inflate($_) ;
14
15 print $output if $status == Z_OK or $status == Z_STREAM_END ;
16
17 last if $status != Z_OK ;
18 }
19
20 close IN;
21
22 die "inflation failed\n" unless $status == Z_STREAM_END ;
more CODE ==========================================================
1 #!/usr/bin/perl -w
2
3 use Archive::Zip;
4
5 my $in = IO::File->new('ind.zip','r');
6 my $zip = Archive::Zip->new();
7 my $status = $zip->readFromFileHandle($in);
8 print "$status,\n $zip,\n";
9 $zip->extractToFileNamed('out.txt');
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]