Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / March 2008



Tip: Looking for answers? Try searching our database.

Using Perl to Read jar file MANIFEST file.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Barto - 05 Mar 2008 18:23 GMT
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.
Signature

------------------------------------------------------------------------
*Michael Barto*
Software Architect

    LogiQwest Circle
LogiQwest Inc.
16458 Bolsa Chica Street, # 15
Huntington Beach, CA  92649
http://www.logiqwest.com/

           mbarto@logiqwest.com <mailto:mbarto@logiqwest.com>
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.

Claes Jakobsson - 05 Mar 2008 18:40 GMT
> 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
Claes Jakobsson - 05 Mar 2008 18:52 GMT
#!/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

>> 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  
[quoted text clipped - 8 lines]
> Cheers
> Claes
Michael Barto - 07 Mar 2008 17:58 GMT
THANK for the tip. This will work fine. Great mailing list

> #!/usr/bin/perl
>
[quoted text clipped - 34 lines]
>> Cheers
>> Claes

Signature

------------------------------------------------------------------------
*Michael Barto*
Software Architect

    LogiQwest Circle
LogiQwest Inc.
16458 Bolsa Chica Street, # 15
Huntington Beach, CA  92649
http://www.logiqwest.com/

           mbarto@logiqwest.com <mailto:mbarto@logiqwest.com>
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.

Charlie Garrison - 06 Mar 2008 04:30 GMT
Good afternoon,

On 5/3/08 at 10:23 AM -0800, Michael Barto
<mbarto@logiqwest.com> 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.

Did you ask CPAN? There seems to be a few modules which might be
helpful for you:

<http://search.cpan.org/search?query=jar&mode=all>

Charlie

Signature

   Charlie Garrison  <garrison@zeta.org.au>
   PO Box 141, Windsor, NSW 2756, Australia

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
http://www.ietf.org/rfc/rfc1855.txt

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.