Archive :: Zip, EBook :: Epub and IIS6 - "wishCompressionLevel" error

I am trying to convert html files to epub using EBook :: Epub. The script I wrote is very simple, for example:

my $epub = EBook::EPUB->new; $epub->add_title('title'); $epub->add_author('author'); $epub->add_language('en'); $epub->copy_xhtml("d:/path/to/file.html" , "file.html"); $epub->pack_zip("d:/path/to/file.epub"); 

When I run this from the command line, it works fine. However, I am trying to deploy it as a CGI script on an IIS6 server - which runs from a single computer - it does not work with this message:

 Can't call method "desiredCompressionLevel" on an undefined value at C:/strawberry/perl/vendor/lib/Archive/Zip/Archive.pm line 252. 

I checked Archive.pm and line 252 is in sub addFile. It uses three variables - $ fileName, $ newName, $ compressionLevel - and I used some print statements to show their values ​​right before line 252. ($ compressionLevel is always empty)

This is from the command line that works:

 filename: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\7QiqzzNiN5/OPS/file.html newname: OPS/Advanced8247.html filename: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\7QiqzzNiN5/OPS/content.opf newname: OPS/content.opf filename: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\7QiqzzNiN5/OPS/toc.ncx newname: OPS/toc.ncx filename: C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\DkgiQN_pTq newname: META-INF/container.xml 

This is from the server that is bombing:

 filename: C:\WINDOWS\TEMP\8rxbvOVkKy/OPS/file.html newname: OPS/Advanced6575.html filename: C:\WINDOWS\TEMP\8rxbvOVkKy/OPS/content.opf newname: OPS/content.opf filename: C:\WINDOWS\TEMP\8rxbvOVkKy/OPS/toc.ncx newname: OPS/toc.ncx filename: C:\WINDOWS\TEMP\WqS7fskWi0 newname: META-INF/container.xml 

So, I assume that my problem is where temp files are written, but I really don't know enough about servers and Archive :: Zip to figure this out. Any ideas?

+4
source share
1 answer

Verify that the temp directory that is being written is writable by the IIS user who runs IIS (IIS_IUSRS and / or IUSR). When you run on the command line, you are working as another user who probably has write permissions in C: \ Windows \ Temp. I had a similar problem (recording at the same pace dir), and I was able to fix this problem by changing the temp directory to something more local to the published document root of my web application, which already had the correct permissions in Properties> Security.

In my situation, I was able to set the TMPDIR environment variable in the script:

 $ENV{TMPDIR} = 'C:\Inetpub\tmp' 

and folder permissions for C: \ Inetpub \ tmp have been updated to write to IIS_IUSRS and IUSR.

Here's a snippet from http://metacpan.org/pod/Archive::Zip that talks about temporary files and setting up $ ENV {TMPDIR}

 Archive::Zip::tempFile( [$tmpdir] ) Create a uniquely named temp file. It will be returned open for read/write. If $tmpdir is given, it is used as the name of a directory to create the file in. If not given, creates the file using File::Spec::tmpdir(). Generally, you can override this choice using the $ENV{TMPDIR} environment variable. But see the File::Spec documentation for your system. Note that on many systems, if you're running in taint mode, then you must make sure that $ENV{TMPDIR} is untainted for it to be used. Will NOT create $tmpdir if it doesn't exist (this is a change from prior versions!). Returns file handle and name: my ($fh, $name) = Archive::Zip::tempFile(); my ($fh, $name) = Archive::Zip::tempFile('myTempDir'); my $fh = Archive::Zip::tempFile(); # if you don't need the name 
0
source

All Articles