Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm quite happily using Archive::Zip, but what I'm missing is a test wether the file is a zip file or not.
I receive attached files (*.txt, *.log and *.zip) by email.
My Mailprogram now calls my perl-prg
and 'delivers' all attachements as tmp-files (/tmp/../uihm7934.tmp),
so I'm loosing the post-scripts to recognize wether it is a zip-file or not.
No I want to check if the actual file (kluai8qwz.tmp) is it a zip-file (-> continue) or not (->next).
Right now I try to access that file
and I get this (unnecessary) errormessage:status = zip->read( $tmp );
Well the Error_Code is set as well, but this would be enough.format error: can't find EOCD signature Archive::Zip::Archive::_findEndOfCentralDirectory('Archive::Zi +p::Archive=HASH(0x85fd7ac)','IO::File=GLOB(0x85fd974)') called at /us +r/lib/perl5/sit e_perl/5.8.3/Archive/Zip.pm line 955 Archive::Zip::Archive::readFromFileHandle('Archive::Zip::Archi +ve=HASH(0x85fd7ac)','IO::File=GLOB(0x85fd974)','/tmp/kde-cas/kmailn0q +acc.tmp') calle d at /usr/lib/perl5/site_perl/5.8.3/Archive/Zip.pm line 929 Archive::Zip::Archive::read('Archive::Zip::Archive=HASH(0x85fd +7ac)','/tmp/kde-cas/kmailn0qacc.tmp') called at /home/QTS/bin/zipBarC +.pl line 52
Does anybody know a more elegant way of a zip-check?
Thanks in advance
Carl
Carl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: check *.tmp wether it's a zip or not
by tomhukins (Curate) on Nov 26, 2004 at 11:04 UTC | |
|
Re: check *.tmp wether it's a zip or not
by guha (Priest) on Nov 26, 2004 at 11:17 UTC | |
by Anonymous Monk on Nov 26, 2004 at 11:44 UTC | |
|
Re: check *.tmp wether it's a zip or not
by Hena (Friar) on Nov 26, 2004 at 11:40 UTC | |
|
Re: check *.tmp wether it's a zip or not
by Anonymous Monk on Nov 26, 2004 at 10:57 UTC | |
|
Re: check *.tmp wether it's a zip or not
by rev_1318 (Chaplain) on Nov 26, 2004 at 12:57 UTC | |
by fglock (Vicar) on Nov 26, 2004 at 13:29 UTC | |
by radiantmatrix (Parson) on Nov 26, 2004 at 15:18 UTC | |
by guha (Priest) on Nov 26, 2004 at 15:34 UTC |