perl - Archive::Zip, EBook::Epub, and IIS6 - "desiredCompressionLevel" error -
i'm trying convert html files epub ebook::epub. script i've written simple, so:
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 run command line, works great. however, i'm trying deploy cgi script on iis6 server--which runs off same computer--it fails message:
can't call method "desiredcompressionlevel" on undefined value @ c:/strawberry/perl/vendor/lib/archive/zip/archive.pm line 252.
i checked out archive.pm, , line 252 in sub addfile. it's using 3 variables--$filename, $newname, $compressionlevel--and used print statements reveal values right before line 252. ($compressionlevel blank)
this command line, 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 server, bombs:
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'm guessing problem has temp files being written, don't know enough servers , archive::zip figure out. ideas?
make sure temp directory being written writable iis user iis runs (iis_iusrs and/or iusr). when run on commandline, you're running different user has permissions write c:\windows\temp. had similar problem (writing same temp dir) , able fix issue change temp directory more local published document root of web app had correct permissions under properties > security.
in situation, able set environment variable, tmpdir, in script:
$env{tmpdir} = 'c:\inetpub\tmp'
and folder permissions c:\inetpub\tmp updated writable iis_iusrs , iusr.
here's snippet http://metacpan.org/pod/archive::zip talks temp files , setting $env{tmpdir}
archive::zip::tempfile( [$tmpdir] ) create uniquely named temp file. returned open read/write. if $tmpdir given, used name of directory create file in. if not given, creates file using file::spec::tmpdir(). generally, can override choice using $env{tmpdir} environment variable. see file::spec documentation system. note on many systems, if you're running in taint mode, must make sure $env{tmpdir} untainted used. not create $tmpdir if doesn't exist (this change prior versions!). returns file handle , name: ($fh, $name) = archive::zip::tempfile(); ($fh, $name) = archive::zip::tempfile('mytempdir'); $fh = archive::zip::tempfile(); # if don't need name
Comments
Post a Comment