wanadlan has asked for the wisdom of the Perl Monks concerning the following question:

use Archive::Zip; my $zipname = 'file.zip'; my $destinationDirectory = '/temp/'; my $zip = Archive::Zip->new($zipname); foreach my $member ($zip->members) { next if $member->isDirectory; (my $extractName = $member->fileName) =~ s{.*/}{}; $member->extractToFileNamed("$destinationDirectory/$extractName"); }

edited: Sun Jan 19 00:31:10 2003 by jeffa - removed br tags and added code tags

Replies are listed 'Best First'.
Re: how i can running this achive::zip program in CGI?
by poj (Abbot) on Jan 18, 2003 at 11:11 UTC
    It depends on how secure and robust you want the program to be. A simple program using eval ;
    #!c:/perl/bin/perl -w use strict; use Archive::Zip; use CGI; # run the program eval { my $zipname = 'c:/file.zip'; my $destinationDirectory = 'c:/temp/'; my $zip = Archive::Zip->new($zipname); foreach my $member ($zip->members) { next if $member->isDirectory; (my $extractName = $member->fileName) =~ s{.*/}{}; $member->extractToFileNamed("$destinationDirectory/$extractName"); } }; # result my $msg; if ($@) { $msg = "Error : $@"; } else { $msg = "Zip program ran OK "; } # html page my $q = new CGI; print $q->header( "text/html" ), $q->start_html( -title=>"Zip Program" ), $q->h2( $msg ), $q->end_html;
    poj
      poj,

      I had tried your simple program.
      It can run, but it cannot unzip 'file.zip' to /temp/
      It just tell that Zip Program OK.
      I hope you can tell me how to unzip the 'file.zip'.
      Your kindness I will never forget

      oh..I run Perl on Linux..

      thanx