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.
Coincidence! (Score:1)
I rarely chdir though.
A better tip... (Score:2)
Re:A better tip... (Score:2)
I think Archive::Zip should do the rel2abs() by itself — or just not close the ZIP file.
Re:A better tip... (Score:2)
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... (Score:2)
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 [cpan.org]. What's your reason for not using chdir?
Re:A better tip... (Score:2)