[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2805
  • Last Modified:

Archive::Zip Compression Level Undefined Error

Can't call method "desiredCompressionLevel" on an undefined value at /usr/lib/perl5/site_perl/5.8.8/Archive/Zip/Archive.pm line 249.

I have no idea why this is happening.

CODE####


use Archive::Zip;
my $OBJ = Archive::Zip->new();  
for (1..10) {
  my $FILE="/temp/".$_.".zip";
  $OBJ->addFile($FILE);
  }
$OBJ->writeToFileNamed('/temp/zipofzips.zip')
0
Bob-Villa
Asked:
Bob-Villa
1 Solution
 
nemws1Database AdministratorCommented:
Maybe one of the files isn't there... (you shouldn't be getting this error here, I'm just grasping at straws with this).
use Archive::Zip;
my $OBJ = Archive::Zip->new();  
for (1..10) {
  my $FILE="/temp/".$_.".zip";
  $OBJ->addFile("$FILE") if (-e "$FILE");
}
$OBJ->writeToFileNamed('/temp/zipofzips.zip')

Open in new window

0
 
Bob-VillaAuthor Commented:
that was it. ugh. Thanks
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now