CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Archive Zip desiredCompressionLevel Error

 



fds
Novice

Aug 18, 2010, 9:31 AM

Post #1 of 1 (1749 views)
Archive Zip desiredCompressionLevel Error Can't Post

When I zip up files I get an error.
This happens if Archive::Zip 1.3

I originally ran the script fine on earlier versions up to 1.26 and did not get the error. My live server has Version 1.3, so I installed the same on IndigoPerl on my PC and got the error - which is good (in a way sigh) - at least both servers now match....

Error

Code
Can't call method "desiredCompressionLevel" on  
an undefined value at C:/aaa/perl/site/lib/Archive/Zip/Archive.pm line 249.


The code I am using.

Code
Notes: 
$dir = "absolutepathto/foldername";
--------------------------------------
use Archive::Zip;
use File::Find;
use File::Spec::Functions qw(abs2rel);
($dir, $flatten) = @_;
die "Invalid parameter $dir" unless -e $dir && -d $dir;
$zip = Archive::Zip->new();
find ( sub {
$name = $flatten ? $_ : abs2rel($File::Find::name, $dir);
$zip->addFile($File::Find::name, $name);
}, $dir);
if (
$zip->writeToFileNamed("foldername.zip"),
) {
print qq ~<div align="center">Error cannot create backup!~;
} else {
print qq ~<b>($zipname)</b> has been zipped up</div>~;
}


I need the above code so that I get rid of all the extra folders, so how would I make this work properly.

Any help appreciated.
Thanks - Ted
----------------------------------------------
fdsaadsfdsaf

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives