I am familiar with the stat function, which I use for some file size checks; however, due to the number of systems involved in creating the zip and mpg files, I was under the impression that I should be able to read the zip file header information that will tell me hard facts about the file I am reading.
I've learned that the following logic only supplies specifics about the files contained in the zip file:
use Archive::Zip;
my $zip = Archive::Zip->new($file_key);
foreach my $member ($zip->members())
{
printf("FILENAME=%s \n", $member->fileName());
printf("UNCOMPRESSEDSIZE=%8d \n", $member->uncompressedSize());
printf("COMPRESSEDSIZE=%8d \n", $member->compressedSize());
printf("LASTMODFILEDATETIME=%s \n", scalar(localtime($member->lastModFileDateTime())));
printf("DATAOFFSET=%s \n", $member->dataOffset);
printf("DISKNUMBERSTART=%s \n", $member->diskNumberStart);
printf("EXTERNALFILENAME=%s \n", $member->externalFileName);
printf("INTERNALFILEATTRIBUTES=%s \n", $member->internalFileAttributes);
printf("VERSIONNEEDEDTOEXTRACT=%s \n", $member->versionNeededToExtract);
printf("EXTERNALFILEATTRIBUTES=%s \n", $member->externalFileAttributes);
printf("DESIREDCOMPRESSIONLEVEL=%s \n", $member->desiredCompressionLevel);
printf("FH=%s \n", $member->fh);
printf("CDEXTRAFIELD=%s \n", $member->cdExtraField);
printf("COMPRESSIONMETHOD=%s \n", $member->compressionMethod);
printf("DESIREDCOMPRESSIONMETHOD=%s \n", $member->desiredCompressionMethod);
printf("LOCALEXTRAFIELD=%s \n", $member->localExtraField);
printf("FILECOMMENT=%s \n", $member->fileComment);
printf("LOCALHEADERRELATIVEOFFSET=%s \n", $member->localHeaderRelativeOffset);
printf("VERSIONMADEBY=%s \n", $member->versionMadeBy);
printf("BITFLAG=%s \n", $member->bitFlag);
printf("FILEATTRIBUTEFORMAT=%s \n", $member->fileAttributeFormat);
printf("CRC32=%s \n", $member->crc32);
}
Is there any way to retrieve the zip or mpg file header information within Perl? Or is the stat/lstat function my only option to retrieving specific data about the file size, date, etc?
Thanks for the feedback.