If you're using Archive::Zip, one thing to remember is that if you chdir after you open the zip file, things will break if you opened the zip with an relative path. This is because Archive::Zip closes the filehandle after it has read the directory structure and then it can't re-open it to extract a file. Using File::Spec::rel2abs is the easy way to fix this.
Re:A better tip...
bart on 2004-04-28T19:58:24
Booh.I think Archive::Zip should do the rel2abs() by itself — or just not close the ZIP file.
Re:A better tip...
Matts on 2004-04-28T22:31:06
I agree - it shouldn't close the file.
But in general programming terms I've come to think that any use of chdir() is probably a bad thing. Unless you have to exec a program that expects to be in a certain dir, but then you should probably fork, chdir, and exec.Re:A better tip...
gav on 2004-04-28T23:09:10
But in general programming terms I've come to think that any use of chdir() is probably a bad thing.
I've never considered chdir a bad thing, especially with File::chdir. What's your reason for not using chdir?
Re:A better tip...
Matts on 2004-04-29T08:04:42
Without File::chdir, chdir() has global effects. I recommend not using it the same way I recommend not using global variables.