Archive::Zip wasn't adding any files because you didn't give it any.
22 bytes is the size of an empty zip file.
Here's demo code: create empty file and see that it's 22 bytes.
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
my $zip = Archive::Zip->new();
unless ( $zip->writeToFileNamed("someZip1.zip") == AZ_OK ) {
die "write error: $!";
}
Same code, but add one file named "perl150.pl".
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
my $zip = Archive::Zip->new();
my $file_member = $zip->addFile( "perl150.pl" );
unless ( $zip->writeToFileNamed("someZip2.zip") == AZ_OK ) {
die "write error: $!";
}
And the output files:
$ ls -l someZip*
-rw-r--r-- 1 gmargo gmargo 22 Oct 28 10:39 someZip1.zip
-rw-r--r-- 1 gmargo gmargo 335 Oct 28 10:34 someZip2.zip
$ unzip -v someZip1.zip
Archive: someZip1.zip
warning [someZip1.zip]: zipfile is empty
$ unzip -v someZip2.zip
Archive: someZip2.zip
Length Method Size Ratio Date Time CRC-32 Name
-------- ------ ------- ----- ---- ---- ------ ----
282 Defl:N 217 23% 10-28-09 10:34 ade4be0c perl150.pl
-------- ------- --- -------
282 217 23% 1 file
|