9 my $err = shift and select STDERR;
10 say "usage: $0 [--list] [--diff[=gd|dp|gp]] [--pat=pattern]";
11 say " diff (size) between git / dist / perl";
12 say " where git (g) is the version from the git repo of meta/dist";
13 say " where dist (d) is the unmodified installed version from dist";
14 say " where perl (p) is the *modified* version for use with perl";
20 use Getopt::Long qw(:config bundling);
22 "help|?" => sub { usage (0); },
23 "V|version" => sub { say $0 =~ s{.*/}{}r, " [$VERSION]"; exit 0; },
25 "l|list!" => \my $opt_l,
26 "d|diff=s" => \my $opt_d,
27 "c|copy" => \my $opt_c,
29 "p|pat=s" => \my $opt_p,
32 my $pat = shift // ".";
37 foreach my $u ( [ "g", "dist-git/mcon/U" ],
47 my $u = do { local (@ARGV, $/) = $_; <> };
49 dir => $File::Find::dir,
52 lines => ($u =~ tr/\n/\n/),
57 foreach my $u (keys %m) {
62 $m{$u}{gd} = $g && $d ? length diff (\$g->{unit}, \$d->{unit}) : 0;
63 $m{$u}{dp} = $d && $p ? length diff (\$d->{unit}, \$p->{unit}) : 0;
64 $m{$u}{gp} = $g && $p ? length diff (\$g->{unit}, \$p->{unit}) : 0;
69 say " # Git Dist Perl Diff Unit";
70 say "=== ========= ====== ========= ====== ========= ====== ======================";
72 foreach my $u (sort { $m{$b}{gd} <=> $m{$a}{gd} || $m{$b}{dp} <=> $m{$a}{dp} } keys %m) {
73 my $d = $m{$u}{d} or next;
74 my $p = $m{$u}{p} or next;
75 my $g = $m{$u}{g} or next;
81 #$gd == 0 || $gd > 1000 and next;
84 $d->{unit} =~ $opt_p ||
85 $p->{unit} =~ $opt_p ||
86 $g->{unit} =~ $opt_p or next;
90 $gd || $dp || $gp or $su .= "\t** NO CHANGES LEFT **";
91 printf "%3d %5d/%3d %6d %5d/%3d %6d %5d/%3d %6d %s\n", $i++,
92 $g->{size}, $g->{lines}, $gd,
93 $d->{size}, $d->{lines}, $dp,
94 $p->{size}, $p->{lines}, $gp,
96 $opt_l and say " $_ $m{$u}{$_}{dir}/$u" for qw( g d p );
98 extdiff ($u, sort split // => $opt_d);
102 my ($u, $from, $to) = (@_, "", "");
104 my $f = $m{$u}{$from} or return;
105 my $t = $m{$u}{$to} or return;
115 my $ff = "$f->{dir}/$u";
116 my $tf = "$t->{dir}/$u";
120 system "cp", "-fp", $tf, $ff;
123 open my $fh, "-|", "diff -w $ff $tf";