9 parse-strace-output-for-perlincludes.pl
13 parse-strace-output-for-perlincludes.pl [OPTIONS] strace.out-file
21 my @opt = <<'=back' =~ /B<--(\S+)>/g;
29 Full path to a perl from which we can query the INC paths
37 Needed for perl bin/parse-strace-output-for-perlincludes.pl --perl /home/sand/src/perl/repoperls/installed-perls/host/k93jammy/v5.39.4/6567/bin/perl ~sand/tmp/strace-6567.out
43 use lib
"$FindBin::Bin/../lib";
48 use ExtUtils
::MakeMaker
;
49 use File
::Basename
qw(dirname);
50 use File
::Path
qw(mkpath);
55 use Hash
::Util
qw(lock_keys);
56 use Digest
::MD5
qw(md5_hex);
59 lock_keys
%Opt, map { /([^=|!]+)/ } @opt;
67 my $strace_out_file = shift @ARGV or die "missing argument for strace-out-file on commandline";
69 warn "perl=$Opt{perl}";
70 my $cmd = qq{$Opt{perl
} -le 'my %seen; print join q{|}, grep { ! \
$seen{\
$_}++ } sort { length \
$b <=> length \
$a } \
@INC'};
72 my $inc_regexp = qx{$cmd};
73 warn "inc_regexp=$inc_regexp";
74 open my $fh, '<', $strace_out_file or die "Could not open $strace_out_file: $!";
79 next unless m{"($inc_regexp)/(.*?\.pm)"};
80 my($path,$mod) = ($1,$2);
83 my $abspath = "$path/$mod";
84 my $data = do { open my $fh2, "<", $abspath or die "Could not open $abspath: $!"; local $/; <$fh2> };
85 my $digest = md5_hex $data;
86 my $version = MM->parse_version($abspath);
87 printf "%5d %-48s %s %s\n", $i, $mod, $digest, $version;
95 # cperl-indent-level: 4