Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl # author: Vladimir Bogdanov (vladb) # date: 2004-03 # Compares java classes in a set of jar files and # prints out a straightforward inconsistency report. use Getopt::Long; use Data::Dumper; use strict; ##--------------------------------------------- ## CONFIG ##--------------------------------------------- @cfg::options = ("help|h","m"); $cfg::unzip = "/usr/5bin/unzip"; ##--------------------------------------------- ## MAIN ##--------------------------------------------- my %opts; GetOptions(\%opts, @cfg::options); help() if ($opts{help}); my @jars = @ARGV; my (%jar_files, %jar_classes, $cmd, $out); for my $jar (@jars) { $cmd = "$cfg::unzip -l $jar"; my $pid = open(CMD, "-|"); unless ($pid) { exec($cmd) || die "can't exec program: $!"; } while (<CMD>) { if (/(\d+)[\t\s]+([\d-]+)[\t\s]+([\d:]+)[\t\s+]+((.*?)\.class)/) { my $d = [$1, $2, $3]; $jar_files{$jar}{$4} = $d; $jar_classes{$4}{$jar} = $d; } } close(CMD) || warn "failed to close CMD: $?"; } for my $c (keys %jar_classes) { my ($info, $size, $osize, $mod); for my $j (@jars) { if (exists $jar_classes{$c}{$j}) { $size = $jar_classes{$c}{$j}->[0]; $osize = $size unless (defined $osize); $mod = 1 if ($size != $osize); $info .= " $j \t" . join("\t", @{$jar_classes{$c}{$j}}) . " +\n"; } else { $mod = 1; $info .= " $j \tMISSING\n"; } } if ($opts{m}) { next unless $mod; $mod = ""; } else { $mod = "*** " if ($mod); } print "$mod$c:\n"; print "$info\n"; } ##--------------------------------------------- ## SUBROUTINES ##--------------------------------------------- sub help { print qq~ jardiff [help] <jarfile1> <jarfile2> Compares contents of two jar files. EXAMPLES: Show modified files only jardiff -m j.jar j1.jar ~; exit; }

In reply to jdiff - jar/java diff by vladb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2024-04-19 10:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found