9 my $err = shift and select STDERR;
10 say "usage: $0 [--list] [--diff[=gd|dp|gp]] [--diff-flags=--whatever] [--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 "D|diff-flags=s" => \my $opt_D,
28 "c|copy" => \my $opt_c,
30 "p|pat=s" => \my $opt_p,
35 my $pat = shift // ".";
38 my %exempt = map {( s/[\s\n].*\z//rs => 1 )} <DATA>;
41 foreach my $u ( [ "g", "dist-git/mcon/U" ],
51 $exempt{$_} and return;
53 my $u = do { local (@ARGV, $/) = $_; <> };
55 dir => $File::Find::dir,
58 lines => ($u =~ tr/\n/\n/),
63 foreach my $u (keys %m) {
68 $m{$u}{gd} = $g && $d ? length diff (\$g->{unit}, \$d->{unit}) : 0;
69 $m{$u}{dp} = $d && $p ? length diff (\$d->{unit}, \$p->{unit}) : 0;
70 $m{$u}{gp} = $g && $p ? length diff (\$g->{unit}, \$p->{unit}) : 0;
75 say " # Git Dist Perl Diff Unit";
76 say "=== ========= ====== ========= ====== ========= ====== ======================";
78 foreach my $u (sort { $m{$b}{gd} <=> $m{$a}{gd} || $m{$b}{dp} <=> $m{$a}{dp} } keys %m) {
79 my $d = $m{$u}{d} or next;
80 my $p = $m{$u}{p} or next;
81 my $g = $m{$u}{g} or next;
87 #$gd == 0 || $gd > 1000 and next;
90 $d->{unit} =~ $opt_p ||
91 $p->{unit} =~ $opt_p ||
92 $g->{unit} =~ $opt_p or next;
96 $gd || $dp || $gp or $su .= "\t** NO CHANGES LEFT **";
97 printf "%3d %5d/%3d %6d %5d/%3d %6d %5d/%3d %6d %s\n", $i++,
98 $g->{size}, $g->{lines}, $gd,
99 $d->{size}, $d->{lines}, $dp,
100 $p->{size}, $p->{lines}, $gp,
102 $opt_l and say " $_ $m{$u}{$_}{dir}/$u" for qw( g d p );
104 extdiff ($u, sort split // => $opt_d);
108 my ($u, $from, $to) = (@_, "", "");
110 my $f = $m{$u}{$from} or return;
111 my $t = $m{$u}{$to} or return;
121 my $ff = "$f->{dir}/$u";
122 my $tf = "$t->{dir}/$u";
126 system "cp", "-fp", $tf, $ff;
129 open my $fh, "-|", "diff $opt_D $ff $tf";
139 package.U Will never be equal due to conflicting needs