Dear Monks
I need the last modified time from the files in a zipped archive. Here is my test code
#! /usr/bin/perl -l
use strict ;
use warnings ;
use Data::Dumper ;
use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
# Read a Zip file
my $zip = Archive::Zip->new();
unless ( $zip->read( 'out.zip' ) == AZ_OK ) {
die 'read error';
}
my @members = $zip->members();
foreach my $element(@members)
{
printf("%d %s %s\n",
$element->lastModFileDateTime(),
scalar(localtime($element->lastModFileDateTime())),
$element->fileName()
);
}
Output:
983734011 Sun Mar 4 20:26:51 2001 dir3/
983734011 Sun Mar 4 20:26:51 2001 dir3/file3
However, here is the output from
unzip
$> unzip -l out.zip
Archive: out.zip
Length Date Time Name
-------- ---- ---- ----
0 05-02-09 18:55 dir3/
0 05-02-09 18:55 dir3/file3
-------- -------
0 2 files
Note that the dates do not match. I guess there is a logical explanation for this, any suggestion ?
Cheers
LuCa
UPDATE: thnx derby,
lastModTime solved it!!