ASPL Manual v 1.00
© 2024 by SetSphere.COM


12-10

   Script jarcompare.pl

Comparing many Jar files that have the same name but they come from different distributions. The Perl script jarcompare.pl creates an ASPL script to compare many Jar files, then presents the script to the ASPL interpreter via STDIN to process the script.


       [Top Text]

 -L- Listing. 12.10.1   [LISTING jarcompare.pl][ASPL Script jarcompare.pl]
(raw text)
1.     #!/usr/bin/perl
2.     
3.     use strict;
4.     
5.     # jarcompare.pl compares two or many Jar files:
6.     #   jarcompare.pl file1 file2 ..
7.     
8.     usage() unless @ARGV > 1;
9.     sub usage { print join "",<DATA>; exit; }
10.    
11.    my $interpreter = "aspl -groupingclass POSIX -wsname TRANSIENT -singlepass";
12.    my $s = "displayoff\n";
13.    
14.    my @jars;
15.    for (my $i=0; $i<@ARGV; $i++) {
16.        die "CANNOT READ THE JARFILE $ARGV[$i]\n" unless -r $ARGV[$i];
17.        # adding aspl variables as jar0 jar1 ..
18.        $s .= "jar$i = ggjar(jarfile,$ARGV[$i],calchksum,1,calentropy,1)\n";
19.        push(@jars,"jar$i");
20.    }
21.    $s .= "
22.    displayon
23.    ks chksum ppdd ffl
24.    gU @jars
25.    sim @jars
26.    ";
27.    
28.    open(ASPL, "| $interpreter -STDIN") or die "ERROR OPENING A PIPE TO aspl: $! 
      \n"; 
29.    print ASPL $s;
30.    close ASPL;
31.    
32.    __END__
33.    
34.       jarcompare.pl must be followed by a list of jar files
35.    
36.         jarcompare.pl  jarfile1  jarfile2  ..
37.    

ASPL(C) 2024 Bassem Jamaleddine




This example is shown in the following terminal.        display or terminal for Example: Script jarcompare.pl
viewme

 -E- Display. 12.10.1   [Script jarcompare.pl][Script jarcompare.pl]
run for jarcompare-pl-links