Re: Using Perl to Read jar file MANIFEST file.
[email protected] (Michael Barto)
| Newsgroups | perl.macosx |
|---|---|
| Organization | LogiQwest |
| Message-ID | <[email protected]> |
THANK for the tip. This will work fine. Great mailing list
Claes Jakobsson wrote:
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
> use Archive::Zip::MemberRead;
>
> my $archive = Archive::Zip->new();
> die "read error" if $archive->read(shift) != AZ_OK;
>
> my $fh = Archive::Zip::MemberRead->new($archive,
> "META-INF/MANIFEST.MF");
> while (defined($_ = $fh->getline())) {
> print "$_\n";
> }
>
>
>
> galaxy:~ claes$ perl jar_reader.pl /usr/share/java/junit.jar
> Manifest-Version: 1.0
> Ant-Version: Apache Ant 1.6.5
> Created-By: 1.5.0_04-b05 (Sun Microsystems Inc.)
>
>
> seems to work
>
> /Claes
>
> On 5 mar 2008, at 19.40, Claes Jakobsson wrote:
>> On 5 mar 2008, at 19.23, Michael Barto wrote:
>>> Has anybody every tried to create a Perl program ro read the
>>> contents of the MANIFEST file in java jar file? We are trying to
>>> develop something to provide comparisons for change between
>>> different implementations. Is this a simple Perl backtic, system or
>>> exec of the jar command or is there a more exotic way to do it?
>>> Also, we need to extract Checksum. But that seems documented.
>>
>> If I remember correctly JAR files are simply Zip files so you should
>> be able to use something like Archive::Zip to read the file.
>>
>> Cheers
>> Claes
>
--
------------------------------------------------------------------------
*Michael Barto*
Software Architect
LogiQwest Circle
LogiQwest Inc.
16458 Bolsa Chica Street, # 15
Huntington Beach, CA 92649
http://www.logiqwest.com/
[email protected] <mailto:[email protected]>
Tel: 714 377 3705
Fax: 714 840 3937
Cell: 714 883 1949
*'tis a gift to be simple*
------------------------------------------------------------------------
This e-mail may contain LogiQwest proprietary information and should be
treated as confidential.