Re: Using Perl to Read jar file MANIFEST file.

2008-03-07 Thread Michael Barto




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
Inc.
16458 Bolsa Chica Street, # 15
Huntington Beach, CA92649
  http://www.logiqwest.com/
  
  
  
  [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. 

  








How to run Perl script at Mac OS (Darwin) Release?

2008-03-07 Thread Gary Yang
Hi,
   
  Below is my Perl script. The script named, test1.pl
   
  test1.pl
   
  #!/usr/local/ActivePerl-5.10/bin/perl -w
   
  print $^O\n;
   
   
  I have to type, perl test1.pl in order to run it. I got command not found 
if I simply typed test1.pl. Can someone tell me why and how to fix it? 
   
  test1.pl
  -bash: test1.pl: command not found
   
   
  Thanks
   
   
  Gary
   

   
-
Never miss a thing.   Make Yahoo your homepage.

Re: How to run Perl script at Mac OS (Darwin) Release?

2008-03-07 Thread Chas. Owens
On Fri, Mar 7, 2008 at 1:35 PM, Gary Yang [EMAIL PROTECTED] wrote:
 Hi,
   Below is my Perl script. The script named, test1.pl
   test1.pl

   #!/usr/local/ActivePerl-5.10/bin/perl -w

   print $^O\n;


   I have to type, perl test1.pl in order to run it. I got command not found 
 if I simply typed test1.pl. Can someone tell me why and how to fix it?

   test1.pl
   -bash: test1.pl: command not found
snip

First, you  must make sure it has  been marked as executable:

chmod a+x test1.pl

then you must either make sure it is in a directory in your PATH or
run it with either a relative or absolute name:

./test1.pl

/home/username/test1.pl
-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.