I was trying to search to see if this had been covered already, but the search engine is down.
All I want to do is unzip 1 or 2 files into a directory, rename a few files, and create a new zip file. Simple right?
Didn't think so....Archive::Zip has been giving me nothing but headaches...
So far this has been a grand waste of time and energy. I've resorted to trying to use external pkzip and pkunzip, but using backticks or system, the script hangs....it seems the script doesn't want to wait for the compress or decompress operation to complete before carrying on with the script, which will be important later in this program, because it launches a win32 program using backticks, and it's imperative that the script wait until the program is terminated to proceed, so if you have any clues as to what's happening there I'm all ears as well.
All I want to do is unzip 1 or 2 files into a directory, rename a few files, and create a new zip file. Simple right?
Code:
use Archive::Zip;
my @zipcontents=$zipfile->members();
foreach $file(@zipcontents){
extractMember($file,"@ini[1]temp/$file");
}
if (@gamedata[2] ne "null"){
my @zipfile = "@ini[0]@gamedata[2].zip"->members();
foreach $file(@zipfile){
extractMember($file,"@ini[1]temp/$file");
}
}
#Okay, all of our files from zips should be extracted
#to the temp directory. Several lines of code later,
#after we've renamed everything the way we want them...
opendir ROMS, "@ini[1]temp/";
my @roms = readdir ROMS;
closedir ROMS;
chomp (@roms=@roms);
my $zip = Archive::Zip->new("ini[1]temp/@gamedata[3].zip");
foreach $file(@roms){
$zip->AddFile("$file");
So far this has been a grand waste of time and energy. I've resorted to trying to use external pkzip and pkunzip, but using backticks or system, the script hangs....it seems the script doesn't want to wait for the compress or decompress operation to complete before carrying on with the script, which will be important later in this program, because it launches a win32 program using backticks, and it's imperative that the script wait until the program is terminated to proceed, so if you have any clues as to what's happening there I'm all ears as well.