I would like to enable users to view the contents of a zip file via CGI interface. I have tinkered around with Archive::Zip, Archive::Zip::MemberRead, and Archive::Extract, and can't seem to figure out a way to work. After perusing the net for a solution to this, it seems that perhaps the only thing that these do is to either output into another file, directory, or at best, I get a result printed out of "HASH::blah blah blah". If anyone could shed some light as to how to do this, I would sure appreciate it.

Again, to clarify, I would like to actually display the files that are contained within the respective zip file. For example, a zip has "txt1.txt, txt2.txt, txt3.txt", screen would display these filenames to user.


I use IO::Uncompress::Unzip like so

#!/usr/bin/perl -w
use IO::Uncompress::Unzip qw($UnzipError);

my $zipfile = "t.zip";
my $u = new IO::Uncompress::Unzip $zipfile
        or die "Cannot open $zipfile: $UnzipError";

my $status;
for ($status = 1; ! $u->eof(); $status = $u->nextStream()) {
   my $filename = $u->getHeaderInfo()->{Name};
   print "$filename\n" ;


die "Error processing $zipfile: $!\n" if $status < 0 ;

Hope this helps.