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

Hello,
I am trying to write a simple code to create an archive and to extract files from it on Windows. I am using Archive::Zip and I wrote 2 simple functions. The problem is that my extract_archive function works only on files created with WinZip but not on files created by my other function, create_arhive. However, WinZip extracts both type of files.
I have found on another PM node an example very similar with mine. But this example doesn't work either. Or at least it doesn't work for me.
I tried it with something like:
>perl -w zip.pl c D:/Explain/WithScript/archive.zip SomeFolder
=> archive created
>perl -w zip.pl x D:/Explain/WithScript/archive.zip
=> outputs "Done!" but does nothing
>perl -w zip.pl x D:/Explain/WithWinZip/archive.zip
=> extracts the files
Thank you for your help.

Replies are listed 'Best First'.
Re: handling archives with perl
by clinton (Priest) on Aug 16, 2007 at 15:08 UTC
    Razvanica it is very difficult to debug your code without being able to see it :)

    Please post the relevant code in your original node, between <code> tags.

    Clint

      Sorry, I thougth the link would do it. Anyway, I found the solution. Apparently the folder you want to put in your archive must be in the working directory, or you have to do a chdir() before calling Archive::Zip->addTree().