Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: problem with Archive::Zip

by almut (Canon)
on Aug 09, 2010 at 12:01 UTC ( [id://853792] : note . print w/replies, xml ) Need Help??


in reply to problem with Archive::Zip

My guess would be that the $zip->addFile($renamed_file) failed and returned undef...  (so you're then trying to call desiredCompressionLevel(0) on this undefined value)

Replies are listed 'Best First'.
Re^2: problem with Archive::Zip
by jpfisher (Initiate) on Feb 28, 2019 at 18:59 UTC

    This problem also wasted a day of my time, because I am a very occasional user of perl. I hope to save someone else the trouble.

    This line failed on Win32 with the error quoted above:

    $zip->addFile("$workPath\\shared\\base.dll", "$packageName/base.dll") or die "$! add file failed \n";

    The actual problem was the $workPath was wrong, making base.dll unavailable, but the 'or die' which I added to debug, didn't catch the missing file error. Frankly, once I followed the exact suggestion to use -e -r -f to check the filespec, the root cause was instantly revealed. The following revealed the error:

     if (( -f $$workPath\\shared\\base.dll) && ( -r $workPath\\shared\\base.dll)) { print "good\n";}else{ die " blah blah blah\n";}