metalgear119 has asked for the wisdom of the Perl Monks concerning the following question:
I am using version 1.16. I am using ActiveState 5.8.6.sub ZipFiles { use Archive::Zip qw(:ERROR_CODES :CONSTANTS); my $ret = 0; my @msg = (); if ( @_ > 1 ) { my $fileName = shift; my @fileNames = @_; $fileName =~ s/\.zip//; my $zip = Archive::Zip->new(); foreach my $memberName (@fileNames) { if (-d $memberName ) { push(@msg, "Error: Could not add directory $memberName + to zip file.") if $zip->addTree( $memberName, $memberName ) != AZ +_OK; } else { $zip->addFile( $memberName ) or push(@msg, "Error adding file $memberName\n") +; } } if ($zip->writeToFileNamed( "$fileName.zip" ) != AZ_OK ) { $ret = 1; push (@msg, "Error: Zip file could not be created. A write + error has occured. Verify that specified directory is correct."); } } else { $ret = 1; push(@msg, "Error: Number of arguments does not match specifie +d amount."); } if ( $ret == 0 ) { @msg = (); push(@msg, "Files have been zipped successfully."); } return wantarray ? ($ret, @msg) : $ret; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Archive::Zip Problems under windows sp2
by Steve_p (Priest) on Jul 29, 2005 at 02:32 UTC | |
|
Re: Archive::Zip Problems under windows sp2
by wufnik (Friar) on Jul 29, 2005 at 06:55 UTC |